[FIX] report_intrastat: month used for intrastat.report record

The month used for an intrastat.report record must be the same as
the invoice_date set on the invoice.

Backport of d1d896621fffc79c73aeee07c8cb1c7a49a36411

opw-668827
This commit is contained in:
Nicolas Martinelli 2016-02-23 08:18:00 +01:00
parent f89220a513
commit 2230bee0c5
1 changed files with 3 additions and 3 deletions

View File

@ -77,8 +77,8 @@ class report_intrastat(osv.osv):
cr.execute("""
create or replace view report_intrastat as (
select
to_char(inv.create_date, 'YYYY') as name,
to_char(inv.create_date, 'MM') as month,
to_char(inv.date_invoice, 'YYYY') as name,
to_char(inv.date_invoice, 'MM') as month,
min(inv_line.id) as id,
intrastat.id as intrastat_id,
upper(inv_country.code) as code,
@ -117,7 +117,7 @@ class report_intrastat(osv.osv):
inv.state in ('open','paid')
and inv_line.product_id is not null
and inv_country.intrastat=true
group by to_char(inv.create_date, 'YYYY'), to_char(inv.create_date, 'MM'),intrastat.id,inv.type,pt.intrastat_id, inv_country.code,inv.number, inv.currency_id
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
)""")