diff --git a/addons/crm/__terp__.py b/addons/crm/__terp__.py
index bf14aab0eb6..26d80adaf68 100644
--- a/addons/crm/__terp__.py
+++ b/addons/crm/__terp__.py
@@ -66,7 +66,7 @@ between mails and Open ERP.""",
'wizard/crm_phonecall2phonecall.xml',
'wizard/phonecall2meeting.xml',
'wizard/phonecall2partner_view.xml',
- 'wizard/phonecall2opportunity.xml',
+ 'wizard/crm_phonecall_to_opportunity_view.xml',
'wizard/crm_opportunity_to_meeting_view.xml',
'wizard/crm_opportunity_to_phonecall_view.xml',
'crm_wizard.xml',
diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml
index 416e0802b92..1574b171c3c 100644
--- a/addons/crm/crm_phonecall_view.xml
+++ b/addons/crm/crm_phonecall_view.xml
@@ -86,7 +86,7 @@
icon="gtk-index" type="action"
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
-
diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py
index b477600af07..2e9ab90561b 100644
--- a/addons/crm/wizard/__init__.py
+++ b/addons/crm/wizard/__init__.py
@@ -34,7 +34,7 @@ import crm_opportunity_to_phonecall
import crm_phonecall2phonecall
import phonecall2partner
import phonecall2meeting
-import phonecall_to_opportunity
+import crm_phonecall_to_opportunity
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py
index 7829a02f3ab..ad798607991 100644
--- a/addons/crm/wizard/crm_lead_to_opportunity.py
+++ b/addons/crm/wizard/crm_lead_to_opportunity.py
@@ -65,34 +65,35 @@ class crm_lead2opportunity(osv.osv_memory):
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
if id3:
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
-
- for this in self.browse(cr, uid, ids, context=context):
+
lead = lead_obj.browse(cr, uid, record_id, context=context)
- new_opportunity_id = opp_obj.create(cr, uid, {
- 'name': this.name,
- 'planned_revenue': this.planned_revenue,
- 'probability': this.probability,
- 'partner_id': lead.partner_id and lead.partner_id.id or False ,
- 'section_id': lead.section_id and lead.section_id.id or False,
- 'description': lead.description or False,
- 'date_deadline': lead.date_deadline or False,
- 'partner_address_id': lead.partner_address_id and \
- lead.partner_address_id.id or False ,
- 'priority': lead.priority,
- 'phone': lead.phone,
- 'email_from': lead.email_from
- })
- new_opportunity = opp_obj.browse(cr, uid, new_opportunity_id)
- vals = {
- 'partner_id': this.partner_id and this.partner_id.id or False,
- }
- if not lead.opportunity_id:
- vals.update({'opportunity_id' : new_opportunity.id})
-
- lead_obj.write(cr, uid, [lead.id], vals)
- lead_obj.case_close(cr, uid, [lead.id])
- opp_obj.case_open(cr, uid, [new_opportunity_id])
+ for this in self.browse(cr, uid, ids, context=context):
+ new_opportunity_id = opp_obj.create(cr, uid, {
+ 'name': this.name,
+ 'planned_revenue': this.planned_revenue,
+ 'probability': this.probability,
+ 'partner_id': lead.partner_id and lead.partner_id.id or False ,
+ 'section_id': lead.section_id and lead.section_id.id or False,
+ 'description': lead.description or False,
+ 'date_deadline': lead.date_deadline or False,
+ 'partner_address_id': lead.partner_address_id and \
+ lead.partner_address_id.id or False ,
+ 'priority': lead.priority,
+ 'phone': lead.phone,
+ 'email_from': lead.email_from
+ })
+
+ new_opportunity = opp_obj.browse(cr, uid, new_opportunity_id)
+ vals = {
+ 'partner_id': this.partner_id and this.partner_id.id or False,
+ }
+ if not lead.opportunity_id:
+ vals.update({'opportunity_id' : new_opportunity.id})
+
+ lead_obj.write(cr, uid, [lead.id], vals)
+ lead_obj.case_close(cr, uid, [lead.id])
+ opp_obj.case_open(cr, uid, [new_opportunity_id])
value = {
'name': _('Opportunity'),
diff --git a/addons/crm/wizard/crm_opportunity_to_meeting.py b/addons/crm/wizard/crm_opportunity_to_meeting.py
index 9162edf28ff..2af7ddc8e35 100644
--- a/addons/crm/wizard/crm_opportunity_to_meeting.py
+++ b/addons/crm/wizard/crm_opportunity_to_meeting.py
@@ -68,7 +68,6 @@ class crm_opportunity2meeting(osv.osv_memory):
if id3:
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
- for this in self.browse(cr, uid, ids, context=context):
opp = opp_obj.browse(cr, uid, record_id, context=context)
context = {
'default_opportunity_id': opp.id,
diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall.py b/addons/crm/wizard/crm_opportunity_to_phonecall.py
index 359ae594320..f816f51a89b 100644
--- a/addons/crm/wizard/crm_opportunity_to_phonecall.py
+++ b/addons/crm/wizard/crm_opportunity_to_phonecall.py
@@ -23,6 +23,8 @@ from osv import osv, fields
from tools.translate import _
class crm_opportunity2phonecall(osv.osv_memory):
+ """Converts Opportunity to Phonecall"""
+
_name = 'crm.opportunity2phonecall'
_description = 'Opportunity to Phonecall'
@@ -85,8 +87,11 @@ class crm_opportunity2phonecall(osv.osv_memory):
result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
- # Select the view
data_obj = self.pool.get('ir.model.data')
+ categ_id = mod_obj._get_id(cr, uid, 'crm', 'categ_phone1')
+ categ_id = data_obj.browse(cr, uid, categ_id, context=context).res_id
+
+ # Select the view
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view')
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
if id2:
@@ -100,7 +105,7 @@ class crm_opportunity2phonecall(osv.osv_memory):
'name' : opp.name,
'case_id' : opp.id ,
'user_id' : this.user_id and this.user_id.id or False,
- 'categ_id' : opp.categ_id and opp.categ_id.id or False,
+ 'categ_id' : categ_id,
'description' : opp.description or False,
'date' : this.date,
'section_id' : opp.section_id and opp.section_id.id or False,
diff --git a/addons/crm/wizard/crm_phonecall2phonecall.py b/addons/crm/wizard/crm_phonecall2phonecall.py
index 557b5da71f5..60c05e3d6ed 100644
--- a/addons/crm/wizard/crm_phonecall2phonecall.py
+++ b/addons/crm/wizard/crm_phonecall2phonecall.py
@@ -1,88 +1,131 @@
-# -*- encoding: utf-8 -*-
-############################################################################################
+# -*- coding: utf-8 -*-
+##############################################################################
#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
-# Copyright (C) 2008-2009 AJM Technologies S.A. ().
#
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
#
-############################################################################################
-############################################################################################
+##############################################################################
from osv import osv, fields
-import netsvc
-import time
-import tools
-import mx.DateTime
-from tools import config
from tools.translate import _
-import tools
class crm_phonecall2phonecall(osv.osv_memory):
+ """ Converts Phonecall to Phonecall"""
+
_name = 'crm.phonecall2phonecall'
_description = 'Phonecall To Phonecall'
def action_cancel(self, cr, uid, ids, context=None):
+ """
+ Closes Phonecall to Phonecall 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 Phonecall's IDs
+ @param context: A standard dictionary for contextual values
+ """
return {'type':'ir.actions.act_window_close'}
def action_apply(self, cr, uid, ids, context=None):
- this = self.browse(cr, uid, ids)[0]
- values={}
- record_id = context and context.get('record_id', False) or False
+ """
+ This converts Phonecall to Phonecall 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 Phonecall IDs
+ @param context: A standard dictionary for contextual values
+
+ @return : Dictionary value for created Opportunity form
+ """
+ res = {}
+ record_id = context and context.get('active_id', False) or False
+ phonecall_obj = self.pool.get('crm.phonecall')
+
if record_id:
- for case in self.pool.get('crm.phonecall').browse(cr, uid, [record_id], context=context):
- values['name']=this.name
- values['user_id']=this.user_id and this.user_id.id
- values['categ_id']=case.categ_id and case.categ_id.id or False
- values['section_id']=case.section_id and case.section_id.id
- values['description']=case.description or ''
- values['partner_id']=case.partner_id.id
- values['partner_address_id']=case.partner_address_id.id
- values['partner_mobile']=case.partner_mobile or False
- values['priority']=case.priority
- values['partner_phone']=case.partner_phone or False
- values['date']=this.date
- phonecall_proxy = self.pool.get('crm.phonecall')
- phonecall_id = phonecall_proxy.create(cr, uid, values, context=context)
- value = {
+ data_obj = self.pool.get('ir.model.data')
+
+ # Get Phonecall views
+ result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
+ res = data_obj.read(cr, uid, result, ['res_id'])
+ id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
+ id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view')
+ if id2:
+ id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+ if id3:
+ id3 = data_obj.browse(cr, uid, id3, context=context).res_id
+
+ phonecall = phonecall_obj.browse(cr, uid, record_id, context=context)
+
+ for this in self.browse(cr, uid, ids, context=context):
+ values = {
+ 'name': this.name,
+ 'user_id': this.user_id and this.user_id.id,
+ 'categ_id': phonecall.categ_id and phonecall.categ_id.id or False,
+ 'section_id': phonecall.section_id and phonecall.section_id.id,
+ 'description': phonecall.description or '',
+ 'partner_id': phonecall.partner_id.id,
+ 'partner_address_id': phonecall.partner_address_id.id,
+ 'partner_mobile': phonecall.partner_mobile or False,
+ 'priority': phonecall.priority,
+ 'partner_phone': phonecall.partner_phone or False,
+ 'date': this.date
+ }
+ phonecall_id = phonecall_obj.create(cr, uid, values, context=context)
+ print phonecall_id
+ res = {
'name': _('Phone Call'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'crm.phonecall',
'view_id': False,
+ 'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
'type': 'ir.actions.act_window',
'res_id': phonecall_id
}
- return value
+ return res
_columns = {
- 'name' : fields.char('Call summary', size=64, required=True, select=1),
- 'user_id' : fields.many2one('res.users',"Assign To"),
- 'date': fields.datetime('Date'),
- 'section_id':fields.many2one('crm.case.section','Sales Team'),
-
- }
+ 'name' : fields.char('Call summary', size=64, required=True, select=1),
+ 'user_id' : fields.many2one('res.users',"Assign To"),
+ 'date': fields.datetime('Date'),
+ 'section_id':fields.many2one('crm.case.section','Sales Team'),
+ }
+
def default_get(self, cr, uid, fields, context=None):
- record_id = context and context.get('record_id', False) or False
- res = super(crm_phonecall2phonecall, self).default_get(cr, uid, fields, context=context)
+ """
+ This function gets default values
+ @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
+
+ @return : default values of fields.
+ """
+ record_id = context and context.get('active_id', False) or False
if record_id:
- phonecall_id = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
- res['name']=phonecall_id.name
- res['user_id']=phonecall_id.user_id and phonecall_id.user_id.id or False
- res['date']=phonecall_id.date
- res['section_id']=phonecall_id.section_id and phonecall_id.section_id.id or False
+ phonecall = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
+ res = {
+ 'name': phonecall.name,
+ 'user_id': phonecall.user_id and phonecall.user_id.id or False,
+ 'date': phonecall.date,
+ 'section_id': phonecall.section_id and phonecall.section_id.id or False
+ }
return res
-crm_phonecall2phonecall()
\ No newline at end of file
+
+crm_phonecall2phonecall()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/wizard/crm_phonecall2phonecall.xml b/addons/crm/wizard/crm_phonecall2phonecall.xml
index b4911e48b15..cdc673d0e65 100644
--- a/addons/crm/wizard/crm_phonecall2phonecall.xml
+++ b/addons/crm/wizard/crm_phonecall2phonecall.xml
@@ -1,23 +1,31 @@
+
+
+
crm.phonecall2phonecall.form
crm.phonecall2phonecall
form
-
+
+
+
Schedule Other Call
crm.phonecall2phonecall
@@ -25,7 +33,7 @@
form
new
- {'record_id' : active_id}
+
\ No newline at end of file
diff --git a/addons/crm/wizard/crm_phonecall_to_opportunity.py b/addons/crm/wizard/crm_phonecall_to_opportunity.py
new file mode 100644
index 00000000000..b18e02270ad
--- /dev/null
+++ b/addons/crm/wizard/crm_phonecall_to_opportunity.py
@@ -0,0 +1,135 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+from osv import osv, fields
+from tools.translate import _
+
+class crm_phonecall2opportunity(osv.osv_memory):
+ """ Converts Phonecall to Opportunity"""
+
+ _name = 'crm.phonecall2opportunity'
+ _description = 'Phonecall To Opportunity'
+
+ 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 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:
+ opp_obj = self.pool.get('crm.opportunity')
+ phonecall_obj = self.pool.get('crm.phonecall')
+ 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"))
+ else:
+ data_obj = self.pool.get('ir.model.data')
+ result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
+ res = data_obj.read(cr, uid, result, ['res_id'])
+ id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_oppor')
+ id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_oppor')
+ if id2:
+ id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+ if id3:
+ id3 = data_obj.browse(cr, uid, id3, context=context).res_id
+
+ for this in self.browse(cr, uid, ids, context=context):
+ new_opportunity_id = opp_obj.create(cr, uid, {
+ 'name': this.name,
+ 'planned_revenue': this.planned_revenue,
+ 'probability': this.probability,
+ 'partner_id': this.partner_id and this.partner_id.id or False,
+ 'section_id': case.section_id and case.section_id.id or False,
+ 'description': case.description or False,
+ 'phonecall_id': case.id,
+ 'priority': case.priority,
+ 'phone': case.partner_phone or False,
+ })
+ new_opportunity = opp_obj.browse(cr, uid, new_opportunity_id)
+ vals = {
+ 'partner_id': this.partner_id.id,
+ 'opportunity_id' : new_opportunity_id,
+ }
+ phonecall_obj.write(cr, uid, [case.id], vals)
+ phonecall_obj.case_close(cr, uid, [case.id])
+ opp_obj.case_open(cr, uid, [new_opportunity_id])
+
+ value = {
+ 'name': _('Opportunity'),
+ 'view_type': 'form',
+ 'view_mode': 'form,tree',
+ 'res_model': 'crm.opportunity',
+ 'res_id': int(new_opportunity_id),
+ 'view_id': False,
+ 'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': res['res_id']
+ }
+ return value
+
+ _columns = {
+ 'name' : fields.char('Opportunity Summary', size=64, required=True, select=1),
+ 'probability': fields.float('Success Probability'),
+ 'planned_revenue': fields.float('Expected Revenue'),
+ 'partner_id': fields.many2one('res.partner', 'Partner'),
+ }
+
+ def default_get(self, cr, uid, fields, context=None):
+ """
+ This function gets default values
+ @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
+
+ @return : default values of fields.
+ """
+ record_id = context and context.get('active_id', False) or False
+ if record_id:
+ phonecall = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
+ res = {
+ 'name': phonecall.name,
+ 'partner_id': phonecall.partner_id and phonecall.partner_id.id or False
+ }
+ return res
+
+crm_phonecall2opportunity()
diff --git a/addons/crm/wizard/phonecall2opportunity.xml b/addons/crm/wizard/crm_phonecall_to_opportunity_view.xml
similarity index 78%
rename from addons/crm/wizard/phonecall2opportunity.xml
rename to addons/crm/wizard/crm_phonecall_to_opportunity_view.xml
index 607db601433..ea024831b54 100644
--- a/addons/crm/wizard/phonecall2opportunity.xml
+++ b/addons/crm/wizard/crm_phonecall_to_opportunity_view.xml
@@ -1,24 +1,32 @@
+
+
+
crm.phonecall2opportunity.form
crm.phonecall2opportunity
form
-
+
+
+
Convert To Opportunity
crm.phonecall2opportunity
@@ -26,7 +34,7 @@
form
new
- {'record_id' : active_id}
+
\ No newline at end of file
diff --git a/addons/crm/wizard/phonecall_to_opportunity.py b/addons/crm/wizard/phonecall_to_opportunity.py
deleted file mode 100644
index f2cd3897fa6..00000000000
--- a/addons/crm/wizard/phonecall_to_opportunity.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# -*- encoding: utf-8 -*-
-############################################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
-# Copyright (C) 2008-2009 AJM Technologies S.A. (.
-#
-############################################################################################
-############################################################################################
-
-from osv import osv, fields
-import netsvc
-import time
-import tools
-import mx.DateTime
-from tools import config
-from tools.translate import _
-import tools
-
-class crm_phonecall2opportunity(osv.osv_memory):
- _name = 'crm.phonecall2opportunity'
- _description = 'Phonecall To Opportunity'
-
- def action_cancel(self, cr, uid, ids, context=None):
- return {'type':'ir.actions.act_window_close'}
-
- def action_apply(self, cr, uid, ids, context=None):
- this = self.browse(cr, uid, ids[0], context=context)
- record_id = context and context.get('record_id', False) or False
- if record_id:
- for case in self.pool.get('crm.phonecall').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"))
- else:
- data_obj = self.pool.get('ir.model.data')
- result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
- res = data_obj.read(cr, uid, result, ['res_id'])
- id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_oppor')
- id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_oppor')
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
- if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
- opportunity_case_obj = self.pool.get('crm.opportunity')
- phonecall_case_obj = self.pool.get('crm.phonecall')
-
- new_opportunity_id = opportunity_case_obj.create(cr, uid, {
- 'name': this.name,
- 'planned_revenue': this.planned_revenue,
- 'probability': this.probability,
- 'partner_id': this.partner_id and this.partner_id.id or False,
- 'section_id': case.section_id and case.section_id.id or False,
- 'description': case.description or False,
- 'phonecall_id': case.id,
- 'priority': case.priority,
- 'phone': case.partner_phone or False,
- })
- new_opportunity = opportunity_case_obj.browse(cr, uid, new_opportunity_id)
- vals = {
- 'partner_id': this.partner_id.id,
- 'opportunity_id' : new_opportunity_id,
- }
- phonecall_case_obj.write(cr, uid, [case.id], vals)
- phonecall_case_obj.case_close(cr, uid, [case.id])
- phonecall_case_obj.case_open(cr, uid, [new_opportunity_id])
- value = {
- 'name': _('Opportunity'),
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'res_model': 'crm.opportunity',
- 'res_id': int(new_opportunity_id),
- 'view_id': False,
- 'views': [(id2,'form'),(id3,'tree'),(False,'calendar'),(False,'graph')],
- 'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
- }
- return value
- _columns = {
- 'name' : fields.char('Opportunity Summary', size=64, required=True, select=1),
- 'probability': fields.float('Success Probability'),
- 'planned_revenue': fields.float('Expected Revenue'),
- 'partner_id': fields.many2one('res.partner', 'Partner'),
- }
- def default_get(self, cr, uid, fields, context=None):
- record_id = context and context.get('record_id', False) or False
- res = super(crm_phonecall2opportunity, self).default_get(cr, uid, fields, context=context)
- if record_id:
- phonecall_id = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
- res['name']=phonecall_id.name
- res['partner_id']=phonecall_id.partner_id and phonecall_id.partner_id.id
- return res
-crm_phonecall2opportunity()
\ No newline at end of file