Accept Merge Request #1892: (feature/tool_standard_library_process -> develop)
Merge Request: sf 材料型号页面修改字段信息 Created By: @廖丹龙 Reviewed By: @胡尧 Approved By: @胡尧 Accepted By: @胡尧 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1892#mr-1892-review-228565
This commit is contained in:
@@ -57,15 +57,24 @@ class MrsMaterialModel(models.Model):
|
|||||||
remark = fields.Text("备注")
|
remark = fields.Text("备注")
|
||||||
gain_way = fields.Selection(
|
gain_way = fields.Selection(
|
||||||
[("自加工", "自加工"), ("外协", "委外加工"), ("采购", "采购")],
|
[("自加工", "自加工"), ("外协", "委外加工"), ("采购", "采购")],
|
||||||
default="", string="获取方式")
|
default="采购", string="获取方式")
|
||||||
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.constrains("gain_way")
|
@api.model
|
||||||
def _check_supplier_ids(self):
|
def create(self, vals):
|
||||||
for item in self:
|
res = super(MrsMaterialModel, self).create(vals)
|
||||||
if item.gain_way in ('外协', '采购') and not item.supplier_ids:
|
if not vals.get('supplier_ids'):
|
||||||
raise UserError("请添加供应商")
|
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):
|
class MrsProductionProcessCategory(models.Model):
|
||||||
|
|||||||
@@ -262,13 +262,13 @@
|
|||||||
<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="0"/>
|
<field name="gain_way" required="0"/>
|
||||||
<field name="tensile_strength" required="1"/>
|
<field name="density" readonly="1" required="1" class="custom_required"/>
|
||||||
<field name="hardness" required="1"/>
|
|
||||||
<field name="density" readonly="1"/>
|
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="rough_machining" required="1"/>
|
<field name="rough_machining" required="1"/>
|
||||||
<field name="finish_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="need_h" default="false" readonly="1"/>
|
||||||
<field name="mf_materia_post" attrs="{'invisible':[('need_h','=',False)]} "
|
<field name="mf_materia_post" attrs="{'invisible':[('need_h','=',False)]} "
|
||||||
readonly="1"/>
|
readonly="1"/>
|
||||||
@@ -297,7 +297,7 @@
|
|||||||
<record model="ir.ui.view" id="sf_materials_model_tree">
|
<record model="ir.ui.view" id="sf_materials_model_tree">
|
||||||
<field name="model">sf.materials.model</field>
|
<field name="model">sf.materials.model</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="材料型号" delete="0">
|
<tree string="材料型号" delete="0" create="0">
|
||||||
<field name="materials_no"/>
|
<field name="materials_no"/>
|
||||||
<field name="materials_code"/>
|
<field name="materials_code"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Part of SmartGo. See LICENSE file for full copyright and licensing details.
|
# Part of SmartGo. See LICENSE file for full copyright and licensing details.
|
||||||
import logging
|
import logging
|
||||||
|
import traceback
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
@@ -90,7 +91,8 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
_logger.info("同步坯料冗余完成")
|
_logger.info("同步坯料冗余完成")
|
||||||
|
|
||||||
except Exception as e:
|
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("数据错误导致同步失败,请联系管理员")
|
raise ValidationError("数据错误导致同步失败,请联系管理员")
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
|||||||
Reference in New Issue
Block a user