diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py
index 1ee36cefab2..fa32c1b28b1 100644
--- a/addons/crm/crm_phonecall.py
+++ b/addons/crm/crm_phonecall.py
@@ -53,7 +53,7 @@ class crm_phonecall(crm_case, osv.osv):
('draft', 'Draft'),
('open', 'Todo'),
('cancel', 'Cancelled'),
- ('done', 'Done'),
+ ('done', 'Held'),
('pending', 'Pending'),
], 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
@@ -79,14 +79,19 @@ class crm_phonecall(crm_case, osv.osv):
the canall which is this opportunity source."),
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
- 'opportunity_id': fields.many2one ('crm.lead', 'Opportunity'),
+ 'opportunity_id': fields.many2one ('crm.lead', 'Lead/Opportunity'),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
+ def _get_default_state(self, cr, uid, context=None):
+ if context and context.get('default_state', False):
+ return context.get('default_state')
+ return 'open'
+
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'priority': crm.AVAILABLE_PRIORITIES[2][0],
- 'state': 'open',
+ 'state': _get_default_state,
'user_id': lambda self,cr,uid,ctx: uid,
'active': 1,
}
diff --git a/addons/crm/crm_phonecall_demo.xml b/addons/crm/crm_phonecall_demo.xml
index 683cbd9735f..8f0661ab8be 100644
--- a/addons/crm/crm_phonecall_demo.xml
+++ b/addons/crm/crm_phonecall_demo.xml
@@ -18,6 +18,7 @@
+
@@ -33,6 +34,7 @@
+
@@ -49,6 +51,7 @@
+
diff --git a/addons/crm/crm_phonecall_menu.xml b/addons/crm/crm_phonecall_menu.xml
index 41975d9ced4..c3d7e1d8df6 100644
--- a/addons/crm/crm_phonecall_menu.xml
+++ b/addons/crm/crm_phonecall_menu.xml
@@ -61,15 +61,15 @@
parent="base.menu_base_partner" sequence="4" />
- Inbound
+ Log a callcrm.phonecallformtree,calendar
-
-
-
+
+ [('state','=','done')]
+
- The Inbound Calls tool allows you to log your inbound calls on the fly. Each call you get will appear on the partner form to trace every contact you have with a partner. From the phone call form, you can trigger a request for another call, a meeting or an opportunity.
+ This tool allows you to log your inbound calls on the fly. Each call you get will appear on the partner form to trace every contact you have with a partner. From the phone call form, you can trigger a request for another call, a meeting or an opportunity.
@@ -90,24 +90,24 @@
form
-
+
-
- Outbound
+ Schedule a callcrm.phonecallformtree,calendar
-
-
+ [('state','!=','done')]
+
- Outbound Calls list all the calls to be done by your sales team. A salesman can record the information about the call in the form view. This information will be stored in the partner form to trace every contact you have with a customer. You can also import a .CSV file with a list of calls to be done by your sales team.
+ Schedule a call lists all the calls to be done by your sales team. A salesman can record the information about the call in the form view. This information will be stored in the partner form to trace every contact you have with a customer. You can also import a .CSV file with a list of calls to be done by your sales team.
@@ -131,7 +131,7 @@
-
diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml
index 44487e2aef5..9ef661e5eb9 100644
--- a/addons/crm/crm_phonecall_view.xml
+++ b/addons/crm/crm_phonecall_view.xml
@@ -31,7 +31,7 @@
-
+
-
+
@@ -61,7 +61,7 @@
-
+
@@ -70,7 +70,7 @@
+ attrs="{'invisible':['|', ('opportunity_id','!=',False), ('state','=','done')]}" />
@@ -111,7 +110,7 @@
-
-
-
-
- CRM - Inbound Phone Call Form
- crm.phonecall
- form
-
-
-
-
-
-
+
- CRM - Inbound Phone Calls Tree
+ CRM - Logged Phone Calls Treecrm.phonecalltree
-
+
+ domain="[('object_id.model', '=', 'crm.phonecall')]"/>
-
diff --git a/addons/crm/report/crm_phonecall_report.py b/addons/crm/report/crm_phonecall_report.py
index 92221068e25..f68bea03880 100644
--- a/addons/crm/report/crm_phonecall_report.py
+++ b/addons/crm/report/crm_phonecall_report.py
@@ -25,9 +25,9 @@ from crm import crm
AVAILABLE_STATES = [
('draft','Draft'),
- ('open','Open'),
+ ('open','Todo'),
('cancel', 'Cancelled'),
- ('done', 'Closed'),
+ ('done', 'Held'),
('pending','Pending')
]
diff --git a/addons/crm/report/crm_phonecall_report_view.xml b/addons/crm/report/crm_phonecall_report_view.xml
index bc2ce828f5e..acc91cbef41 100644
--- a/addons/crm/report/crm_phonecall_report_view.xml
+++ b/addons/crm/report/crm_phonecall_report_view.xml
@@ -108,7 +108,7 @@
-
diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml
index 9df185ae831..659ef075b7f 100644
--- a/addons/crm/res_partner_view.xml
+++ b/addons/crm/res_partner_view.xml
@@ -54,82 +54,14 @@
-
+
-
+
-
-
diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall.py b/addons/crm/wizard/crm_opportunity_to_phonecall.py
index 8fc7ffb310d..7b1938deadf 100644
--- a/addons/crm/wizard/crm_opportunity_to_phonecall.py
+++ b/addons/crm/wizard/crm_opportunity_to_phonecall.py
@@ -33,9 +33,10 @@ class crm_opportunity2phonecall(osv.osv_memory):
'user_id' : fields.many2one('res.users', "Assign To"),
'date': fields.datetime('Date' , required=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
- 'categ_id': fields.many2one('crm.case.categ', 'Category', required=True, \
+ 'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="['|',('section_id','=',False),('section_id','=',section_id),\
- ('object_id.model', '=', 'crm.phonecall')]"),
+ ('object_id.model', '=', 'crm.phonecall')]"),
+ 'action': fields.selection([('schedule','Schedule a call'), ('log','Log a call')], 'Action', required=True),
}
def default_get(self, cr, uid, fields, context=None):
@@ -58,6 +59,7 @@ class crm_opportunity2phonecall(osv.osv_memory):
record_ids = context and context.get('active_ids', []) or []
res = super(crm_opportunity2phonecall, self).default_get(cr, uid, fields, context=context)
+ res.update({'action': 'schedule'})
for opp in opp_obj.browse(cr, uid, record_ids, context=context):
if 'name' in fields:
res.update({'name': opp.name})
@@ -112,7 +114,7 @@ class crm_opportunity2phonecall(osv.osv_memory):
for this in self.browse(cr, uid, ids, context=context):
for opp in opp_obj.browse(cr, uid, record_ids, context=context):
- new_case = phonecall_obj.create(cr, uid, {
+ vals = {
'name' : opp.name,
'case_id' : opp.id ,
'user_id' : this.user_id and this.user_id.id or False,
@@ -126,9 +128,12 @@ class crm_opportunity2phonecall(osv.osv_memory):
'partner_mobile' : opp.partner_address_id and opp.partner_address_id.mobile or False,
'priority': opp.priority,
'opportunity_id': opp.id
- }, context=context)
-
- phonecall_obj.case_open(cr, uid, [new_case])
+ }
+ new_case = phonecall_obj.create(cr, uid, vals, context=context)
+ if this.action == 'schedule':
+ phonecall_obj.case_open(cr, uid, [new_case])
+ elif this.action == 'log':
+ phonecall_obj.case_close(cr, uid, [new_case])
value = {
'name': _('Phone Call'),
diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml b/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml
index 23ddaad5bfe..91ca297ecc1 100644
--- a/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml
+++ b/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml
@@ -9,8 +9,10 @@
crm.opportunity2phonecallform
-
@@ -30,7 +32,7 @@
- Schedule Call
+ Schedule/Log Callcrm.opportunity2phonecallformform
diff --git a/addons/crm/wizard/crm_phonecall_to_phonecall.py b/addons/crm/wizard/crm_phonecall_to_phonecall.py
index aaba8e082c5..b83e650d443 100644
--- a/addons/crm/wizard/crm_phonecall_to_phonecall.py
+++ b/addons/crm/wizard/crm_phonecall_to_phonecall.py
@@ -84,6 +84,10 @@ class crm_phonecall2phonecall(osv.osv_memory):
'date': this.date
}
phonecall_id = phonecall_obj.create(cr, uid, values, context=context)
+ if this.action == 'schedule':
+ phonecall_obj.case_open(cr, uid, [phonecall_id])
+ elif this.action == 'log':
+ phonecall_obj.case_close(cr, uid, [phonecall_id])
res = {
'name': _('Phone Call'),
@@ -102,11 +106,12 @@ class crm_phonecall2phonecall(osv.osv_memory):
_columns = {
'name' : fields.char('Call summary', size=64, required=True, select=1),
'user_id' : fields.many2one('res.users',"Assign To"),
- 'categ_id': fields.many2one('crm.case.categ', 'Category', required=True, \
+ 'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="['|',('section_id','=',False),('section_id','=',section_id),\
('object_id.model', '=', 'crm.phonecall')]"),
'date': fields.datetime('Date', required=True),
'section_id':fields.many2one('crm.case.section','Sales Team'),
+ 'action': fields.selection([('schedule','Schedule a call'), ('log','Log a call')], 'Action', required=True),
}
def default_get(self, cr, uid, fields, context=None):
@@ -122,7 +127,7 @@ class crm_phonecall2phonecall(osv.osv_memory):
"""
res = super(crm_phonecall2phonecall, self).default_get(cr, uid, fields, context=context)
record_id = context and context.get('active_id', False) or False
-
+ res.update({'action': 'schedule'})
if record_id:
phonecall = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
diff --git a/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml b/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml
index 34a0d2c158e..ea16d27a9cc 100644
--- a/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml
+++ b/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml
@@ -9,8 +9,10 @@
crm.phonecall2phonecallform
-