sf-制造-产品-表单详情中-工艺参数显示内容=未归档,未绑定产品的工艺参数

This commit is contained in:
liaodanlong
2025-05-14 11:49:14 +08:00
parent 3763b60758
commit ed55e36f45
2 changed files with 9 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ class SfProductionProcessParameter(models.Model):
_inherit = 'sf.production.process.parameter'
service_products = fields.Many2one(
'product.template',
string='外协服务产品',compute='_compute_service_products',
string='外协服务产品',compute='_compute_service_products',inverse='_inverse_service_products',
store=True
)
outsourced_service_products = fields.One2many(
@@ -20,7 +20,13 @@ class SfProductionProcessParameter(models.Model):
is_product_button = fields.Boolean(compute='_compute_is_product_button',default=False)
is_delete_button = fields.Boolean(compute='_compute_is_delete_button', default=False)
routing_id = fields.Many2one('mrp.routing.workcenter', string="工序")
def _inverse_service_products(self):
for record in self:
if record.service_products:
# 确保关联关系正确
record.outsourced_service_products = record.service_products.ids if record.service_products else False
else:
record.outsourced_service_products = False
@api.depends('outsourced_service_products')
def _compute_service_products(self):
for record in self: