From 0e94c675ef5df3a3d77401c9952c8ce97dd071a9 Mon Sep 17 00:00:00 2001 From: Geoffroy Larue Date: Thu, 12 Sep 2019 07:09:30 +0000 Subject: [PATCH] [IMP] account: make reverse wiazrd extendable This commit sets the call to default method on move field in reversal wizard as lambda to ensure that the right method is called when it is inherited (as in helpdesk_account module). It also changes the form view so other module can use it to refund invoices (move_id field first in the view as it will determine if refund method should be visible or not). Task-2047999 closes odoo/odoo#37635 X-original-commit: bcda50aeca44b292417024a5e422ffb8698e0c99 Signed-off-by: gla-odoo --- addons/account/wizard/account_move_reversal.py | 2 +- addons/account/wizard/account_move_reversal_view.xml | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/account/wizard/account_move_reversal.py b/addons/account/wizard/account_move_reversal.py index f25d9693310..b71275a3498 100644 --- a/addons/account/wizard/account_move_reversal.py +++ b/addons/account/wizard/account_move_reversal.py @@ -21,7 +21,7 @@ class AccountMoveReversal(models.TransientModel): return self.env['account.move'] move_id = fields.Many2one('account.move', string='Journal Entry', - default=_get_default_move, + default=lambda self: self._get_default_move, domain=[('state', '=', 'posted'), ('type', 'not in', ('out_refund', 'in_refund'))]) date = fields.Date(string='Reversal date', default=fields.Date.context_today, required=True) reason = fields.Char(string='Reason') diff --git a/addons/account/wizard/account_move_reversal_view.xml b/addons/account/wizard/account_move_reversal_view.xml index 5e50b4fdd41..9a981561285 100644 --- a/addons/account/wizard/account_move_reversal_view.xml +++ b/addons/account/wizard/account_move_reversal_view.xml @@ -8,6 +8,11 @@
+ + + + + @@ -24,8 +29,9 @@ The original invoice is duplicated as a new draft. + + -