Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
3130 Visualizzazioni

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
Abbandona

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

Risposta migliore

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
feb 22
3862
0
giu 19
4113
2
ago 25
1594
1
lug 25
562
1
lug 24
2409