修改人工线下加工状态的继承位置

This commit is contained in:
胡尧
2024-11-15 15:03:06 +08:00
parent f6f9d14f0a
commit 9d723c5e00
5 changed files with 338 additions and 339 deletions

View File

@@ -12,7 +12,7 @@
'data/stock_routes.xml',
'data/product_data.xml',
'views/sale_order_views.xml',
# 'views/product_product_views.xml',
'views/product_product_views.xml',
],'assets': {
# 'web.assets_backend': [
# 'jikimo_sale_multiple_supply_methods/static/src/**/*'

View File

@@ -55,6 +55,8 @@ class SaleOrder(models.Model):
'model_height': product.height,
'price': product.list_price,
}
# 获取成品名结尾-n的n
product_seria = int(product.name.split('-')[-1])
# 成品供货方式为采购则不生成bom
if line.supply_method != 'purchase':
bom_data = self.env['mrp.bom'].with_user(self.env.ref("base.user_admin")).get_bom(product)
@@ -71,7 +73,7 @@ class SaleOrder(models.Model):
material_customer_provided_embryo = self.env['product.template'].sudo().no_bom_product_create(
customer_provided_embryo.with_context(active_test=False).product_variant_id,
item,
order_id, 'material_customer_provided', 0, product)
order_id, 'material_customer_provided', product_seria, product)
# 成品配置bom
product_bom_material_customer_provided = self.env['mrp.bom'].with_user(
self.env.ref("base.user_admin")).bom_create(
@@ -84,7 +86,7 @@ class SaleOrder(models.Model):
self_machining_embryo = self.env['product.template'].sudo().no_bom_product_create(
self_machining_id,
item,
order_id, 'self_machining', 0, product)
order_id, 'self_machining', product_seria, product)
# 创建坯料的bom
self_machining_bom = self.env['mrp.bom'].with_user(
self.env.ref("base.user_admin")).bom_create(
@@ -108,7 +110,7 @@ class SaleOrder(models.Model):
item,
order_id,
'subcontract',
0, product)
product_seria, product)
if outsource_embryo == -3:
raise UserError('该订单模型的材料型号暂未设置获取方式和供应商,请先配置再进行分配')
# 创建坯料的bom
@@ -130,7 +132,7 @@ class SaleOrder(models.Model):
purchase_embryo = self.env['product.template'].sudo().no_bom_product_create(purchase_id,
item,
order_id,
'purchase', 0,
'purchase', product_seria,
product)
if purchase_embryo == -3:
raise UserError('该订单模型的材料型号暂未设置获取方式和供应商,请先配置再进行分配')

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- 由于该模块不能依赖sf_dlm_management, 该功能只能在sf_dlm_management中实现并且依赖该模块-->
<record id="view_product_product_form_inherit_sf" model="ir.ui.view">
<record id="product_template_only_form_view" model="ir.ui.view">
<field name="name">view.product.template.form.inherit.sf</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="sf_dlm_management.view_sale_product_template_form_inherit_sf"/>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='manual_quotation']" position="after">
<field name="is_customer_provided" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])], 'readonly': True}" />
<xpath expr="//field[@name='uom_id']" position="before">
<field name="categ_type" invisible="1"/>
<field name="is_manual_processing" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])], 'readonly': True}" />
</xpath>
</field>
</record>