Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Sales and Warehouse Management

Entity: sale.order.line

Compute Method: _compute_qty_to_deliver

View 18.0 View 19.0
Inputs Method Outputs
  • product_uom_qty
  • qty_delivered
  • state
  • is_storable
  • product_uom
  • qty_to_deliver
  • move_ids
  • product_uom_id
"""Compute the visibility of the inventory widget."""
for line in self:
            line.qty_to_deliver = line.product_uom_qty - line.qty_delivered
-             if line.state in ('draft', 'sent', 'sale') and line.is_storable and line.product_uom and line.qty_to_deliver > 0:
-                 if line.state == 'sale' and not line.move_ids:
+             if line.state in ('draft', 'sent', 'sale') and line.is_storable and line.product_uom_id and line.qty_to_deliver > 0:
+                 if line.state == 'sale' and all(m.state in ['done', 'cancel'] for m in line.move_ids):
                    line.display_qty_widget = False
                else:
                    line.display_qty_widget = True
            else:
                line.display_qty_widget = False
  • qty_to_deliver
  • display_qty_widget

Back to entity