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

Module: Warehouse Management: Batch Transfer

Entity: stock.picking.batch

Compute Method: _compute_estimated_shipping_capacity

Inputs Method Outputs
  • package_type_id
  • shipping_weight
  • product_id
  • product_id.weight
  • product_qty
  • product_id.volume
for batch in self:
            estimated_shipping_weight = 0
            estimated_shipping_volume = 0
            # packs
            for pack in batch.move_line_ids.result_package_id:
                p_type = pack.package_type_id
                estimated_shipping_weight += pack.shipping_weight
                if p_type:
                    estimated_shipping_weight += p_type.base_weight or 0
                    estimated_shipping_volume += (p_type.packaging_length * p_type.width * p_type.height) / 1000.0**3
            # move without packs
            for move in batch.picking_ids.move_ids_without_package:
                estimated_shipping_weight += move.product_id.weight * move.product_qty
                estimated_shipping_volume += move.product_id.volume * move.product_qty
            batch.estimated_shipping_weight = estimated_shipping_weight
            batch.estimated_shipping_volume = estimated_shipping_volume

Back to entity