From 8ed8e4995f4083c05da5e7de2ea78d13ce58c662 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Wed, 28 Dec 2022 13:13:34 +0100 Subject: [PATCH] [FIX] rma_account: Ensure that configuration on the operation is applied Without this, some policies are not being copied from the operation selected when creating new rma line from a rma group. In v16 this patch and the usage of such onchange can be removed in favor of (pre)computed stored editable fields for all policies and configuration in the RMA operation. --- rma_account/wizards/rma_add_account_move.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rma_account/wizards/rma_add_account_move.py b/rma_account/wizards/rma_add_account_move.py index eac2754d..642bda4a 100644 --- a/rma_account/wizards/rma_add_account_move.py +++ b/rma_account/wizards/rma_add_account_move.py @@ -128,7 +128,13 @@ class RmaAddAccountMove(models.TransientModel): # Load a PO line only once if line not in existing_invoice_lines: data = self._prepare_rma_line_from_inv_line(line) - rma_line_obj.create(data) + rec = rma_line_obj.create(data) + # Ensure that configuration on the operation is applied (like + # policies). + # TODO MIG: in v16 the usage of such onchange can be removed in + # favor of (pre)computed stored editable fields for all policies + # and configuration in the RMA operation. + rec._onchange_operation_id() rma = self.rma_id data_rma = self._get_rma_data() rma.write(data_rma)