Skip to Content
Menu
This question has been flagged
2 Replies
2190 Views

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!

Avatar
Discard

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

Best Answer

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

Avatar
Discard
Best Answer

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.
Avatar
Discard
Related Posts Replies Views Activity
1
Feb 22
3044
0
Jun 19
3246
1
Apr 25
307
1
Jul 24
1066
1
Jan 24
1226