diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index d0fafbf1cf4..e0d609a43dd 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -331,8 +331,6 @@ class crm_case(object):
if not case.user_id:
data['user_id'] = uid
self.write(cr, uid, case.id, data)
-
-
self._action(cr, uid, cases, 'open')
return True
@@ -423,11 +421,14 @@ class crm_case(object):
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
+ state = 'draft'
+ if 'crm.phonecall' in args:
+ state = 'open'
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self._history(cr, uid, cases, _('Draft'))
- self.write(cr, uid, ids, {'state': 'draft', 'active': True})
- self._action(cr, uid, cases, 'draft')
+ self.write(cr, uid, ids, {'state': state, 'active': True})
+ self._action(cr, uid, cases, state)
return True
def remind_partner(self, cr, uid, ids, context=None, attach=False):
diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py
index fa32c1b28b1..4ace2163c2e 100644
--- a/addons/crm/crm_phonecall.py
+++ b/addons/crm/crm_phonecall.py
@@ -54,9 +54,9 @@ class crm_phonecall(crm_case, osv.osv):
('open', 'Todo'),
('cancel', 'Cancelled'),
('done', 'Held'),
- ('pending', 'Pending'),
+ ('pending', 'Not Held'),
], 'State', size=16, readonly=True,
- help='The state is set to \'Draft\', when a case is created.\
+ help='The state is set to \'Todo\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
@@ -126,14 +126,14 @@ class crm_phonecall(crm_case, osv.osv):
return res
def case_reset(self, cr, uid, ids, *args):
- """Resets case as draft
+ """Resets case as Todo
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
- res = super(crm_phonecall, self).case_reset(cr, uid, ids, args)
+ res = super(crm_phonecall, self).case_reset(cr, uid, ids, args, 'crm.phonecall')
self.write(cr, uid, ids, {'duration': 0.0})
return res
diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml
index ee732c62f9c..2490526bb0e 100644
--- a/addons/crm/crm_phonecall_view.xml
+++ b/addons/crm/crm_phonecall_view.xml
@@ -35,16 +35,16 @@
-
-
-
+
+
+
@@ -67,15 +67,15 @@
-
-
+
+
@@ -108,17 +108,17 @@
-
@@ -183,7 +183,7 @@
+ domain="[('state','in', ('open','pending'))]"/>
crm.opportunity2phonecall
form
-
diff --git a/addons/crm/wizard/crm_phonecall_to_opportunity.py b/addons/crm/wizard/crm_phonecall_to_opportunity.py
index 98e3c978eb0..549afa0559b 100644
--- a/addons/crm/wizard/crm_phonecall_to_opportunity.py
+++ b/addons/crm/wizard/crm_phonecall_to_opportunity.py
@@ -31,43 +31,14 @@ class crm_phonecall2opportunity(osv.osv_memory):
def action_cancel(self, cr, uid, ids, context=None):
"""
Closes Phonecall to Opportunity form
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Phonecall to Opportunity's IDs
- @param context: A standard dictionary for contextual values
"""
return {'type':'ir.actions.act_window_close'}
- def view_init(self, cr, uid, fields, context=None):
- """
- This function checks for precondition before wizard executes
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param fields: List of fields for default value
- @param context: A standard dictionary for contextual values
-
- """
- phonecall_obj = self.pool.get('crm.phonecall')
- record_id = context and context.get('active_id', False) or False
- case = phonecall_obj.browse(cr, uid, record_id, context=context)
- if case.state in ['done', 'cancel']:
- raise osv.except_osv(_("Warning"), _("Closed/Cancelled Phone \
-Call Could not convert into Opportunity"))
-
def action_apply(self, cr, uid, ids, context=None):
"""
This converts Phonecall to Opportunity and opens Phonecall view
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Phonecall to Opportunity IDs
- @param context: A standard dictionary for contextual values
-
- @return : Dictionary value for created Opportunity form
"""
record_id = context and context.get('active_id', False) or False
if record_id:
diff --git a/addons/crm/wizard/crm_phonecall_to_phonecall.py b/addons/crm/wizard/crm_phonecall_to_phonecall.py
index 3064d934ff3..2872acad4eb 100644
--- a/addons/crm/wizard/crm_phonecall_to_phonecall.py
+++ b/addons/crm/wizard/crm_phonecall_to_phonecall.py
@@ -114,6 +114,7 @@ class crm_phonecall2phonecall(osv.osv_memory):
'date': fields.datetime('Date'),
'section_id':fields.many2one('crm.case.section','Sales Team'),
'action': fields.selection([('schedule','Schedule a call'), ('log','Log a call')], 'Action', required=True),
+ 'partner_id' : fields.many2one('res.partner', "Partner"),
}
def default_get(self, cr, uid, fields, context=None):
@@ -149,6 +150,8 @@ class crm_phonecall2phonecall(osv.osv_memory):
res.update({'section_id': phonecall.section_id and phonecall.section_id.id or False})
if 'categ_id' in fields:
res.update({'categ_id': categ_id})
+ if 'partner_id' in fields:
+ res.update({'partner_id': phonecall.partner_id and phonecall.partner_id.id or False})
return res
crm_phonecall2phonecall()
diff --git a/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml b/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml
index feda63ee1e2..1fa97a20602 100644
--- a/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml
+++ b/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml
@@ -9,20 +9,21 @@
crm.phonecall2phonecallform
-