客供料合并
This commit is contained in:
@@ -1537,15 +1537,16 @@ class MrpProduction(models.Model):
|
|||||||
product_id = self.env['product.product'].browse(vals['product_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 != '自加工'
|
is_self_process = product_id.materials_type_id and product_id.materials_type_id.gain_way and product_id.materials_type_id.gain_way != '自加工'
|
||||||
is_customer_provided = product_id.is_customer_provided
|
is_customer_provided = product_id.is_customer_provided
|
||||||
if not is_custemer_group_id.get(is_customer_provided) and is_self_process:
|
key = f"{is_self_process}_{is_customer_provided}"
|
||||||
is_custemer_group_id[is_customer_provided] = self.env["procurement.group"].create({'name': vals.get('name')}).id
|
if not is_custemer_group_id.get(key):
|
||||||
|
is_custemer_group_id[key] = self.env["procurement.group"].create({'name': vals.get('name')}).id
|
||||||
# if not (is_first_customer or is_first_not_customer) and is_self_process:
|
# if not (is_first_customer or is_first_not_customer) and is_self_process:
|
||||||
# is_first = True
|
# is_first = True
|
||||||
# group_id = self.env["procurement.group"].create({'name': vals.get('name')}).id
|
# group_id = self.env["procurement.group"].create({'name': vals.get('name')}).id
|
||||||
if not vals.get('procurement_group_id'):
|
if not vals.get('procurement_group_id'):
|
||||||
if product_id.product_tmpl_id.single_manufacturing:
|
if product_id.product_tmpl_id.single_manufacturing:
|
||||||
if product_id.categ_id.name == '成品' and is_self_process:
|
if product_id.categ_id.name == '成品':
|
||||||
vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided]
|
vals['procurement_group_id'] = is_custemer_group_id[key]
|
||||||
continue
|
continue
|
||||||
if product_id.id not in product_group_id.keys():
|
if product_id.id not in product_group_id.keys():
|
||||||
procurement_group_vals = self._prepare_procurement_group_vals(vals)
|
procurement_group_vals = self._prepare_procurement_group_vals(vals)
|
||||||
@@ -1555,7 +1556,7 @@ class MrpProduction(models.Model):
|
|||||||
else:
|
else:
|
||||||
vals['procurement_group_id'] = product_group_id[product_id.id]
|
vals['procurement_group_id'] = product_group_id[product_id.id]
|
||||||
else:
|
else:
|
||||||
vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided]
|
vals['procurement_group_id'] = is_custemer_group_id[key]
|
||||||
return super(MrpProduction, self).create(vals_list)
|
return super(MrpProduction, self).create(vals_list)
|
||||||
|
|
||||||
@api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id',
|
@api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id',
|
||||||
|
|||||||
Reference in New Issue
Block a user