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

Compute Method: _compute_bulk_weight

View 19.0
Inputs Method Outputs
  • id
  • uom_id
  • weight
+ picking_weights = defaultdict(float)
+ res_groups = self.env['stock.move.line']._read_group(
+             [('picking_id', 'in', self.ids), ('product_id', '!=', False), ('result_package_id', '=', False)],
+             ['picking_id', 'product_id', 'product_uom_id', 'quantity'],
+             ['__count'],
+         )
+ for picking, product, product_uom, quantity, count in res_groups:
+             picking_weights[picking.id] += (
+                 count
+                 * product_uom._compute_quantity(quantity, product.uom_id)
+                 * product.weight
+             )
+ for picking in self:
+             picking.weight_bulk = picking_weights[picking.id]
  • weight_bulk

Back to entity