15 lines
593 B
Python
15 lines
593 B
Python
from odoo import models, fields
|
|
|
|
class MrpBom(models.Model):
|
|
_inherit = 'mrp.bom'
|
|
|
|
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品后再次进行创建bom
|
|
def bom_create(self, product, bom_type, product_type):
|
|
bom_id = super(MrpBom, self).bom_create(product, bom_type, product_type)
|
|
|
|
# 成品的供应商从模板中获取
|
|
if product_type == 'product':
|
|
if product.product_tmpl_id.seller_ids:
|
|
bom_id.subcontractor_id = product.product_tmpl_id.seller_ids[-1].partner_id.id
|
|
return bom_id
|