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

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', 'uom_id', 'quantity'],
            ['__count'],
        )
for picking, product, uom_id, quantity, count in res_groups:
            picking_weights[picking.id] += (
                count
                * uom_id._compute_quantity(quantity, product.uom_id)
                * product.weight
            )
for picking in self:
            picking.weight_bulk = picking_weights[picking.id]

Back to entity