[FIX] rma: Use Form to avoid UoM change invalid check

Since odoo/odoo#75823, the wizard lines have the field uom_id related to
move.product_uom and readonly=False, so if you call directly to
wiz.onchage_picking_id a write in stock move is executed and the warning raises,
although we don't really do any UoM change.

We avoid it using the `Form` to perform the wizard update.
This commit is contained in:
Pedro M. Baeza
2021-09-06 08:39:53 +02:00
committed by Nikolaus Weingartmair
parent 44bec64b87
commit 09abc9d3b5
2 changed files with 11 additions and 12 deletions

View File

@@ -895,15 +895,14 @@ class Rma(models.Model):
location_id=self.location_id.id,
picking_id=self.picking_id.id,
)
return_wizard = (
self.env["stock.return.picking"]
.with_context(
active_id=self.picking_id.id,
stock_return_picking_form = Form(
self.env["stock.return.picking"].with_context(
active_ids=self.picking_id.ids,
active_id=self.picking_id.id,
active_model="stock.picking",
)
.create(create_vals)
)
return_wizard._onchange_picking_id()
return_wizard = stock_return_picking_form.save()
return_wizard.product_return_moves.filtered(
lambda r: r.move_id != self.move_id
).unlink()