mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[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:
committed by
Nikolaus Weingartmair
parent
44bec64b87
commit
09abc9d3b5
@@ -895,15 +895,14 @@ class Rma(models.Model):
|
|||||||
location_id=self.location_id.id,
|
location_id=self.location_id.id,
|
||||||
picking_id=self.picking_id.id,
|
picking_id=self.picking_id.id,
|
||||||
)
|
)
|
||||||
return_wizard = (
|
stock_return_picking_form = Form(
|
||||||
self.env["stock.return.picking"]
|
self.env["stock.return.picking"].with_context(
|
||||||
.with_context(
|
|
||||||
active_id=self.picking_id.id,
|
|
||||||
active_ids=self.picking_id.ids,
|
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(
|
return_wizard.product_return_moves.filtered(
|
||||||
lambda r: r.move_id != self.move_id
|
lambda r: r.move_id != self.move_id
|
||||||
).unlink()
|
).unlink()
|
||||||
|
|||||||
@@ -571,15 +571,15 @@ class TestRma(SavepointCase):
|
|||||||
def test_rma_from_picking_return(self):
|
def test_rma_from_picking_return(self):
|
||||||
# Create a return from a delivery picking
|
# Create a return from a delivery picking
|
||||||
origin_delivery = self._create_delivery()
|
origin_delivery = self._create_delivery()
|
||||||
return_wizard = (
|
stock_return_picking_form = Form(
|
||||||
self.env["stock.return.picking"]
|
self.env["stock.return.picking"].with_context(
|
||||||
.with_context(
|
|
||||||
active_id=origin_delivery.id,
|
|
||||||
active_ids=origin_delivery.ids,
|
active_ids=origin_delivery.ids,
|
||||||
|
active_id=origin_delivery.id,
|
||||||
|
active_model="stock.picking",
|
||||||
)
|
)
|
||||||
.create({"create_rma": True, "picking_id": origin_delivery.id})
|
|
||||||
)
|
)
|
||||||
return_wizard._onchange_picking_id()
|
stock_return_picking_form.create_rma = True
|
||||||
|
return_wizard = stock_return_picking_form.save()
|
||||||
picking_action = return_wizard.create_returns()
|
picking_action = return_wizard.create_returns()
|
||||||
# Each origin move is linked to a different RMA
|
# Each origin move is linked to a different RMA
|
||||||
origin_moves = origin_delivery.move_lines
|
origin_moves = origin_delivery.move_lines
|
||||||
|
|||||||
Reference in New Issue
Block a user