From a6a2df0a92bf5a25757e11b84cf610ae48e5697b Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Tue, 15 Dec 2009 16:18:32 +0530 Subject: [PATCH] [IMP,MOD] adding year and month for search view bzr revid: vir@tinyerp.com-20091215104832-szlf05amh6vsoamg --- addons/report_intrastat/report_intrastat.py | 14 ++++---- .../report_intrastat_view.xml | 32 ++++++++++--------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/addons/report_intrastat/report_intrastat.py b/addons/report_intrastat/report_intrastat.py index 61c1e0058f6..5da69c1e579 100644 --- a/addons/report_intrastat/report_intrastat.py +++ b/addons/report_intrastat/report_intrastat.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -61,7 +61,9 @@ class report_intrastat(osv.osv): _description = "Intrastat report" _auto = False _columns = { - 'name': fields.many2one('account.period', 'Period', readonly=True, select=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), + 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), + ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True), 'supply_units':fields.float('Supply Units', readonly=True), 'ref':fields.char('Origin',size=64, readonly=True), 'code': fields.char('Country code', size="2", readonly=True), @@ -76,7 +78,8 @@ class report_intrastat(osv.osv): cr.execute(""" create or replace view report_intrastat as ( select - inv.period_id as name, + to_char(inv.create_date, 'YYYY') as name, + to_char(inv.create_date, 'MM') as month, min(inv_line.id) as id, intrastat.id as intrastat_id, upper(inv_country.code) as code, @@ -130,8 +133,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 inv.period_id,intrastat.id,inv.type,pt.intrastat_id, inv_country.code,inv.number, inv.currency_id + 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 )""") report_intrastat() - diff --git a/addons/report_intrastat/report_intrastat_view.xml b/addons/report_intrastat/report_intrastat_view.xml index baeb7f53af0..2242d37545b 100644 --- a/addons/report_intrastat/report_intrastat_view.xml +++ b/addons/report_intrastat/report_intrastat_view.xml @@ -12,7 +12,7 @@ - + res.country.form res.country @@ -23,7 +23,7 @@ - + product.normal.form @@ -35,7 +35,7 @@ - + report.intrastat.code.tree @@ -66,18 +66,19 @@ form tree,form - + - - + + report.intrastat.view report.intrastat tree - - + + + @@ -88,26 +89,27 @@ - + report.intrastat.search report.intrastat search - - - + + + - + + - + Intrastat ir.actions.act_window @@ -116,7 +118,7 @@ tree - +