From ea157df42d8a825ffc77a60a160830103d896f3d Mon Sep 17 00:00:00 2001 From: mariadforgeflow Date: Tue, 28 Feb 2023 13:06:33 +0100 Subject: [PATCH] [IMP] rma_account: change account_move_line_id domain to make search more efficient --- rma_account/models/rma_order_line.py | 14 ++++++++++++++ rma_account/views/rma_order_line_view.xml | 12 ++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/rma_account/models/rma_order_line.py b/rma_account/models/rma_order_line.py index 2b944dcbc..74bca60d7 100644 --- a/rma_account/models/rma_order_line.py +++ b/rma_account/models/rma_order_line.py @@ -121,6 +121,20 @@ 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.""" diff --git a/rma_account/views/rma_order_line_view.xml b/rma_account/views/rma_order_line_view.xml index cb38a14b7..b2198885f 100644 --- a/rma_account/views/rma_order_line_view.xml +++ b/rma_account/views/rma_order_line_view.xml @@ -6,13 +6,13 @@ + @@ -46,13 +46,13 @@ +