增加坯料冗余量

This commit is contained in:
胡尧
2024-11-18 15:00:05 +08:00
parent 73aa4af118
commit 08a682143f
8 changed files with 40 additions and 21 deletions

View File

@@ -34,6 +34,9 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
if kw.get('logistics_way'):
order_id.logistics_way = kw['logistics_way']
for item in bfm_process_order_list:
if item.get('embryo_redundancy_id'):
item['embryo_redundancy'] = request.env['sf.embryo.redundancy'].sudo().search([('code', '=', item['embryo_redundancy_id'])], limit=1)
item['embryo_redundancy_id'] = item['embryo_redundancy'].id
product = request.env['product.template'].sudo().product_create(product_id, item, order_id,
kw['order_number'], i)
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)

View File

@@ -8,7 +8,7 @@ class ProductTemplate(models.Model):
def product_create(self, product_id, item, order_id, order_number, i):
product_id = super(ProductTemplate, self).product_create(product_id, item, order_id, order_number, i)
product_id.product_tmpl_id.is_customer_provided = item['is_incoming_material']
product_id.product_tmpl_id.is_customer_provided = True if item['embryo_redundancy_id'] else False
return product_id

View File

@@ -54,6 +54,7 @@ class SaleOrder(models.Model):
'model_width': product.width,
'model_height': product.height,
'price': product.list_price,
'embryo_redundancy_id': line.embryo_redundancy_id,
}
# 获取成品名结尾-n的n
product_seria = int(product.name.split('-')[-1])
@@ -66,7 +67,7 @@ class SaleOrder(models.Model):
bom.with_user(self.env.ref("base.user_admin")).bom_create_line_has(bom_data)
else:
# 当成品上带有客供料选项时,生成坯料时选择“客供料”路线
if line.is_incoming_material:
if line.embryo_redundancy_id:
# 将成品模板的内容复制到成品上
customer_provided_embryo = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_embryo_customer_provided').sudo()
# 创建坯料客供料的批量不需要创建bom

View File

@@ -59,6 +59,7 @@
<record id="sale.action_quotations_with_onboarding" model="ir.actions.act_window">
<field name="search_view_id" ref="jikimo_sale_order_view_search_inherit_quotation_supply_method"/>
<field name="context">{'search_default_draft': 1}</field>
</record>
<record id="action_quotations_supply_method" model="ir.actions.act_window">