修复表面工艺工单完成时对应库存(stock.move)的状态为完成并跳过标记完成方法的检查

This commit is contained in:
jinling.yang
2024-05-18 19:52:58 +08:00
parent 1bcd1f2e33
commit f9cca591bb
3 changed files with 9 additions and 5 deletions

View File

@@ -500,7 +500,8 @@ class MrpProduction(models.Model):
# 修改标记已完成方法
def button_mark_done1(self):
self._button_mark_done_sanity_checks()
if not self.workorder_ids.filtered(lambda w: w.routing_type not in ['表面工艺']):
self._button_mark_done_sanity_checks()
if not self.env.context.get('button_mark_done_production_ids'):
self = self.with_context(button_mark_done_production_ids=self.ids)

View File

@@ -907,6 +907,12 @@ class ResMrpWorkOrder(models.Model):
move_raw_id.quantity_done = move_raw_id.product_uom_qty
record.process_state = '已完工'
record.production_id.process_state = '已完工'
if record.routing_type in ['表面工艺']:
raw_move = self.env['stock.move'].sudo().search(
[('origin', '=', record.production_id.name), ('procure_method', '=', 'make_to_order'),
('state', '!=', 'done')])
if raw_move:
raw_move.write({'state': 'done'})
record.production_id.button_mark_done1()
# self.production_id.state = 'done'