Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3109 Lượt xem

Hello,

When creating a backorder MO to fulfill the remaining quantities to produce, the new MO is created with cancelled operations. Instead, I would like for it to create the new backorder MO without cancelling those operations.

Currently, Odoo cancels all operations prior to the point where the original MO quantity was adjusted (one of the units failed a quality check and so production quantity was changed in the work order tablet view).

Would someone here please help me understand?:

1. Why this might be happening

2. How to fix the issue to create a backorder MO without cancelled operations.

Thanks!

Ảnh đại diện
Huỷ bỏ

I also have this issue, have you found solution or workaround?

Câu trả lời hay nhất

Hi,

Odoo's default behavior is to abort the operations when a backorder MO is created. Odoo considers that the operations from the original MO cannot be completed as they were and hence cancels them when you establish a backorder MO. This is because the system considers that the remaining operations are no longer valid. After all, the quantity of the initial MO has changed.
Create a custom module or add your code to an existing module.
Inherit the mrp.production model to modify the behavior of creating backorder MOs.
Override the action_backorder method in your custom module.

from odoo import models

class MrpProduction(models.Model):
_inherit = 'mrp.production'

def action_backorder(self):
backorder_moves_vals = []
for move in self.move_finished_ids.filtered(lambda x: x.state not in ('done', 'cancel')):
if move.product_uom_qty <= 0.0:
continue
backorder_moves_vals.append(move._prepare_move_copy_values(move.product_uom_qty))
if backorder_moves_vals:
backorder_production = self.copy({
'move_raw_ids': [],
'move_finished_ids': backorder_moves_vals,
'backorder_id': self.id,
'date_planned_start': False,
'date_planned_finished': False,
'state': 'draft',
'workorder_ids': [],
'move_dest_ids': [],
})
backorder_production._onchange_move_raw()
backorder_production.action_assign()
return True

Regards

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I was also experiencing the same problem.  

Two options:

  1. Without customization, you can delete the cancelled work orders in the back ordered MO then add work orders again.  This provides flexibility as to what specific work orders to start with.
  2. With customization, you can add a button, to recopy the work orders from BOM (automating #1), delete work orders that are not needed.
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 22
3852
0
thg 6 19
4100
2
thg 8 25
1587
1
thg 7 25
551
1
thg 7 24
2398