bom组装默认值
This commit is contained in:
@@ -17,6 +17,22 @@ class JikimoBomWizard(models.TransientModel):
|
||||
], string='组装方式', required=True)
|
||||
is_ok = fields.Boolean('确认上述信息正确无误。')
|
||||
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
res = super(JikimoBomWizard, self).default_get(fields)
|
||||
# 根据某个字段的值设置默认选项
|
||||
if 'default_bom_id' in self.env.context:
|
||||
jikimo_bom = self.env['jikimo.bom'].browse(self.env.context['default_bom_id'])
|
||||
if not jikimo_bom:
|
||||
return res
|
||||
|
||||
if jikimo_bom.options:
|
||||
res['assembly_options'] = jikimo_bom.options
|
||||
# some_field_value = self.env.context.get('some_field')
|
||||
# if some_field_value == 'condition_value':
|
||||
# res['default_option'] = 'option2' # 设置为特定选项
|
||||
return res
|
||||
def submit(self):
|
||||
if not self.bom_id:
|
||||
raise UserError('缺少bom信息')
|
||||
|
||||
Reference in New Issue
Block a user