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

Compute Method: _compute_sn_duplicated

Inputs Method Outputs
self.sn_duplicated = False
domain = [('tracking', '=', 'serial'), ('lot_id', 'in', self.lot_id.ids), ('location_id.usage', 'in', ['internal', 'transit'])]
results = self._read_group(domain, ['lot_id'], having=[('__count', '>', 1)])
duplicated_sn_ids = [lot.id for [lot] in results]
quants_with_duplicated_sn = self.env['stock.quant'].search([('lot_id', 'in', duplicated_sn_ids)])
quants_with_duplicated_sn.sn_duplicated = True

Back to entity