Bugfix : Record creation on databse views(ref : views used for dashboard).

bzr revid: jvo@tinyerp.com-20090101133956-le2wjye1tx1g1j1e
This commit is contained in:
Jay (Open ERP) 2009-01-01 19:09:56 +05:30
parent ffd4dda0db
commit 54508a24bc
1 changed files with 9 additions and 2 deletions

View File

@ -2334,8 +2334,15 @@ class orm(orm_template):
(table, col, col_detail) = self._inherit_fields[v]
tocreate[table][v] = vals[v]
del vals[v]
cr.execute("SELECT nextval('"+self._sequence+"')")
# Try-except added to filter the creation of those records whose filds are readonly.
# Example : any dashboard which has all the fields readonly.(due to Views(database views))
try:
cr.execute("SELECT nextval('"+self._sequence+"')")
except:
raise except_orm(_('UserError'),
_('You cannot perform this operation.'))
id_new = cr.fetchone()[0]
for table in tocreate:
id = self.pool.get(table).create(cr, user, tocreate[table])