[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 d1d896621f
opw-668827
This commit is contained in:
@@ -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
|
||||
)""")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user