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

Module: Sale Blanket Orders

Entity: sale.blanket.order

Compute Method: _compute_state

View 19.0
Inputs Method Outputs
  • confirmed
  • validity_date
  • line_ids
+ today = fields.Date.today()
+ precision = self.env["decimal.precision"].precision_get(
+             "Product Unit of Measure"
+         )
+ for order in self:
+             if not order.confirmed:
+                 order.state = "draft"
+             elif order.validity_date <= today:
+                 order.state = "expired"
+             elif float_is_zero(
+                 sum(
+                     order.line_ids.filtered(lambda line: not line.display_type).mapped(
+                         "remaining_uom_qty"
+                     )
+                 ),
+                 precision_digits=precision,
+             ):
+                 order.state = "done"
+             else:
+                 order.state = "open"
  • state

Back to entity