diff --git a/l10n_be_coa_multilang/__manifest__.py b/l10n_be_coa_multilang/__manifest__.py index 29bc643..376a734 100644 --- a/l10n_be_coa_multilang/__manifest__.py +++ b/l10n_be_coa_multilang/__manifest__.py @@ -1,9 +1,9 @@ -# Copyright 2009-2020 Noviat +# Copyright 2009-2021 Noviat # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Belgium - Multilingual Chart of Accounts (en/nl/fr)', - 'version': '11.0.1.2.4', + 'version': '11.0.1.2.5', 'license': 'AGPL-3', 'author': "Noviat", 'website': 'http://www.noviat.com', diff --git a/l10n_be_coa_multilang/models/account_chart_template.py b/l10n_be_coa_multilang/models/account_chart_template.py index 8a15229..6b64440 100644 --- a/l10n_be_coa_multilang/models/account_chart_template.py +++ b/l10n_be_coa_multilang/models/account_chart_template.py @@ -1,7 +1,7 @@ -# Copyright 2009-2017 Noviat +# Copyright 2009-2020 Noviat # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import fields, models +from odoo import fields, models class account_chart_template(models.Model): diff --git a/l10n_be_coa_multilang/wizards/l10n_be_vat_declaration.py b/l10n_be_coa_multilang/wizards/l10n_be_vat_declaration.py index 8cf3595..af42f44 100644 --- a/l10n_be_coa_multilang/wizards/l10n_be_vat_declaration.py +++ b/l10n_be_coa_multilang/wizards/l10n_be_vat_declaration.py @@ -1,4 +1,4 @@ -# Copyright 2009-2020 Noviat +# Copyright 2009-2021 Noviat # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import base64 @@ -300,10 +300,24 @@ def _get_case_domain(self, case_code, get_domain=True): self._tax_debt_in_refund_cases()): inv_type = 'in_refund' if inv_type: - if inv_type in ['out_refund']: - # filter out refund cases when the Journal Item - # has no originating invoice, e.g. - # POS Orders, misc. operations + # filter out invoice or refund cases based on + # transaction sign when the Journal Item + # has no originating invoice, e.g. + # POS Orders, misc. operations + if inv_type == 'out_invoice': + inv_type_args = [ + '|', + ('invoice_id.type', '=', inv_type), + '&', + ('invoice_id', '=', False), + ('credit', '>', 0) + ] + inv_check = ( + "({aml}.invoice_id.type == '%s'" + " or " + "(not {aml}.invoice_id and ({aml}.credit > 0)))" + ) % inv_type + elif inv_type == 'out_refund': inv_type_args = [ '|', ('invoice_id.type', '=', inv_type), @@ -316,10 +330,20 @@ def _get_case_domain(self, case_code, get_domain=True): " or " "(not {aml}.invoice_id and ({aml}.debit > 0)))" ) % inv_type - elif inv_type in ['in_refund']: - # filter out refund cases when the Journal Item - # has no originating invoice, e.g. - # bank costs, expense notes, misc. operations + elif inv_type == 'in_invoice': + inv_type_args = [ + '|', + ('invoice_id.type', '=', inv_type), + '&', + ('invoice_id', '=', False), + ('debit', '>', 0), + ] + inv_check = ( + "({aml}.invoice_id.type == '%s'" + " or " + "(not {aml}.invoice_id and ({aml}.debit > 0)))" + ) % inv_type + elif inv_type == 'in_refund': inv_type_args = [ '|', ('invoice_id.type', '=', inv_type),