From cb571b52569e6483680f6bdc0700bc011b670a19 Mon Sep 17 00:00:00 2001 From: AlexPForgeFlow Date: Tue, 5 Nov 2024 11:09:22 +0100 Subject: [PATCH] [FIX] rma: move commercial_partner_id definition from rma_account to rma --- rma/models/rma_order_line.py | 13 +++++++++++++ rma_account/models/rma_order_line.py | 14 -------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index 83f1964f5..aca76f9af 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -232,6 +232,11 @@ def _compute_rma_line_count(self): def _default_date_rma(self): return fields.Datetime.now() + @api.depends("partner_id") + def _compute_commercial_partner_id(self): + for rma_line in self: + rma_line.commercial_partner_id = rma_line.partner_id.commercial_partner_id + delivery_address_id = fields.Many2one( comodel_name="res.partner", string="Partner delivery address", @@ -301,6 +306,14 @@ def _default_date_rma(self): readonly=True, states={"draft": [("readonly", False)]}, ) + commercial_partner_id = fields.Many2one( + "res.partner", + string="Commercial Entity", + store=True, + readonly=True, + compute="_compute_commercial_partner_id", + ondelete="restrict", + ) sequence = fields.Integer( default=10, help="Gives the sequence of this line when displaying the rma." ) diff --git a/rma_account/models/rma_order_line.py b/rma_account/models/rma_order_line.py index c96667e6e..119ff8a73 100644 --- a/rma_account/models/rma_order_line.py +++ b/rma_account/models/rma_order_line.py @@ -121,20 +121,6 @@ def _compute_refund_count(self): store=True, ) - commercial_partner_id = fields.Many2one( - "res.partner", - string="Commercial Entity", - store=True, - readonly=True, - compute="_compute_commercial_partner_id", - ondelete="restrict", - ) - - @api.depends("partner_id") - def _compute_commercial_partner_id(self): - for rma_line in self: - rma_line.commercial_partner_id = rma_line.partner_id.commercial_partner_id - @api.onchange("product_id", "partner_id") def _onchange_product_id(self): """Domain for sale_line_id is computed here to make it dynamic."""