Contributors mailing list archives

Browse archives


Outgoing quantity from draft/sent or not fully delivered confirmed orders (odoo14)

Francesco Ballerini
- 04/06/2024 17:16:55

I am looking for way to compute a field on products that shows the "free quantity" in a slightly different way compared to Odoo:
Odoo will show free quantity as "qty on hand - reserved qty", but the reserved quantity is related to stock moves so the evaluation involves an order confirmation.

I have been asked to add a new "free quantity" field that is computed instead as "qty on hand - outgoing qty" where the outgoing quantity should be computed from

  •  'draft' (quotations) orders
  • 'sent' (e-Commerce) orders
  • 'confirm' orders but only for those lines that hasn't been fully delivered

I might have found an approach to this, which I'll describe below, but I'd like to ask if you have a better suggestion (in best case a field that I've missed or maybe a module introducing this), as I was looking for an easier or better way to achieve this task. 

Otherwise I think I can do the following:

I think I can use this module maybe in combination with its parent sale_delivery_state, in order to filter out the majority of orders and evaluate the remaining order lines, filtered by active product: 
the sum of `demanded quantity - delivered quantity` for all those lines should match the needed computation I need for the "outgoing" quantity at this point.

Do you have any hint for a shorter and/or better way?

Thanks in advance

Francesco Ballerini