From c5ffca151160f9d99bec036330def108e4e91e0b Mon Sep 17 00:00:00 2001 From: len-odoo Date: Mon, 6 Aug 2018 12:13:01 +0200 Subject: [PATCH] [FIX] stock_account: copy the to_refund field when splitting a move The to_refund attribute is set to copy=False. However when splitting a move to create a backorder, a new move is created as a copy with the remaining work to do. This attribute is needed so that the backorder refund is consistently applied. opw 1865324 --- addons/stock_account/models/stock.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index 7067c7444da..7d13da6d2cb 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -578,6 +578,11 @@ class StockMove(models.Model): res.append((0, 0, price_diff_line)) return res + def _prepare_move_split_vals(self, uom_qty): + vals = super(StockMove, self)._prepare_move_split_vals(uom_qty) + vals['to_refund'] = self.to_refund + return vals + def _create_account_move_line(self, credit_account_id, debit_account_id, journal_id): self.ensure_one() AccountMove = self.env['account.move']