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: res.company

Compute Method: _compute_scrap_location_id

View 20.0
Inputs Method Outputs
  • id
+ grouped_scrap_locations = self.env['stock.location']._read_group([('company_id', 'in', self.ids), ('usage', '=', 'inventory')], ['company_id'], ['id:min'])
+ scrap_locations_per_company = {company.id: loc_id for company, loc_id in grouped_scrap_locations}
+ for company in self:
+             company.scrap_location_id = scrap_locations_per_company.get(company.id)
  • scrap_location_id

Back to entity