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

Module: Inventory

Entity: stock.picking.batch

Compute Method: _compute_state

View 20.0
Inputs Method Outputs
  • picking_ids
+ batchs = self.filtered(lambda batch: batch.state not in ['cancel', 'done'])
+ for batch in batchs:
+             if not batch.picking_ids:
+                 continue
+             # Cancels automatically the batch picking if all its transfers are cancelled.
+             if all(picking.state == 'cancel' for picking in batch.picking_ids):
+                 batch.state = 'cancel'
+             # Batch picking is marked as done if all its not canceled transfers are done.
+             elif all(picking.state in ['cancel', 'done'] for picking in batch.picking_ids):
+                 batch.state = 'done'
  • state

Back to entity