Merge branch 'feature/优化坯料和修复质量标准' into develop
This commit is contained in:
@@ -61,7 +61,7 @@ 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.constrains('supplier_ids')
|
@api.onchange('gain_way')
|
||||||
def _check_gain_way(self):
|
def _check_gain_way(self):
|
||||||
if not self.gain_way:
|
if not self.gain_way:
|
||||||
raise UserError("请选择获取方式")
|
raise UserError("请选择获取方式")
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class Sf_Bf_Connect(http.Controller):
|
|||||||
request.env.ref("base.user_admin")).bom_create_line(
|
request.env.ref("base.user_admin")).bom_create_line(
|
||||||
self_machining_embryo)
|
self_machining_embryo)
|
||||||
if not self_machining_bom_line:
|
if not self_machining_bom_line:
|
||||||
res['status'] = 2
|
res['status'] = -2
|
||||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
||||||
request.cr.rollback()
|
request.cr.rollback()
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
@@ -79,6 +79,11 @@ class Sf_Bf_Connect(http.Controller):
|
|||||||
order_id,
|
order_id,
|
||||||
'subcontract',
|
'subcontract',
|
||||||
i)
|
i)
|
||||||
|
if outsource_embryo == -3:
|
||||||
|
res['status'] = -3
|
||||||
|
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未设置获取方式和供应商,请先配置再进行分配'
|
||||||
|
request.cr.rollback()
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
# 创建坯料的bom
|
# 创建坯料的bom
|
||||||
outsource_bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create(
|
outsource_bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create(
|
||||||
outsource_embryo,
|
outsource_embryo,
|
||||||
@@ -87,7 +92,7 @@ class Sf_Bf_Connect(http.Controller):
|
|||||||
outsource_bom_line = outsource_bom.with_user(
|
outsource_bom_line = outsource_bom.with_user(
|
||||||
request.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
|
request.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
|
||||||
if not outsource_bom_line:
|
if not outsource_bom_line:
|
||||||
res['status'] = 2
|
res['status'] = -2
|
||||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
||||||
request.cr.rollback()
|
request.cr.rollback()
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
@@ -101,6 +106,11 @@ class Sf_Bf_Connect(http.Controller):
|
|||||||
item,
|
item,
|
||||||
order_id,
|
order_id,
|
||||||
'purchase', i)
|
'purchase', i)
|
||||||
|
if purchase_embryo == -3:
|
||||||
|
res['status'] = -3
|
||||||
|
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未设置获取方式和供应商,请先配置再进行分配'
|
||||||
|
request.cr.rollback()
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
# 产品配置bom
|
# 产品配置bom
|
||||||
product_bom_purchase = request.env['mrp.bom'].with_user(
|
product_bom_purchase = request.env['mrp.bom'].with_user(
|
||||||
request.env.ref("base.user_admin")).bom_create(product, 'normal', False)
|
request.env.ref("base.user_admin")).bom_create(product, 'normal', False)
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class ResMrpBomMo(models.Model):
|
|||||||
if rate_of_waste <= 20:
|
if rate_of_waste <= 20:
|
||||||
return embryo_has
|
return embryo_has
|
||||||
else:
|
else:
|
||||||
return
|
return None
|
||||||
|
|
||||||
# 查bom的原材料
|
# 查bom的原材料
|
||||||
def get_raw_bom(self, product):
|
def get_raw_bom(self, product):
|
||||||
|
|||||||
@@ -678,11 +678,14 @@ class ResProductMo(models.Model):
|
|||||||
# 外协和采购生成的坯料需要根据材料型号绑定供应商
|
# 外协和采购生成的坯料需要根据材料型号绑定供应商
|
||||||
if route_type == 'subcontract' or route_type == 'purchase':
|
if route_type == 'subcontract' or route_type == 'purchase':
|
||||||
no_bom_copy_product_id.purchase_ok = True
|
no_bom_copy_product_id.purchase_ok = True
|
||||||
no_bom_copy_product_id.seller_ids = [
|
if supplier:
|
||||||
(0, 0, {'partner_id': supplier.partner_id.id, 'delay': 1.0})]
|
no_bom_copy_product_id.seller_ids = [
|
||||||
if route_type == 'subcontract':
|
(0, 0, {'partner_id': supplier.partner_id.id, 'delay': 1.0})]
|
||||||
partner = self.env['res.partner'].search([('id', '=', supplier.partner_id.id)])
|
if route_type == 'subcontract':
|
||||||
partner.is_subcontractor = True
|
partner = self.env['res.partner'].search([('id', '=', supplier.partner_id.id)])
|
||||||
|
partner.is_subcontractor = True
|
||||||
|
else:
|
||||||
|
return -3
|
||||||
no_bom_copy_product_id.write(vals)
|
no_bom_copy_product_id.write(vals)
|
||||||
return no_bom_copy_product_id
|
return no_bom_copy_product_id
|
||||||
|
|
||||||
|
|||||||
@@ -11,26 +11,3 @@ class SfQualityPoint(models.Model):
|
|||||||
"('product', 'consu')), '|', ('company_id', '=', False), ('company_id', '=', company_id)]", help=
|
"('product', 'consu')), '|', ('company_id', '=', False), ('company_id', '=', company_id)]", help=
|
||||||
"Quality Point will apply to every selected Products.")
|
"Quality Point will apply to every selected Products.")
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
# 审核
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
# picking_type_ids = fields.Many2many(
|
|
||||||
# 'stock.picking.type', string='执行节点', required=True, check_company=True)
|
|
||||||
|
|
||||||
|
|
||||||
class ResQualityAlertTeam(models.Model):
|
|
||||||
_inherit = 'quality.alert.team'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
# 审核
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|||||||
@@ -39,13 +39,6 @@
|
|||||||
<field name="model">quality.point</field>
|
<field name="model">quality.point</field>
|
||||||
<field name="inherit_id" ref="quality.quality_point_view_form"/>
|
<field name="inherit_id" ref="quality.quality_point_view_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//header" position="inside">
|
|
||||||
<field name="check_state" invisible="1"/>
|
|
||||||
<button name="action_check" string="审核" type="object"
|
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
|
||||||
groups="sf_base.group_quality_director"
|
|
||||||
class="oe_highlight"/>
|
|
||||||
</xpath>
|
|
||||||
<!-- <xpath expr="//sheet//group//group//field[@name='title']" position="replace"> -->
|
<!-- <xpath expr="//sheet//group//group//field[@name='title']" position="replace"> -->
|
||||||
<!-- <field name="title" class="custom_required" required="1"/> -->
|
<!-- <field name="title" class="custom_required" required="1"/> -->
|
||||||
<!-- </xpath> -->
|
<!-- </xpath> -->
|
||||||
@@ -67,26 +60,10 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='measure_on']" position="attributes">
|
<xpath expr="//field[@name='measure_on']" position="attributes">
|
||||||
<attribute name="class">custom_required</attribute>
|
<attribute name="class">custom_required</attribute>
|
||||||
|
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='measure_frequency_type']" position="attributes">
|
<xpath expr="//field[@name='measure_frequency_type']" position="attributes">
|
||||||
<attribute name="class">custom_required</attribute>
|
<attribute name="class">custom_required</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.ui.view" id="quality_alert_team_view_form_inherit_sf">
|
|
||||||
<field name="name">quality.alert.team.form.inherit.sf</field>
|
|
||||||
<field name="model">quality.alert.team</field>
|
|
||||||
<field name="inherit_id" ref="quality_control.quality_alert_team_view_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//header" position="inside">
|
|
||||||
<field name="check_state" invisible="1"/>
|
|
||||||
<button name="action_check" string="审核" type="object"
|
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
|
||||||
groups="sf_base.group_quality_director"
|
|
||||||
class="oe_highlight"/>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user