summaryrefslogtreecommitdiff
path: root/addons/report_document/report_document.py
diff options
context:
space:
mode:
authorVir (Open ERP) <vir@tinyerp.com>2009-12-15 15:40:03 +0530
committerVir (Open ERP) <vir@tinyerp.com>2009-12-15 15:40:03 +0530
commite5972c83cdf1292b2ff5127f8b2e68546df6fda8 (patch)
tree68d4a16b82fa3977f62cb440930b6d2377042e73 /addons/report_document/report_document.py
parent78c1d48949325735da7f54e4c7dcec390b52e561 (diff)
[MOD] Changes in search view for report_document module
bzr revid: vir@tinyerp.com-20091215101003-4z3b20zd92o62v30
Diffstat (limited to 'addons/report_document/report_document.py')
-rw-r--r--addons/report_document/report_document.py43
1 files changed, 22 insertions, 21 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 (<http://tiny.be>).
#
@@ -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 <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -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
)
""")