# -*- coding: utf-8 -*- # Copyright 2026 Nexa Systems Inc. # License OPL-1 (Odoo Proprietary License v1.0) # Part of the Fusion Plating product family. # # Sub 5 — attach MO reverse links to fp.serial. Defined here rather than # in fusion_plating_configurator because configurator loads before # bridge_mrp; declaring the O2M at configurator setup time would fail # because mrp.production.x_fc_serial_id wouldn't exist yet. from odoo import api, fields, models class FpSerial(models.Model): _inherit = 'fp.serial' production_ids = fields.One2many( 'mrp.production', 'x_fc_serial_id', string='Manufacturing Orders', ) production_count = fields.Integer(compute='_compute_production_count') @api.depends('production_ids') def _compute_production_count(self): for rec in self: rec.production_count = len(rec.production_ids)