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_has_packages

View 17.0
Inputs Method Outputs
  • id
- domain = [('picking_id', 'in', self.ids), ('result_package_id', '!=', False)]
- cnt_by_picking = self.env['stock.move.line']._read_group(domain, ['picking_id'], ['__count'])
- cnt_by_picking = {picking.id: count for picking, count in cnt_by_picking}
- for picking in self:
-             picking.has_packages = bool(cnt_by_picking.get(picking.id, False))
  • has_packages

Back to entity