Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Stock - Maintenance

Entity: maintenance.equipment

Compute Method: _compute_match_serial

Inputs Method Outputs
  • serial_no
if not self.env['stock.lot'].has_access('read') or not self.env.user.has_group('stock.group_production_lot'):
            self.match_serial = False
            return
matched_serial_data = self.env['stock.lot']._read_group(
            [('name', 'in', self.mapped('serial_no'))],
            ['name'],
            ['__count'],
        )
matched_serial_count = dict(matched_serial_data)
for equipment in self:
            equipment.match_serial = matched_serial_count.get(equipment.serial_no, 0)

Back to entity