Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
2206 Zobrazení

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
Zrušit

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

Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
úno 22
3066
0
čvn 19
3278
1
dub 25
337
1
čvc 24
1110
1
led 24
1280