Skip to content

Commit

Permalink
[FIX] l10n_be_intrastat, report_intrastat: date
Browse files Browse the repository at this point in the history
The reference date for Intrastat should be the accounting date, not the
invoice date.

opw-1890240
  • Loading branch information
nim-odoo committed Dec 12, 2018
1 parent 7e5d504 commit 7e44155
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions addons/l10n_be_intrastat/wizard/xml_decl.py
Expand Up @@ -155,8 +155,8 @@ def _get_lines(self, dispatchmode=False, extendedmode=False):
OR (res_country.code is NULL AND countrypartner.code IS NOT NULL
AND not countrypartner.code=%s))
AND inv.type IN (%s, %s)
AND to_char(inv.date_invoice, 'YYYY')=%s
AND to_char(inv.date_invoice, 'MM')=%s
AND to_char(COALESCE(inv.date, inv.date_invoice), 'YYYY')=%s
AND to_char(COALESCE(inv.date, inv.date_invoice), 'MM')=%s
"""

self.env.cr.execute(query, (company.id, company.partner_id.country_id.code,
Expand Down
6 changes: 3 additions & 3 deletions addons/report_intrastat/report/report_intrastat_report.py
Expand Up @@ -30,8 +30,8 @@ def init(self):
self.env.cr.execute("""
create or replace view report_intrastat as (
select
to_char(inv.date_invoice, 'YYYY') as name,
to_char(inv.date_invoice, 'MM') as month,
to_char(coalesce(inv.date, inv.date_invoice), 'YYYY') as name,
to_char(coalesce(inv.date, inv.date_invoice), 'MM') as month,
min(inv_line.id) as id,
intrastat.id as intrastat_id,
upper(inv_country.code) as code,
Expand Down Expand Up @@ -71,5 +71,5 @@ def init(self):
inv.state in ('open','paid')
and inv_line.product_id is not null
and inv_country.intrastat=true
group by to_char(inv.date_invoice, 'YYYY'), to_char(inv.date_invoice, 'MM'),intrastat.id,inv.type,pt.intrastat_id, inv_country.code,inv.number, inv.currency_id, inv.company_id
group by to_char(coalesce(inv.date, inv.date_invoice), 'YYYY'), to_char(coalesce(inv.date, inv.date_invoice), 'MM'),intrastat.id,inv.type,pt.intrastat_id, inv_country.code,inv.number, inv.currency_id, inv.company_id
)""")

0 comments on commit 7e44155

Please sign in to comment.