1、完成 SF材料材料型号缺陷优化 bug

This commit is contained in:
yuxianghui
2024-07-05 17:09:32 +08:00
parent d60fefb2ec
commit 1672a3982e
3 changed files with 34 additions and 36 deletions

View File

@@ -61,12 +61,10 @@ class MrsMaterialModel(models.Model):
supplier_ids = fields.One2many('sf.supplier.sort', 'materials_model_id', string='供应商')
active = fields.Boolean('有效', default=True)
@api.onchange('gain_way')
def _check_gain_way(self):
if not self.gain_way:
raise UserError("请选择获取方式")
if self.gain_way in ['外协', '采购']:
if not self.supplier_ids:
@api.constrains("gain_way")
def _check_supplier_ids(self):
for item in self:
if item.gain_way in ('外协', '采购') and not item.supplier_ids:
raise UserError("请添加供应商")

View File

@@ -251,7 +251,7 @@
<group>
<group>
<field name="materials_no" readonly="1" force_save="1"/>
<field name="gain_way" required="1"/>
<field name="gain_way" required="0"/>
<field name="tensile_strength" required="1"/>
<field name="hardness" required="1"/>
<field name="density" readonly="1"/>
@@ -270,9 +270,9 @@
<notebook>
<page string="供应商">
<field name='supplier_ids' class="supplier_ids_set_css">
<tree editable='bottom'>
<tree editable='bottom' delete="1">
<field name="sequence" widget="handle" string="序号"/>
<field name="partner_id" string="名称"/>
<field name="partner_id" string="名称" options="{'no_create': True}"/>
</tree>
</field>
</page>