ORM: Better message when copying non-existing records
by: jvo@openerp.com In both cases, we end up with an exception. But it is better to know which model+id has failed. bzr revid: p_christ@hol.gr-20101116150047-xtyz8nrt6465ug2k
This commit is contained in:
parent
63d562de39
commit
4187facd9f
|
@ -4099,7 +4099,11 @@ class orm(orm_template):
|
|||
context_wo_lang = context.copy()
|
||||
if 'lang' in context:
|
||||
del context_wo_lang['lang']
|
||||
data = self.read(cr, uid, [id], context=context_wo_lang)[0]
|
||||
data = self.read(cr, uid, [id,], context=context_wo_lang)
|
||||
if data:
|
||||
data = data[0]
|
||||
else:
|
||||
raise IndexError( _("Record #%d of %s not found, cannot copy!") %( id, self._name))
|
||||
|
||||
fields = self.fields_get(cr, uid, context=context)
|
||||
for f in fields:
|
||||
|
|
Loading…
Reference in New Issue