Weight and total weight in a pick list

Hello fellow friends,

till now, I used the “secondary unit” module to get an item’s weight into my picklist. Some research made me think whether this actually is the wrong module for this purpose, as I need to set manually every secondary unit for every single product sold.

So I tried the stock_shipment_measurements module, where I can save the products’ weights. But now I need to know which statement has to be used in the report. At present, in my picklist I have a column with this statement:

<format_number(move.secondary_quantity, user.language, digits=move.secondary_unit.digits)><move.secondary_unit.symbol>
</if>

What would I need instead? - And which statement is for ‘total weight of all items in shipment’?

Or am I trying the wrong approach?

Thanks a lot in advance, Wolf

Wolf, take a look the fields of the Customer Shipment model:
Administration | Models | Models
There you will see very clearly the field you need.

I use this very often, it is a very useful tool to explore what data different models store.

1 Like

The module adds measurement fields on the product model. So you need to get those attributes from the product. You have moves and each move have a product and each product have a new field “weight” and “weight_uom”.

Also, for the total weight, you have 2 options:

  • sum yourself with a loop over the moves
  • if you have stock_shipment_measurements activated, you have there the weight of the shipment and the internal_weight of the move
1 Like

Thank you for your hints.

Unluckily, still I’m not a programmer, so I don’t have basic understanding how these things combine. I found the stock.shipment.out model and “weight” and “weight_uom” - but sorry, I don’t have any idea how to create an entry to the report.

<format_number(move.product.weight, user.language, digits=move.product.weight_uom.digits)><move.product.weight_uom.symbol>

You just need to go where Dimitrios pointed and follow the path from your current model to your desired field.

Thanks for your attempts to make it dummy-proof. This is my ungoing problem: You guys seem not to have an idea how little all these things are self-evident to somebody who only has a vague idea on all of you programmers’ concepts. For me, explanations in detail are essential. Sorry for that.

Now:
I followed Adria’s advice - but it will report the weight of a single item, not of the whole move line. How would I do that?

By multiplying the weight for the move.quantity

Thank you all, fellow friends. Separately mention deserves Mr. @Gruenfischer, how delivered the final clou.

This is what solved my problem:

In the pick list:

  • an additional column can be created for the weight per line, i.e. per consignment item, with the entry: <(format_number(move.product.weight*move.quantity, user.language, digits=move.product.weight_uom.digits) + ' ' + move.product.weight_uom.symbol) if (move.product.weight and move.quantity) else 'n.e'>.
    This also intercepts empty entries for the article and enters “n.e.” (not entered) there. This should work in the same way for “length”, “volume” etc.
  • The total (net) weight of a shipment can be determined by the entry:
    <format_number(shipment.weight, user.language, digits = 1)> <shipment.weight_uom.symbol>
    in a new line of the report, between the two </FOR> statements.

I added this to Tryton community wiki and our German Tryton-Buch, suggestions for improvement are highly welcome.

Still, I think it’s a pity that these source are not linked at tryton.org, such they cannot be as helpful as they could.

Cheers,
Wolf

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.