From 4f59aea9e33a1d4865dc81ff1db71e31d4afadc8 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/models/rma_order_line.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index 4ac27392..c0754908 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -58,6 +58,18 @@ class RmaOrderLine(models.Model): pickings |= move.picking_id return pickings + @api.model + def _get_in_moves(self): + moves = self.env["stock.move"] + for move in self.move_ids: + first_usage = move._get_first_usage() + last_usage = move._get_last_usage() + if last_usage == "internal" and first_usage != "internal": + moves |= move + elif last_usage == "supplier" and first_usage == "customer": + moves |= moves + return moves + @api.model def _get_out_pickings(self): pickings = self.env["stock.picking"]