diff --git a/addons/account/wizard/account_move_reversal.py b/addons/account/wizard/account_move_reversal.py index b53d50fd513..aa9b0779950 100644 --- a/addons/account/wizard/account_move_reversal.py +++ b/addons/account/wizard/account_move_reversal.py @@ -71,6 +71,9 @@ class AccountMoveReversal(models.TransientModel): 'auto_post': True if reverse_date > fields.Date.context_today(self) else False, } + def _reverse_moves_post_hook(self, moves): + return + def reverse_moves(self): self.ensure_one() moves = self.move_ids @@ -100,6 +103,8 @@ class AccountMoveReversal(models.TransientModel): return self.new_move_ids = new_moves + if new_moves: + self._reverse_moves_post_hook(new_moves) # Create action. action = { diff --git a/addons/stock_account/wizard/__init__.py b/addons/stock_account/wizard/__init__.py index b920576a240..e705e076976 100644 --- a/addons/stock_account/wizard/__init__.py +++ b/addons/stock_account/wizard/__init__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import account_move_reversal from . import stock_quantity_history from . import stock_picking_return from . import stock_valuation_layer_revaluation diff --git a/addons/stock_account/wizard/account_move_reversal.py b/addons/stock_account/wizard/account_move_reversal.py new file mode 100644 index 00000000000..a9ad68c7ff1 --- /dev/null +++ b/addons/stock_account/wizard/account_move_reversal.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from odoo import models + + +class AccountMoveReversal(models.TransientModel): + _inherit = "account.move.reversal" + + def _reverse_moves_post_hook(self, moves): + if self.refund_method == "modify": + moves.mapped("line_ids").filtered(lambda line: line.is_anglo_saxon_line).unlink() + return super()._reverse_moves_post_hook(moves)