[REVERT]
authorStephane Wirtel <stw@openerp.com>
Fri, 9 Dec 2011 13:47:06 +0000 (14:47 +0100)
committerStephane Wirtel <stw@openerp.com>
Fri, 9 Dec 2011 13:47:06 +0000 (14:47 +0100)
bzr revid: stw@openerp.com-20111209134706-jp5umfkbvj9mlb2n

addons/crm/report/crm_lead_report.py

index eb93726..24f48e7 100644 (file)
@@ -108,46 +108,46 @@ class crm_lead_report(osv.osv):
             @param cr: the current row, from the database cursor
         """
         tools.drop_view_if_exists(cr, 'crm_lead_report')
-        #cr.execute("""
-        #    CREATE OR REPLACE VIEW crm_lead_report AS (
-        #        SELECT
-        #            id,
-
-        #            to_char(c.date_deadline, 'YYYY') as deadline_year,
-        #            to_char(c.date_deadline, 'MM') as deadline_month,
-        #            to_char(c.date_deadline, 'YYYY-MM-DD') as deadline_day,
-
-        #            to_char(c.create_date, 'YYYY') as creation_year,
-        #            to_char(c.create_date, 'MM') as creation_month,
-        #            to_char(c.create_date, 'YYYY-MM-DD') as creation_day,
-
-        #            to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
-        #            to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
-
-        #            c.state,
-        #            c.user_id,
-        #            c.probability,
-        #            c.stage_id,
-        #            c.type,
-        #            c.company_id,
-        #            c.priority,
-        #            c.section_id,
-        #            c.channel_id,
-        #            c.type_id,
-        #            c.categ_id,
-        #            c.partner_id,
-        #            c.country_id,
-        #            c.planned_revenue,
-        #            c.planned_revenue*(c.probability/100) as probable_revenue,
-        #            1 as nbr,
-        #            (SELECT count(id) FROM mail_message WHERE model='crm.lead' AND res_id=c.id AND email_from is not null) AS email,
-        #            date_trunc('day',c.create_date) as create_date,
-        #            extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as  delay_close,
-        #            abs(extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24)) as  delay_expected,
-        #            extract('epoch' from (c.date_open-c.create_date))/(3600*24) as  delay_open
-        #        FROM
-        #            crm_lead c
-        #    )""")
+        cr.execute("""
+            CREATE OR REPLACE VIEW crm_lead_report AS (
+                SELECT
+                    id,
+
+                    to_char(c.date_deadline, 'YYYY') as deadline_year,
+                    to_char(c.date_deadline, 'MM') as deadline_month,
+                    to_char(c.date_deadline, 'YYYY-MM-DD') as deadline_day,
+
+                    to_char(c.create_date, 'YYYY') as creation_year,
+                    to_char(c.create_date, 'MM') as creation_month,
+                    to_char(c.create_date, 'YYYY-MM-DD') as creation_day,
+
+                    to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
+                    to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
+
+                    c.state,
+                    c.user_id,
+                    c.probability,
+                    c.stage_id,
+                    c.type,
+                    c.company_id,
+                    c.priority,
+                    c.section_id,
+                    c.channel_id,
+                    c.type_id,
+                    c.categ_id,
+                    c.partner_id,
+                    c.country_id,
+                    c.planned_revenue,
+                    c.planned_revenue*(c.probability/100) as probable_revenue,
+                    1 as nbr,
+                    (SELECT count(id) FROM mail_message WHERE model='crm.lead' AND res_id=c.id AND email_from is not null) AS email,
+                    date_trunc('day',c.create_date) as create_date,
+                    extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as  delay_close,
+                    abs(extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24)) as  delay_expected,
+                    extract('epoch' from (c.date_open-c.create_date))/(3600*24) as  delay_open
+                FROM
+                    crm_lead c
+            )""")
 
 crm_lead_report()