Skip to content

Commit

Permalink
l10n_be_coa_multilang - fix vat decl (POS)
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-demeyer committed Feb 28, 2021
1 parent 7fa60fb commit 8e8c70b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
4 changes: 2 additions & 2 deletions l10n_be_coa_multilang/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
4 changes: 2 additions & 2 deletions l10n_be_coa_multilang/models/account_chart_template.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
42 changes: 33 additions & 9 deletions l10n_be_coa_multilang/wizards/l10n_be_vat_declaration.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down

0 comments on commit 8e8c70b

Please sign in to comment.