优化制造订单
This commit is contained in:
@@ -647,9 +647,11 @@ class MrpProduction(models.Model):
|
||||
for i in range(len(sorted_workorders) - 1):
|
||||
if m == 0:
|
||||
is_pick = False
|
||||
logging.info(sorted_workorders[i].sequence)
|
||||
logging.info(sorted_workorders[i + 1].sequence)
|
||||
logging.info(sorted_workorders[i + 1].sequence - 1)
|
||||
if sorted_workorders[i].supplier_id.id == sorted_workorders[i + 1].supplier_id.id and \
|
||||
sorted_workorders[i].is_subcontract == sorted_workorders[i + 1].is_subcontract and \
|
||||
sorted_workorders[i].id == sorted_workorders[i + 1].id - 1:
|
||||
sorted_workorders[i].sequence == sorted_workorders[i + 1].sequence - 1:
|
||||
if sorted_workorders[i] not in consecutive_workorders:
|
||||
consecutive_workorders.append(sorted_workorders[i])
|
||||
consecutive_workorders.append(sorted_workorders[i + 1])
|
||||
@@ -659,7 +661,7 @@ class MrpProduction(models.Model):
|
||||
if m == len(consecutive_workorders) - 1 and m != 0:
|
||||
self.env['stock.picking'].create_outcontract_picking(consecutive_workorders,
|
||||
production)
|
||||
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
|
||||
self.env['purchase.order'].get_purchase_order(consecutive_workorders,
|
||||
production,
|
||||
product_id_to_production_names)
|
||||
if sorted_workorders[i] in consecutive_workorders:
|
||||
@@ -670,13 +672,13 @@ class MrpProduction(models.Model):
|
||||
if is_pick is False:
|
||||
self.env['stock.picking'].create_outcontract_picking(sorted_workorders[i],
|
||||
production)
|
||||
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
|
||||
self.env['purchase.order'].get_purchase_order(sorted_workorders[i],
|
||||
production,
|
||||
product_id_to_production_names)
|
||||
if m == len(consecutive_workorders) - 1 and m != 0:
|
||||
self.env['stock.picking'].create_outcontract_picking(consecutive_workorders,
|
||||
production)
|
||||
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
|
||||
self.env['purchase.order'].get_purchase_order(consecutive_workorders,
|
||||
production,
|
||||
product_id_to_production_names)
|
||||
if sorted_workorders[i] in consecutive_workorders:
|
||||
@@ -685,18 +687,18 @@ class MrpProduction(models.Model):
|
||||
m = 0
|
||||
if m == len(consecutive_workorders) - 1 and m != 0:
|
||||
self.env['stock.picking'].create_outcontract_picking(consecutive_workorders, production)
|
||||
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
|
||||
self.env['purchase.order'].get_purchase_order(consecutive_workorders,
|
||||
production,
|
||||
product_id_to_production_names)
|
||||
if is_pick is False and m == 0:
|
||||
if len(sorted_workorders) == 1:
|
||||
self.env['stock.picking'].create_outcontract_picking(sorted_workorders, production)
|
||||
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
|
||||
self.env['purchase.order'].get_purchase_order(sorted_workorders,
|
||||
production,
|
||||
product_id_to_production_names)
|
||||
else:
|
||||
self.env['stock.picking'].create_outcontract_picking(sorted_workorders[i], production)
|
||||
self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
|
||||
self.env['purchase.order'].get_purchase_order(sorted_workorders[i],
|
||||
production,
|
||||
product_id_to_production_names)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user