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

Compute Method: _compute_scrap_location_id

Inputs Method Outputs
groups = self.env['stock.location']._read_group(
            [('company_id', 'in', self.company_id.ids), ('scrap_location', '=', True)], ['company_id'], ['id:min'])
locations_per_company = {
            company.id: stock_warehouse_id
            for company, stock_warehouse_id in groups
        }
for scrap in self:
            if scrap.company_id:
                scrap.scrap_location_id = locations_per_company.get(scrap.company_id.id, False)

Back to entity