Skip to Content
Menu
This question has been flagged
2 Replies
344 Views

Hello odooers,

We produce some granulate and fill it into big bags that we want to track. We do not fill big bags exactly 1 ton, but 1.2 tons or 0.89 tons or something like that.

We only want to sell and ship whole big bags. If a customer orders 2 tons of this granulate, we take the first two big bags and ship them. If one big bag contains 1.2 tons and the other 1.11 tons, the customer receives 2.31 tons and is invoiced for these 2.31 tons.

I know three ways to track goods in odoo:

  • serial numbers - do not work because only 1 ton is accepted, variable weight is not allowed.
  • lot numbers - do not work either because odoo takes the exact amount ordered from lots; you can manually adjust the amount taken from a lot, but you must first check the available amount before entering the number which is very cumbersome
  • packages - same behavior as for lot numbers

Ideally, we would use lot numbers (or packages) and check the option "never separate lots", which is not available in odoo.

Is there any other solution for that?

Avatar
Discard
Author Best Answer

Hello Ray, thank you very much for the detailed solution description. During implementation, I unexpectedly got stuck when modifying the list view of the sub-form. Added columns do not appear when leaving studio:

The studio modification does not work for the sub form as well: The "Example" label remains invisible:

Any ideas, why this is happening for this particular list view?

Avatar
Discard
Best Answer

You can customize Odoo fairly easily to help manage this.

First, setup your product using a standard weight or volume Unit of Measure. In this example, we have a product Aggregate that we stock in tons. We sell 1 ton bags for $500 but the weight of each can be slightly more or less. 

By using Lots to represent a bag we can reflect each bag we have in Inventory and everyone knows roughly how many bags we have. Here we have three bags in stock, almost 3 tons:


We then sell 2 bags (2 tons) and during quoting our staff can see we have 2.98 tons in stock:


The Delivery Order associated with this Sales Order will automatically reserve all 3 lots because that's the way to get to exactly 2 tons:

You can see our customization here in the red box, a new field showing us the quantity of the Lot, and a button allowing us to replace the quantity Odoo reserves with the full quantity:


In this case, our user would simply delete the second lot and click the arrow to change the quantity of 0.05 to 1.03 (or use whatever other logic to adjust the reserved lot quantities to get close to 2 tons - in our case we get 1.99 and that's OK for us).


The Sales Order will now show we have delivered 1.99 tons and the Customer will be charged $995 when the Invoice is created.


We only needed three quick customizations:

1) a new field on the stock.move.line model (Lot Quantity)


2) a new Server Action to replace the quantity:

for stock_move_line in records:
    stock_move_line['quantity'] = stock_move_line.x_lot_qty


3) a new View to add both things to the popup view on the Delivery Order:

<field name="quantity" position="before">
    <field name="x_lot_qty"/>
    <button name="545" type="action" help="Replace Quantity" icon="fa-arrow-right" invisible="quantity == x_lot_qty"/>
</field>


Note that "545" here is the ID of the Server Action you created. 


You will probably also want to inherit and override stock.view_stock_move_line_detailed_operation_tree in addition to stock.view_stock_move_line_operation_tree (the one I have above) so the same feature is available via the List shown when clicking the Smart Button on the Delivery Order.


Note: this is a prototype, not necessarily a complete solution. If you don't have the technical skills to do this yourself, discuss your needs with an Odoo Partner or Odoo Digital Advisor. It has not been tested in all situations and may need further work before being useful for every scenario.

Avatar
Discard
Related Posts Replies Views Activity
1
May 25
292
1
May 25
259
1
May 25
159
1
May 25
260
2
May 25
247