Accept Merge Request #2115: (feature/tool_standard_library_process -> develop)

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

Created By: @廖丹龙
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2115?initial=true
This commit is contained in:
廖丹龙
2025-05-14 12:22:10 +08:00
committed by Coding
2 changed files with 9 additions and 3 deletions

View File

@@ -42,7 +42,7 @@
<field name="server_product_process_parameters_id" string="工艺参数" <field name="server_product_process_parameters_id" string="工艺参数"
options="{'no_create': True}" options="{'no_create': True}"
attrs="{'invisible': ['|',('detailed_type', '!=', 'service'),('detailed_type', '=', False)]}" attrs="{'invisible': ['|',('detailed_type', '!=', 'service'),('detailed_type', '=', False)]}"
domain="[('active', '=', 'True'),('outsourced_service_products', '=', 'False')]" domain="[('active', '=', 'True'),('outsourced_service_products', '!=', 'True')]"
/> />
<field name="cutting_tool_material_id" class="custom_required" <field name="cutting_tool_material_id" class="custom_required"
options="{'no_create': True}" options="{'no_create': True}"

View File

@@ -9,7 +9,7 @@ class SfProductionProcessParameter(models.Model):
_inherit = 'sf.production.process.parameter' _inherit = 'sf.production.process.parameter'
service_products = fields.Many2one( service_products = fields.Many2one(
'product.template', 'product.template',
string='外协服务产品',compute='_compute_service_products', string='外协服务产品',compute='_compute_service_products',inverse='_inverse_service_products',
store=True store=True
) )
outsourced_service_products = fields.One2many( 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_product_button = fields.Boolean(compute='_compute_is_product_button',default=False)
is_delete_button = fields.Boolean(compute='_compute_is_delete_button', default=False) is_delete_button = fields.Boolean(compute='_compute_is_delete_button', default=False)
routing_id = fields.Many2one('mrp.routing.workcenter', string="工序") 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') @api.depends('outsourced_service_products')
def _compute_service_products(self): def _compute_service_products(self):
for record in self: for record in self: