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.location

Compute Method: _compute_is_empty

Inputs Method Outputs
groups = self.env['stock.quant']._read_group(
            [('location_id.usage', 'in', ('internal', 'transit')),
             ('location_id', 'in', self.ids)],
            ['location_id'], ['quantity:sum'])
groups = dict(groups)
for location in self:
            location.is_empty = groups.get(location, 0) <= 0

Back to entity