From 5e5a87d2b447f8765b14741b007c3ada55881ee9 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Alomar Date: Mon, 21 Nov 2022 15:13:06 +0100 Subject: [PATCH] [FIX] include anglo-saxon price unit calculation in refunds. Otherwise the anglo saxon entries won't be correct. For example, the Interim (Delivered) account should balance after receiving and triggering a refund on a customer rma. --- rma_account/models/account_move.py | 7 +++++++ rma_account/models/stock_move.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/rma_account/models/account_move.py b/rma_account/models/account_move.py index e28f89a3..361abdd8 100644 --- a/rma_account/models/account_move.py +++ b/rma_account/models/account_move.py @@ -234,8 +234,15 @@ class AccountMoveLine(models.Model): and bool(l.move_id.reversed_entry_id) == is_line_reversing ) qty_refunded = sum( +<<<<<<< HEAD x.product_uom_id._compute_quantity(x.quantity, x.product_id.uom_id) for x in posted_invoice_lines +======= + [ + x.product_uom_id._compute_quantity(x.quantity, x.product_id.uom_id) + for x in posted_invoice_lines + ] +>>>>>>> 614c98c ([FIX] include anglo-saxon price unit calculation in refunds.) ) product = self.product_id.with_company(self.company_id).with_context( is_returned=is_line_reversing diff --git a/rma_account/models/stock_move.py b/rma_account/models/stock_move.py index 610c97e4..1eb1ef02 100644 --- a/rma_account/models/stock_move.py +++ b/rma_account/models/stock_move.py @@ -20,4 +20,11 @@ class StockMove(models.Model): != self.product_id.categ_id.property_stock_valuation_account_id.id ): line[2]["rma_line_id"] = self.rma_line_id.id + + def _account_entry_move(self, qty, description, svl_id, cost): + res = super(StockMove, self)._account_entry_move(qty, description, svl_id, cost) + if self.company_id.anglo_saxon_accounting: + # Eventually reconcile together the invoice and valuation accounting + # entries on the stock interim accounts + self.rma_line_id._stock_account_anglo_saxon_reconcile_valuation() return res