[FIX]crm: several calls to _get_id for external id 'categ_phone2' which were not surrounded by try except ValueError

bzr revid: dle@openerp.com-20131114095721-v22dl5yc8bzhvevf
This commit is contained in:
Denis Ledoux 2013-11-14 10:57:21 +01:00
parent 99ffbd28ed
commit 8be0a5a8e1
4 changed files with 16 additions and 8 deletions

View File

@ -836,9 +836,11 @@ class crm_lead(base_stage, format_address, osv.osv):
model_data = self.pool.get('ir.model.data')
phonecall_dict = {}
if not categ_id:
res_id = model_data._get_id(cr, uid, 'crm', 'categ_phone2')
if res_id:
try:
res_id = model_data._get_id(cr, uid, 'crm', 'categ_phone2')
categ_id = model_data.browse(cr, uid, res_id, context=context).res_id
except ValueError:
pass
for lead in self.browse(cr, uid, ids, context=context):
if not section_id:
section_id = lead.section_id and lead.section_id.id or False

View File

@ -111,9 +111,11 @@ class crm_phonecall(base_state, osv.osv):
model_data = self.pool.get('ir.model.data')
phonecall_dict = {}
if not categ_id:
res_id = model_data._get_id(cr, uid, 'crm', 'categ_phone2')
if res_id:
try:
res_id = model_data._get_id(cr, uid, 'crm', 'categ_phone2')
categ_id = model_data.browse(cr, uid, res_id, context=context).res_id
except ValueError:
pass
for call in self.browse(cr, uid, ids, context=context):
if not section_id:
section_id = call.section_id and call.section_id.id or False

View File

@ -34,9 +34,11 @@ class crm_opportunity2phonecall(osv.osv_memory):
opp_obj = self.pool.get('crm.lead')
categ_id = False
data_obj = self.pool.get('ir.model.data')
res_id = data_obj._get_id(cr, uid, 'crm', 'categ_phone2')
if res_id:
try:
res_id = data_obj._get_id(cr, uid, 'crm', 'categ_phone2')
categ_id = data_obj.browse(cr, uid, res_id, context=context).res_id
except ValueError:
pass
record_ids = context and context.get('active_ids', []) or []
res = {}

View File

@ -78,9 +78,11 @@ class crm_phonecall2phonecall(osv.osv_memory):
categ_id = False
data_obj = self.pool.get('ir.model.data')
res_id = data_obj._get_id(cr, uid, 'crm', 'categ_phone2')
if res_id:
try:
res_id = data_obj._get_id(cr, uid, 'crm', 'categ_phone2')
categ_id = data_obj.browse(cr, uid, res_id, context=context).res_id
except ValueError:
pass
if 'name' in fields:
res.update({'name': phonecall.name})