From 8f0da54155caa73eb738daeda8e4df63c8e7178c Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Fri, 5 Mar 2021 10:29:30 +0100 Subject: [PATCH] [11.0]account_journal_refund_settings - fix stack trace when creating refund --- account_journal_refund_settings/__init__.py | 1 - .../__manifest__.py | 2 +- .../wizards/__init__.py | 1 - .../wizards/account_invoice_refund.py | 36 ------------------- 4 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 account_journal_refund_settings/wizards/__init__.py delete mode 100644 account_journal_refund_settings/wizards/account_invoice_refund.py diff --git a/account_journal_refund_settings/__init__.py b/account_journal_refund_settings/__init__.py index aee8895e..0650744f 100644 --- a/account_journal_refund_settings/__init__.py +++ b/account_journal_refund_settings/__init__.py @@ -1,2 +1 @@ from . import models -from . import wizards diff --git a/account_journal_refund_settings/__manifest__.py b/account_journal_refund_settings/__manifest__.py index aaacec11..a2d755c1 100644 --- a/account_journal_refund_settings/__manifest__.py +++ b/account_journal_refund_settings/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Account Journal Refund settings', - 'version': '11.0.1.1.0', + 'version': '11.0.1.1.1', 'category': 'Accounting & Finance', 'author': 'Noviat', 'website': 'http://www.noviat.com', diff --git a/account_journal_refund_settings/wizards/__init__.py b/account_journal_refund_settings/wizards/__init__.py deleted file mode 100644 index 87692426..00000000 --- a/account_journal_refund_settings/wizards/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import account_invoice_refund diff --git a/account_journal_refund_settings/wizards/account_invoice_refund.py b/account_journal_refund_settings/wizards/account_invoice_refund.py deleted file mode 100644 index 65d2f28b..00000000 --- a/account_journal_refund_settings/wizards/account_invoice_refund.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2009-2019 Noviat. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import api, models - -# mapping invoice type to refund type -_T2T = { - 'out_invoice': 'out_refund', - 'in_invoice': 'in_refund', - 'out_refund': 'out_invoice', - 'in_refund': 'in_invoice', -} - - -class AccountInvoiceRefund(models.TransientModel): - _inherit = 'account.invoice.refund' - - @api.multi - def compute_refund(self, mode='refund'): - res = super().compute_refund(mode=mode) - active_ids = self.env.context.get('active_ids') - if len(active_ids) == 1 and isinstance(res, dict): - invoice = self.env['account.invoice'].browse(active_ids) - if self.filter_refund in ['refund', 'cancel']: - refund_type = _T2T.get(invoice.type) - domain = res.get('domain') - if domain and 'refund' in refund_type: - module = 'account_refund_menu' - action = '{}.account_invoice_action_{}'.format( - module, refund_type) - res = self.env.ref(action).read()[0] - for i, arg in enumerate(domain): - if arg[0] == 'type': - domain[i] = ('type', '=', refund_type) - res['domain'] = domain - return res