Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
2208 Widoki

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!

Awatar
Odrzuć

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

Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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.
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lut 22
3066
0
cze 19
3279
1
kwi 25
339
1
lip 24
1112
1
sty 24
1281