[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:
parent
f89220a513
commit
2230bee0c5
|
@ -77,8 +77,8 @@ class report_intrastat(osv.osv):
|
||||||
cr.execute("""
|
cr.execute("""
|
||||||
create or replace view report_intrastat as (
|
create or replace view report_intrastat as (
|
||||||
select
|
select
|
||||||
to_char(inv.create_date, 'YYYY') as name,
|
to_char(inv.date_invoice, 'YYYY') as name,
|
||||||
to_char(inv.create_date, 'MM') as month,
|
to_char(inv.date_invoice, 'MM') as month,
|
||||||
min(inv_line.id) as id,
|
min(inv_line.id) as id,
|
||||||
intrastat.id as intrastat_id,
|
intrastat.id as intrastat_id,
|
||||||
upper(inv_country.code) as code,
|
upper(inv_country.code) as code,
|
||||||
|
@ -117,7 +117,7 @@ class report_intrastat(osv.osv):
|
||||||
inv.state in ('open','paid')
|
inv.state in ('open','paid')
|
||||||
and inv_line.product_id is not null
|
and inv_line.product_id is not null
|
||||||
and inv_country.intrastat=true
|
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
|
||||||
)""")
|
)""")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue