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='供应商')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
@api.constrains('supplier_ids')
|
||||
@api.onchange('gain_way')
|
||||
def _check_gain_way(self):
|
||||
if not self.gain_way:
|
||||
raise UserError("请选择获取方式")
|
||||
|
||||
@@ -62,7 +62,7 @@ class Sf_Bf_Connect(http.Controller):
|
||||
request.env.ref("base.user_admin")).bom_create_line(
|
||||
self_machining_embryo)
|
||||
if not self_machining_bom_line:
|
||||
res['status'] = 2
|
||||
res['status'] = -2
|
||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
||||
request.cr.rollback()
|
||||
return json.JSONEncoder().encode(res)
|
||||
@@ -79,6 +79,11 @@ class Sf_Bf_Connect(http.Controller):
|
||||
order_id,
|
||||
'subcontract',
|
||||
i)
|
||||
if outsource_embryo == -3:
|
||||
res['status'] = -3
|
||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未设置获取方式和供应商,请先配置再进行分配'
|
||||
request.cr.rollback()
|
||||
return json.JSONEncoder().encode(res)
|
||||
# 创建坯料的bom
|
||||
outsource_bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create(
|
||||
outsource_embryo,
|
||||
@@ -87,7 +92,7 @@ class Sf_Bf_Connect(http.Controller):
|
||||
outsource_bom_line = outsource_bom.with_user(
|
||||
request.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
|
||||
if not outsource_bom_line:
|
||||
res['status'] = 2
|
||||
res['status'] = -2
|
||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
||||
request.cr.rollback()
|
||||
return json.JSONEncoder().encode(res)
|
||||
@@ -101,6 +106,11 @@ class Sf_Bf_Connect(http.Controller):
|
||||
item,
|
||||
order_id,
|
||||
'purchase', i)
|
||||
if purchase_embryo == -3:
|
||||
res['status'] = -3
|
||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未设置获取方式和供应商,请先配置再进行分配'
|
||||
request.cr.rollback()
|
||||
return json.JSONEncoder().encode(res)
|
||||
# 产品配置bom
|
||||
product_bom_purchase = request.env['mrp.bom'].with_user(
|
||||
request.env.ref("base.user_admin")).bom_create(product, 'normal', False)
|
||||
|
||||
@@ -100,7 +100,7 @@ class ResMrpBomMo(models.Model):
|
||||
if rate_of_waste <= 20:
|
||||
return embryo_has
|
||||
else:
|
||||
return
|
||||
return None
|
||||
|
||||
# 查bom的原材料
|
||||
def get_raw_bom(self, product):
|
||||
|
||||
@@ -678,11 +678,14 @@ class ResProductMo(models.Model):
|
||||
# 外协和采购生成的坯料需要根据材料型号绑定供应商
|
||||
if route_type == 'subcontract' or route_type == 'purchase':
|
||||
no_bom_copy_product_id.purchase_ok = True
|
||||
no_bom_copy_product_id.seller_ids = [
|
||||
(0, 0, {'partner_id': supplier.partner_id.id, 'delay': 1.0})]
|
||||
if route_type == 'subcontract':
|
||||
partner = self.env['res.partner'].search([('id', '=', supplier.partner_id.id)])
|
||||
partner.is_subcontractor = True
|
||||
if supplier:
|
||||
no_bom_copy_product_id.seller_ids = [
|
||||
(0, 0, {'partner_id': supplier.partner_id.id, 'delay': 1.0})]
|
||||
if route_type == 'subcontract':
|
||||
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)
|
||||
return no_bom_copy_product_id
|
||||
|
||||
|
||||
@@ -11,26 +11,3 @@ class SfQualityPoint(models.Model):
|
||||
"('product', 'consu')), '|', ('company_id', '=', False), ('company_id', '=', company_id)]", help=
|
||||
"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="inherit_id" ref="quality.quality_point_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>
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='title']" position="replace"> -->
|
||||
<!-- <field name="title" class="custom_required" required="1"/> -->
|
||||
<!-- </xpath> -->
|
||||
@@ -67,26 +60,10 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='measure_on']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='measure_frequency_type']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user