From c132ec3fa0f145b2f6930febf3d1bd9727e3fca1 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Alomar Date: Sun, 27 Nov 2022 18:49:59 +0100 Subject: [PATCH] [FIX] rma_account: try to auto-reconcile interim account --- rma_account/models/rma_order_line.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rma_account/models/rma_order_line.py b/rma_account/models/rma_order_line.py index 0a5b4007..8c43711b 100644 --- a/rma_account/models/rma_order_line.py +++ b/rma_account/models/rma_order_line.py @@ -325,7 +325,15 @@ class RmaOrderLine(models.Model): product_interim_account = product_accounts["stock_input"] if product_interim_account.reconcile: # Get the in and out moves - amls = rma.move_ids.mapped( + amls = self.env["account.move.line"].search( + [ + ("rma_line_id", "=", rma.id), + ("account_id", "=", product_interim_account.id), + ("parent_state", "=", "posted"), + ("reconciled", "=", False), + ] + ) + amls |= rma.move_ids.mapped( "stock_valuation_layer_ids.account_move_id.line_ids" ) # Search for anglo-saxon lines linked to the product in the journal entry.