From e5972c83cdf1292b2ff5127f8b2e68546df6fda8 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Tue, 15 Dec 2009 15:40:03 +0530 Subject: [PATCH] [MOD] Changes in search view for report_document module bzr revid: vir@tinyerp.com-20091215101003-4z3b20zd92o62v30 --- addons/report_document/report_document.py | 43 ++++++++-------- .../report_document/report_document_view.xml | 50 +++++++++---------- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/addons/report_document/report_document.py b/addons/report_document/report_document.py index 911dc3a6ace..27df808adf4 100644 --- a/addons/report_document/report_document.py +++ b/addons/report_document/report_document.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 . # ############################################################################## @@ -39,8 +39,9 @@ class report_document_user(osv.osv): _description = "Files details by Users" _auto = False _columns = { - 'name': fields.date('Month', readonly=True), - 'month': fields.char('Month', size=24,readonly=True), + 'name': fields.char('Year', size=64,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), 'user_id':fields.integer('Owner', readonly=True), 'user':fields.char('User',size=64,readonly=True), 'file_title': fields.char('File Name',size=64,readonly=True), @@ -57,21 +58,21 @@ class report_document_user(osv.osv): create or replace view report_document_user as ( select min(f.id) as id, + to_char(f.create_date, 'YYYY') as name, + to_char(f.create_date, 'MM') as month, f.user_id as user_id, u.name as user, count(*) as nbr, - to_char(f.create_date,'YYYY-MM')||'-'||'01' as name, d.name as directory, f.create_date as create_date, f.file_size as file_size, min(f.title) as file_title, min(d.type) as type, - min(EXTRACT(MONTH FROM f.create_date)||'-'||to_char(f.create_date,'Month')) as month, f.write_date as change_date from ir_attachment f left join document_directory d on (f.parent_id=d.id and d.name<>'') inner join res_users u on (f.user_id=u.id) - group by d.name,f.parent_id,d.type,f.create_date,f.user_id,f.file_size,u.name,d.type,f.write_date + group by to_char(f.create_date, 'YYYY'), to_char(f.create_date, 'MM'),d.name,f.parent_id,d.type,f.create_date,f.user_id,f.file_size,u.name,d.type,f.write_date ) """) report_document_user() @@ -101,9 +102,9 @@ class report_files_partner(osv.osv): to_char(f.create_date,'YYYY') as name, min(to_char(f.create_date,'MM')) as month, min(f.title) as file_title, - p.name as partner - from ir_attachment f - inner join res_partner p + p.name as partner + from ir_attachment f + inner join res_partner p on (f.partner_id=p.id) where f.datas_fname is not null group by p.name, to_char(f.create_date,'YYYY') @@ -127,12 +128,12 @@ class report_document_file(osv.osv): select min(f.id) as id, count(*) as nbr, min(EXTRACT(MONTH FROM f.create_date)||'-'||to_char(f.create_date,'Month')) as month, - sum(f.file_size) as file_size - from ir_attachment f - group by EXTRACT(MONTH FROM f.create_date) + sum(f.file_size) as file_size + from ir_attachment f + group by EXTRACT(MONTH FROM f.create_date) ) """) - + report_document_file() class report_document_wall(osv.osv): @@ -147,7 +148,7 @@ class report_document_wall(osv.osv): 'file_name':fields.char('Last Posted File Name',size=64,readonly=True), 'last':fields.datetime('Last Posted Time', readonly=True), } - + def init(self, cr): cr.execute(""" create or replace view report_document_wall as ( @@ -155,13 +156,13 @@ class report_document_wall(osv.osv): min(title) as file_name, to_char(min(f.create_date),'YYYY-MM-DD HH24:MI:SS') as last, f.user_id as user_id, f.user_id as user, - to_char(f.create_date,'Month') as month - from ir_attachment f + to_char(f.create_date,'Month') as month + from ir_attachment f where f.create_date in ( - select max(i.create_date) - from ir_attachment i - inner join res_users u on (i.user_id=u.id) - group by i.user_id) group by f.user_id,f.create_date + select max(i.create_date) + from ir_attachment i + inner join res_users u on (i.user_id=u.id) + group by i.user_id) group by f.user_id,f.create_date having (CURRENT_DATE - to_date(to_char(f.create_date,'YYYY-MM-DD'),'YYYY-MM-DD')) > 30 ) """) diff --git a/addons/report_document/report_document_view.xml b/addons/report_document/report_document_view.xml index ce01fb3e7fc..1de045c012f 100644 --- a/addons/report_document/report_document_view.xml +++ b/addons/report_document/report_document_view.xml @@ -25,6 +25,7 @@ + @@ -41,12 +42,11 @@ - - - - + + + @@ -65,9 +65,9 @@ tree - + - + report.document.wall.form @@ -97,14 +97,14 @@ - + Wall of Shame report.document.wall form tree,form - + @@ -121,7 +121,7 @@ - + @@ -141,7 +141,7 @@ form tree - + @@ -155,7 +155,7 @@ - + report.document.user.tree report.document.file @@ -173,11 +173,11 @@ form tree - - + + - + report.file.month.graph report.document.user @@ -188,11 +188,11 @@ - + - + report.file.month.tree report.document.user @@ -205,7 +205,7 @@ - + Files by Month report.document.user @@ -213,8 +213,8 @@ form tree - - + + @@ -228,7 +228,7 @@ - + Files By Users report.document.user @@ -236,8 +236,8 @@ form tree - - + + @@ -252,7 +252,7 @@ - + view.files.partner.tree report.files.partner @@ -266,7 +266,7 @@ - + view.files.partner.form report.files.partner @@ -280,7 +280,7 @@ - + Files Per Partner report.files.partner