优化制造订单列表
This commit is contained in:
@@ -815,17 +815,17 @@ class MrpProduction(models.Model):
|
||||
def do_update_program(self):
|
||||
program_production = self
|
||||
if len(program_production) >= 1:
|
||||
same_product_id = None
|
||||
is_not_same_product = 0
|
||||
# same_product_id = None
|
||||
# is_not_same_product = 0
|
||||
for item in program_production:
|
||||
if same_product_id is None:
|
||||
same_product_id = item.product_id
|
||||
if item.product_id != same_product_id:
|
||||
is_not_same_product += 1
|
||||
# if same_product_id is None:
|
||||
# same_product_id = item.product_id
|
||||
# if item.product_id != same_product_id:
|
||||
# is_not_same_product += 1
|
||||
if item.state != "rework" and item.programming_state != "已编程未下发":
|
||||
raise UserError("请选择状态为返工且已编程未下发的制造订单")
|
||||
if is_not_same_product >= 1:
|
||||
raise UserError("您选择的记录中含有其他产品的制造订单,请选择同一产品的制造订单")
|
||||
# if is_not_same_product >= 1:
|
||||
# raise UserError("您选择的记录中含有其他产品的制造订单,请选择同一产品的制造订单")
|
||||
grouped_program_ids = {k: list(g) for k, g in groupby(program_production, key=lambda x: x.programming_no)}
|
||||
program_to_production_names = {}
|
||||
for programming_no, program_production in grouped_program_ids.items():
|
||||
|
||||
Reference in New Issue
Block a user