sf 材料型号页面修改字段信息
This commit is contained in:
@@ -57,15 +57,24 @@ class MrsMaterialModel(models.Model):
|
||||
remark = fields.Text("备注")
|
||||
gain_way = fields.Selection(
|
||||
[("自加工", "自加工"), ("外协", "委外加工"), ("采购", "采购")],
|
||||
default="", string="获取方式")
|
||||
default="采购", string="获取方式")
|
||||
supplier_ids = fields.One2many('sf.supplier.sort', 'materials_model_id', string='供应商')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
@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("请添加供应商")
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
res = super(MrsMaterialModel, self).create(vals)
|
||||
if not vals.get('supplier_ids'):
|
||||
supplier_id = self.env['res.partner'].search([('name', '=', '湖南傲派自动化设备有限公司')], limit=1)
|
||||
res.supplier_ids = [(0, 0, {'materials_model_id': res.id, 'partner_id': supplier_id.id or False})]
|
||||
return res
|
||||
else:
|
||||
return res
|
||||
# @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("请添加供应商")
|
||||
|
||||
|
||||
class MrsProductionProcessCategory(models.Model):
|
||||
|
||||
@@ -262,13 +262,13 @@
|
||||
<group>
|
||||
<field name="materials_no" readonly="1" force_save="1"/>
|
||||
<field name="gain_way" required="0"/>
|
||||
<field name="tensile_strength" required="1"/>
|
||||
<field name="hardness" required="1"/>
|
||||
<field name="density" readonly="1"/>
|
||||
<field name="density" readonly="1" required="1" class="custom_required"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="rough_machining" required="1"/>
|
||||
<field name="finish_machining" required="1"/>
|
||||
<field name="tensile_strength" required="1"/>
|
||||
<field name="hardness" required="1"/>
|
||||
<field name="need_h" default="false" readonly="1"/>
|
||||
<field name="mf_materia_post" attrs="{'invisible':[('need_h','=',False)]} "
|
||||
readonly="1"/>
|
||||
@@ -297,7 +297,7 @@
|
||||
<record model="ir.ui.view" id="sf_materials_model_tree">
|
||||
<field name="model">sf.materials.model</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="材料型号" delete="0">
|
||||
<tree string="材料型号" delete="0" create="0">
|
||||
<field name="materials_no"/>
|
||||
<field name="materials_code"/>
|
||||
<field name="name"/>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of SmartGo. See LICENSE file for full copyright and licensing details.
|
||||
import logging
|
||||
import traceback
|
||||
|
||||
import requests
|
||||
|
||||
@@ -90,7 +91,8 @@ class ResConfigSettings(models.TransientModel):
|
||||
_logger.info("同步坯料冗余完成")
|
||||
|
||||
except Exception as e:
|
||||
_logger.info("sf_all_sync error: %s" % e)
|
||||
traceback_error = traceback.format_exc()
|
||||
_logger.error("sf_all_sync error:%s" % traceback_error)
|
||||
raise ValidationError("数据错误导致同步失败,请联系管理员")
|
||||
|
||||
@api.model
|
||||
|
||||
Reference in New Issue
Block a user