From 1552e3550d026eb601287893393cf968f1c77db5 Mon Sep 17 00:00:00 2001
From: "rch (Open ERP)" <>
Date: Mon, 3 May 2010 13:00:21 +0530
Subject: [PATCH 1/2] [IMP]: Improve crm report by improving search views.
bzr revid: rch_open_erp-20100503073021-9qkf9o48e1ik76os
---
addons/account/report/account_account_report_view.xml | 4 ++--
addons/crm/report/crm_opportunity_report.py | 5 ++++-
addons/crm/report/crm_opportunity_report_view.xml | 4 ++++
addons/crm/report/crm_phonecall_report.py | 5 ++++-
addons/crm/report/crm_phonecall_report_view.xml | 4 ++++
addons/crm/report/crm_report_view.xml | 4 ++--
addons/project_issue/report/project_issue_report_view.xml | 3 ---
7 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/addons/account/report/account_account_report_view.xml b/addons/account/report/account_account_report_view.xml
index 7388beb05f9..19731e390c2 100644
--- a/addons/account/report/account_account_report_view.xml
+++ b/addons/account/report/account_account_report_view.xml
@@ -51,7 +51,7 @@
-
+
@@ -62,7 +62,7 @@
-
+
diff --git a/addons/crm/report/crm_opportunity_report.py b/addons/crm/report/crm_opportunity_report.py
index eb6c4ea5bd4..d2fd08d79e3 100644
--- a/addons/crm/report/crm_opportunity_report.py
+++ b/addons/crm/report/crm_opportunity_report.py
@@ -57,6 +57,7 @@ class crm_opportunity_report(osv.osv):
'priority': fields.selection(crm_report.AVAILABLE_PRIORITIES, 'Priority'),
'date_action': fields.date('Next Action', readonly=True),
'planned_revenue': fields.float('Expected Revenue', readonly=True),
+ 'partner_address_id': fields.many2one('res.partner.address', 'Contact', readonly=True),
}
def init(self, cr):
@@ -88,6 +89,7 @@ class crm_opportunity_report(osv.osv):
c.priority as priority,
c.date_action as date_action,
c.date_deadline as date_deadline,
+ c.partner_address_id as partner_address_id,
sum(c.planned_revenue) as planned_revenue,
date_trunc('day',c.create_date) as create_date,
sum(planned_revenue) as amount_revenue,
@@ -112,7 +114,8 @@ class crm_opportunity_report(osv.osv):
c.date_open,
c.priority,
c.date_action,
- c.date_deadline
+ c.date_deadline,
+ c.partner_address_id
)""")
crm_opportunity_report()
diff --git a/addons/crm/report/crm_opportunity_report_view.xml b/addons/crm/report/crm_opportunity_report_view.xml
index d5d56918629..9f0abb5df6c 100644
--- a/addons/crm/report/crm_opportunity_report_view.xml
+++ b/addons/crm/report/crm_opportunity_report_view.xml
@@ -16,6 +16,7 @@
+
@@ -82,6 +83,7 @@
+
@@ -101,6 +103,8 @@
context="{'group_by':'stage_id'}" />
+
diff --git a/addons/crm/report/crm_phonecall_report.py b/addons/crm/report/crm_phonecall_report.py
index 711a96173d7..2255d722a6f 100644
--- a/addons/crm/report/crm_phonecall_report.py
+++ b/addons/crm/report/crm_phonecall_report.py
@@ -43,7 +43,8 @@ class crm_phonecall_report(osv.osv):
'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'),
'canal_id': fields.many2one('res.partner.canal','Channel',domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.phonecall')]"),
'duration': fields.float('Duration',readonly=True),
- 'date': fields.datetime('Planned Date')
+ 'date': fields.datetime('Planned Date'),
+ 'partner_address_id': fields.many2one('res.partner.address', 'Contact', readonly=True)
}
def init(self, cr):
@@ -75,6 +76,7 @@ class crm_phonecall_report(osv.osv):
c.opportunity_id as opportunity_id,
c.canal_id as canal_id,
c.date as date,
+ c.partner_address_id as partner_address_id,
sum(c.duration) as duration,
date_trunc('day',c.create_date) as create_date,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
@@ -84,6 +86,7 @@ class crm_phonecall_report(osv.osv):
c.state, c.user_id,c.section_id, c.categ_id,c.partner_id,c.company_id
,to_char(c.create_date, 'YYYY-MM-DD'),c.create_date
,c.priority,c.date_closed,opportunity_id,canal_id,c.date
+ ,partner_address_id
)""")
crm_phonecall_report()
diff --git a/addons/crm/report/crm_phonecall_report_view.xml b/addons/crm/report/crm_phonecall_report_view.xml
index a62d6e2d805..36a97374f41 100644
--- a/addons/crm/report/crm_phonecall_report_view.xml
+++ b/addons/crm/report/crm_phonecall_report_view.xml
@@ -16,6 +16,7 @@
+
@@ -82,6 +83,7 @@
+
@@ -100,6 +102,8 @@
+
diff --git a/addons/crm/report/crm_report_view.xml b/addons/crm/report/crm_report_view.xml
index b4e18793af4..9d513c418e2 100644
--- a/addons/crm/report/crm_report_view.xml
+++ b/addons/crm/report/crm_report_view.xml
@@ -99,7 +99,7 @@
help="My section" />
-
+
+ context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
-
-
-
From 636ff15ee1d245c253ddbbc1916c453d78624ad7 Mon Sep 17 00:00:00 2001
From: apa-tiny
Date: Mon, 3 May 2010 14:36:43 +0530
Subject: [PATCH 2/2] [IMP]:mrp:revert product_to_consume and consumed_product
in mrp report.(it's displayed wrong calculation..).
bzr revid: apa@tinyerp.com-20100503090643-sbpgtgwajcim856u
---
addons/mrp/report/mrp_production_order.py | 14 ++------------
addons/mrp/report/mrp_production_order_view.xml | 4 ++--
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/addons/mrp/report/mrp_production_order.py b/addons/mrp/report/mrp_production_order.py
index c5bc5020e20..8f4fe764608 100644
--- a/addons/mrp/report/mrp_production_order.py
+++ b/addons/mrp/report/mrp_production_order.py
@@ -33,8 +33,8 @@ class mrp_production_order(osv.osv):
'day': fields.char('Day',size=64,readonly=True),
'origin': fields.char('Source Document', size=64),
'nbr': fields.integer('# of Orders', readonly=True),
- 'products_to_consumme': fields.integer('Products to Consumme', readonly=True),
- 'consummed_products': fields.integer('Consummed Products', readonly=True),
+# 'products_to_consumme': fields.integer('Products to Consumme', readonly=True),
+# 'consummed_products': fields.integer('Consummed Products', readonly=True),
'date': fields.date('Date', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'product_qty': fields.float('Product Qty', readonly=True),
@@ -79,16 +79,6 @@ class mrp_production_order(osv.osv):
sum(l.product_qty * u.factor) as product_qty,
s.company_id as company_id,
count(*) as nbr,
- (select count(ll.id) from mrp_production_move_ids as mv
- left join stock_move as sm ON (sm.id=mv.move_id)
- left join mrp_production_product_line as ll ON (ll.id=mv.production_id)
- where sm.state not in ('done','cancel') and ll.id=l.id
- group by ll.id) as products_to_consumme,
- (select count(ll.id) from mrp_production_move_ids as mv
- left join stock_move as sm ON (sm.id=mv.move_id)
- left join mrp_production_product_line as ll ON (ll.id=mv.production_id)
- where sm.state in ('done','cancel') and ll.id=l.id
- group by ll.id) as consummed_products,
s.location_src_id,
s.location_dest_id,
s.bom_id,
diff --git a/addons/mrp/report/mrp_production_order_view.xml b/addons/mrp/report/mrp_production_order_view.xml
index acac00d590a..a28dd281fa2 100644
--- a/addons/mrp/report/mrp_production_order_view.xml
+++ b/addons/mrp/report/mrp_production_order_view.xml
@@ -16,8 +16,8 @@
-
-
+