sf-工序-手动创建工艺可选参数及产品问题
This commit is contained in:
@@ -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',inverse='_inverse_service_products',
|
string='外协服务产品',compute='_compute_service_products',
|
||||||
store=True
|
store=True
|
||||||
)
|
)
|
||||||
outsourced_service_products = fields.One2many(
|
outsourced_service_products = fields.One2many(
|
||||||
@@ -25,15 +25,8 @@ class SfProductionProcessParameter(models.Model):
|
|||||||
def _compute_service_products(self):
|
def _compute_service_products(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
# 假设取第一条作为主明细
|
# 假设取第一条作为主明细
|
||||||
record.service_products = record.outsourced_service_products.ids if record.outsourced_service_products else False
|
record.service_products = record.outsourced_service_products[0].id if record.outsourced_service_products else False
|
||||||
|
|
||||||
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
|
|
||||||
def name_get(self):
|
def name_get(self):
|
||||||
result = []
|
result = []
|
||||||
for record in self:
|
for record in self:
|
||||||
|
|||||||
Reference in New Issue
Block a user