From 2230bee0c524f14038c0ea8a95efe9fd7abacf90 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 23 Feb 2016 08:18:00 +0100 Subject: [PATCH] [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 --- addons/report_intrastat/report_intrastat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/report_intrastat/report_intrastat.py b/addons/report_intrastat/report_intrastat.py index 630a13677d0..1517586c54a 100644 --- a/addons/report_intrastat/report_intrastat.py +++ b/addons/report_intrastat/report_intrastat.py @@ -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 )""")