客供料与非客供料分开合并
This commit is contained in:
@@ -1526,8 +1526,7 @@ class MrpProduction(models.Model):
|
||||
重载创建制造订单的方法,单个制造订单,同一成品只创建一个采购组,用于后续单据的创建
|
||||
"""
|
||||
product_group_id = {}
|
||||
group_id = False
|
||||
is_first = False
|
||||
is_custemer_group_id = {} # 客供料与非客供料
|
||||
for vals in vals_list:
|
||||
if not vals.get('name', False) or vals['name'] == _('New'):
|
||||
picking_type_id = vals.get('picking_type_id')
|
||||
@@ -1537,15 +1536,16 @@ class MrpProduction(models.Model):
|
||||
vals['name'] = self.env['stock.picking.type'].browse(picking_type_id).sequence_id.next_by_id()
|
||||
product_id = self.env['product.product'].browse(vals['product_id'])
|
||||
is_self_process = product_id.materials_type_id and product_id.materials_type_id.gain_way and product_id.materials_type_id.gain_way != '自加工'
|
||||
if not is_first and is_self_process:
|
||||
is_first = True
|
||||
group_id = self.env["procurement.group"].create({'name': vals.get('name')}).id
|
||||
is_customer_provided = product_id.is_customer_provided
|
||||
if not is_custemer_group_id.get(is_customer_provided):
|
||||
is_custemer_group_id[is_customer_provided] = self.env["procurement.group"].create({'name': vals.get('name')}).id
|
||||
# if not (is_first_customer or is_first_not_customer) and is_self_process:
|
||||
# is_first = True
|
||||
# group_id = self.env["procurement.group"].create({'name': vals.get('name')}).id
|
||||
if not vals.get('procurement_group_id'):
|
||||
if product_id.product_tmpl_id.single_manufacturing:
|
||||
|
||||
if product_id.categ_id.name == '成品' and is_self_process:
|
||||
|
||||
vals['procurement_group_id'] = group_id
|
||||
vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided]
|
||||
continue
|
||||
if product_id.id not in product_group_id.keys():
|
||||
procurement_group_vals = self._prepare_procurement_group_vals(vals)
|
||||
@@ -1555,7 +1555,7 @@ class MrpProduction(models.Model):
|
||||
else:
|
||||
vals['procurement_group_id'] = product_group_id[product_id.id]
|
||||
else:
|
||||
vals['procurement_group_id'] = group_id
|
||||
vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided]
|
||||
return super(MrpProduction, self).create(vals_list)
|
||||
|
||||
@api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id',
|
||||
|
||||
Reference in New Issue
Block a user