33 lines
921 B
Python
33 lines
921 B
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2026 Nexa Systems Inc.
|
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
|
# Part of the Fusion Plating product family.
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class FpBatch(models.Model):
|
|
"""Extend batch with M2M link to MRP work orders.
|
|
|
|
GAP 6: Batch ↔ Work Order linkage so the shop knows which WOs
|
|
were processed in which tank batch (rack/barrel load).
|
|
"""
|
|
_inherit = 'fusion.plating.batch'
|
|
|
|
workorder_ids = fields.Many2many(
|
|
'mrp.workorder',
|
|
'fp_batch_mrp_workorder_rel',
|
|
'batch_id',
|
|
'workorder_id',
|
|
string='Work Orders',
|
|
help='MRP work orders processed in this batch.',
|
|
)
|
|
workorder_count = fields.Integer(
|
|
string='WO Count',
|
|
compute='_compute_workorder_count',
|
|
)
|
|
|
|
def _compute_workorder_count(self):
|
|
for rec in self:
|
|
rec.workorder_count = len(rec.workorder_ids)
|