1、完成 SF材料材料型号缺陷优化 bug
This commit is contained in:
@@ -61,12 +61,10 @@ class MrsMaterialModel(models.Model):
|
|||||||
supplier_ids = fields.One2many('sf.supplier.sort', 'materials_model_id', string='供应商')
|
supplier_ids = fields.One2many('sf.supplier.sort', 'materials_model_id', string='供应商')
|
||||||
active = fields.Boolean('有效', default=True)
|
active = fields.Boolean('有效', default=True)
|
||||||
|
|
||||||
@api.onchange('gain_way')
|
@api.constrains("gain_way")
|
||||||
def _check_gain_way(self):
|
def _check_supplier_ids(self):
|
||||||
if not self.gain_way:
|
for item in self:
|
||||||
raise UserError("请选择获取方式")
|
if item.gain_way in ('外协', '采购') and not item.supplier_ids:
|
||||||
if self.gain_way in ['外协', '采购']:
|
|
||||||
if not self.supplier_ids:
|
|
||||||
raise UserError("请添加供应商")
|
raise UserError("请添加供应商")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -251,7 +251,7 @@
|
|||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="materials_no" readonly="1" force_save="1"/>
|
<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="tensile_strength" required="1"/>
|
||||||
<field name="hardness" required="1"/>
|
<field name="hardness" required="1"/>
|
||||||
<field name="density" readonly="1"/>
|
<field name="density" readonly="1"/>
|
||||||
@@ -270,9 +270,9 @@
|
|||||||
<notebook>
|
<notebook>
|
||||||
<page string="供应商">
|
<page string="供应商">
|
||||||
<field name='supplier_ids' class="supplier_ids_set_css">
|
<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="sequence" widget="handle" string="序号"/>
|
||||||
<field name="partner_id" string="名称"/>
|
<field name="partner_id" string="名称" options="{'no_create': True}"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
|
|||||||
@@ -256,33 +256,33 @@ class ResPartnerToSale(models.Model):
|
|||||||
# if obj:
|
# if obj:
|
||||||
# raise UserError('该邮箱已存在,请重新输入')
|
# raise UserError('该邮箱已存在,请重新输入')
|
||||||
|
|
||||||
@api.model
|
# @api.model
|
||||||
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
|
# def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||||
if self._context.get('is_customer'):
|
# if self._context.get('is_customer'):
|
||||||
if self.env.user.has_group('sf_base.group_sale_director'):
|
# if self.env.user.has_group('sf_base.group_sale_director'):
|
||||||
domain = [('customer_rank', '>', 0)]
|
# domain = [('customer_rank', '>', 0)]
|
||||||
elif self.env.user.has_group('sf_base.group_sale_salemanager'):
|
# elif self.env.user.has_group('sf_base.group_sale_salemanager'):
|
||||||
customer = self.env['res.partner'].search(
|
# customer = self.env['res.partner'].search(
|
||||||
[('customer_rank', '>', 0), ('user_id', '=', self.env.user.id)])
|
# [('customer_rank', '>', 0), ('user_id', '=', self.env.user.id)])
|
||||||
if customer:
|
# if customer:
|
||||||
ids = [t.id for t in customer]
|
# ids = [t.id for t in customer]
|
||||||
domain = [('id', 'in', ids)]
|
# domain = [('id', 'in', ids)]
|
||||||
else:
|
# else:
|
||||||
domain = [('id', '=', False)]
|
# domain = [('id', '=', False)]
|
||||||
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
# return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
||||||
elif self._context.get('is_supplier') or self.env.user.has_group('sf_base.group_purchase_director'):
|
# elif self._context.get('is_supplier') or self.env.user.has_group('sf_base.group_purchase_director'):
|
||||||
if self.env.user.has_group('sf_base.group_purchase_director'):
|
# if self.env.user.has_group('sf_base.group_purchase_director'):
|
||||||
domain = [('supplier_rank', '>', 0)]
|
# domain = [('supplier_rank', '>', 0)]
|
||||||
elif self.env.user.has_group('sf_base.group_purchase'):
|
# elif self.env.user.has_group('sf_base.group_purchase'):
|
||||||
supplier = self.env['res.partner'].search(
|
# supplier = self.env['res.partner'].search(
|
||||||
[('supplier_rank', '>', 0), ('purchase_user_id', '=', self.env.user.id)])
|
# [('supplier_rank', '>', 0), ('purchase_user_id', '=', self.env.user.id)])
|
||||||
if supplier:
|
# if supplier:
|
||||||
ids = [t.id for t in supplier]
|
# ids = [t.id for t in supplier]
|
||||||
domain = [('id', 'in', ids)]
|
# domain = [('id', 'in', ids)]
|
||||||
else:
|
# else:
|
||||||
domain = [('id', '=', False)]
|
# domain = [('id', '=', False)]
|
||||||
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
# return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
||||||
return super()._name_search(name, args, operator, limit, name_get_uid)
|
# return super()._name_search(name, args, operator, limit, name_get_uid)
|
||||||
|
|
||||||
@api.onchange('user_id')
|
@api.onchange('user_id')
|
||||||
def _get_salesman(self):
|
def _get_salesman(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user