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

Compute Method: _compute_is_scrap

Inputs Method Outputs
grouped_move_lines = self.env['stock.move.line']._read_group([('lot_id', 'in', self.ids), ('is_scrap', '=', True)], ['lot_id'], ['id:recordset'])
move_lines_by_lot = dict(grouped_move_lines)
for lot in self:
            lot.is_scrap = bool(move_lines_by_lot.get(lot))

Back to entity