[FIX] l10n_be_intrastat, report_intrastat: date
The reference date for Intrastat should be the accounting date, not the invoice date. opw-1890240 closes odoo/odoo#29466
This commit is contained in:
@@ -155,8 +155,8 @@ class XmlDeclaration(models.TransientModel):
|
||||
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,
|
||||
|
||||
@@ -30,8 +30,8 @@ class ReportIntrastat(models.Model):
|
||||
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,
|
||||
@@ -71,5 +71,5 @@ class ReportIntrastat(models.Model):
|
||||
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
|
||||
)""")
|
||||
|
||||
Reference in New Issue
Block a user