修复 工艺外协工序采购单已创建账单并且过账,退回调整删除后报错的问题
This commit is contained in:
@@ -440,6 +440,18 @@ class MrpProduction(models.Model):
|
||||
process_parameters = []
|
||||
account_moves = []
|
||||
parameters_not = []
|
||||
# 获取原有的工单对应的工序
|
||||
origin_designs = self.workorder_ids.technology_design_id
|
||||
# 获取已删除的工序
|
||||
deleted_designs = origin_designs - self.technology_design_ids
|
||||
if deleted_designs:
|
||||
for deleted_design in deleted_designs:
|
||||
workorder = self.env['mrp.workorder'].search([('technology_design_id', '=', deleted_design.id)])
|
||||
purchase = workorder._get_surface_technics_purchase_ids()
|
||||
account = self.env['account.move'].search([('id', 'in', purchase.invoice_ids.ids)])
|
||||
if account.state not in ['cancel', False]:
|
||||
if purchase.name not in account_moves:
|
||||
account_moves.append(purchase.name)
|
||||
special_design = self.technology_design_ids.filtered(
|
||||
lambda a: a.routing_tag == 'special' and a.is_auto is False)
|
||||
for special in special_design:
|
||||
@@ -451,11 +463,7 @@ class MrpProduction(models.Model):
|
||||
if not product_production_process:
|
||||
if special.process_parameters_id not in process_parameters:
|
||||
process_parameters.append(special.process_parameters_id.display_name)
|
||||
purchase = self.env['purchase.order'].search([('origin', '=', special.production_id.name)])
|
||||
account = self.env['account.move'].search([('id', 'in', purchase.invoice_ids)])
|
||||
if account.state not in ['cancel', False]:
|
||||
if purchase.name not in account_moves:
|
||||
account_moves.append(purchase.name)
|
||||
|
||||
if account_moves:
|
||||
raise UserError(_("请联系工厂生产经理对采购订单为%s生成的账单进行取消", ", ".join(account_moves)))
|
||||
if parameters_not:
|
||||
|
||||
Reference in New Issue
Block a user