openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #21412
[Bug 1099359] [NEW] [7.0] cannot create a manual field on res.users (probably reproducible on some other models)
Public bug reported:
Hi,
Reproducible on version 7.0 of OpenERP (runbot).
Steps to reproduce (see the attached screencast):
- Go to Settings > Technical > Database Structure > Models
- Locate the res.users model and edit it
- Add a new manual field
- Save the model
-> AssertionError: Invalid rec_name name for model res.users
The reason is that orm.BaseModel.__init__ assert that the defined
_rec_name is actually a column of the model.
# Validate rec_name
if self._rec_name is not None:
assert self._rec_name in self._columns.keys() + ['id'], "Invalid rec_name %s for model %s" % (self._rec_name, self._name)
else:
self._rec_name = 'name'
In the model res.users, there is no _rec_name explicitely defined, and
there isn't a 'name' column.
When the server starts, self._rec_name is None, so it does not check the
assert, but it assign 'name' to self._rec_name
On the creation of a new field, __init__ is called again on the model.
This time, self._rec_name is 'name', so it checks the assert which is
not valid as there isn't a 'name' column on res.users.
345 self.pool.get(vals['model']).__init__(self.pool, cr)
The server needs to be restarted because OpenERP becomes hazardous, it
searches for the new field but this latter has not been created:
ProgrammingError: column res_users.x_test does not exist
LINE 1: ...."password",res_users."partner_id",res_users."id",res_users....
This bug may happen on any model which has no 'name' column nor an
explicit _rec_name.
Full traceback:
Traceback (most recent call last):
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/netsvc.py", line 289, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/service/web_services.py", line 614, in dispatch
res = fn(db, uid, *params)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 169, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 123, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 179, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 166, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/addons/base/ir/ir_model.py", line 182, in write
return super(ir_model,self).write(cr, user, ids, vals, context)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/orm.py", line 4180, in write
result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/fields.py", line 548, in set
id_new = obj.create(cr, user, act[2], context=context)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/addons/base/ir/ir_model.py", line 345, in create
self.pool.get(vals['model']).__init__(self.pool, cr)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/addons/mail/res_users.py", line 51, in __init__
init_res = super(res_users, self).__init__(pool, cr)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/orm.py", line 1080, in __init__
assert self._rec_name in self._columns.keys() + ['id'], "Invalid rec_name %s for model %s" % (self._rec_name, self._name)
AssertionError: Invalid rec_name name for model res.users
** Affects: openobject-server
Importance: Undecided
Status: New
** Description changed:
Hi,
Reproducible on version 7.0 of OpenERP (runbot).
Steps to reproduce (see the attached screencast):
- - Go to Settings > Technical > Database Structure > Models
- - Locate the res.users model and edit it
- - Add a new manual field
- - Save the model
- -> AssertionError: Invalid rec_name name for model res.users
-
- Then
- openerp.sql_db: Programming error: column res_users.x_new_field does not exist
- LINE 1: ...id",res_users."login_date",res_users."company_id",res_users....
+ - Go to Settings > Technical > Database Structure > Models
+ - Locate the res.users model and edit it
+ - Add a new manual field
+ - Save the model
+ -> AssertionError: Invalid rec_name name for model res.users
The reason is that orm.BaseModel.__init__ assert that the defined
_rec_name is actually a column of the model.
- # Validate rec_name
- if self._rec_name is not None:
- assert self._rec_name in self._columns.keys() + ['id'], "Invalid rec_name %s for model %s" % (self._rec_name, self._name)
- else:
- self._rec_name = 'name'
+ # Validate rec_name
+ if self._rec_name is not None:
+ assert self._rec_name in self._columns.keys() + ['id'], "Invalid rec_name %s for model %s" % (self._rec_name, self._name)
+ else:
+ self._rec_name = 'name'
In the model res.users, there is no _rec_name explicitely defined, and
there isn't a 'name' column.
When the server starts, self._rec_name is None, so it does not check the
assert, but it assign 'name' to self._rec_name
On the creation of a new field, __init__ is called again on the model.
This time, self._rec_name is 'name', so it checks the assert which is
not valid as there isn't a 'name' column on res.users.
345 self.pool.get(vals['model']).__init__(self.pool, cr)
The server needs to be restarted because OpenERP becomes hazardous, it
searches for the new field but this latter has not been created:
ProgrammingError: column res_users.x_test does not exist
LINE 1: ...."password",res_users."partner_id",res_users."id",res_users....
This bug may happen on any model which has no 'name' column nor an
explicit _rec_name.
Full traceback:
Traceback (most recent call last):
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/netsvc.py", line 289, in dispatch_rpc
- result = ExportService.getService(service_name).dispatch(method, params)
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/service/web_services.py", line 614, in dispatch
- res = fn(db, uid, *params)
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 169, in execute_kw
- return self.execute(db, uid, obj, method, *args, **kw or {})
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 123, in wrapper
- return f(self, dbname, *args, **kwargs)
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 179, in execute
- res = self.execute_cr(cr, uid, obj, method, *args, **kw)
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 166, in execute_cr
- return getattr(object, method)(cr, uid, *args, **kw)
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/addons/base/ir/ir_model.py", line 182, in write
- return super(ir_model,self).write(cr, user, ids, vals, context)
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/orm.py", line 4180, in write
- result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/fields.py", line 548, in set
- id_new = obj.create(cr, user, act[2], context=context)
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/addons/base/ir/ir_model.py", line 345, in create
- self.pool.get(vals['model']).__init__(self.pool, cr)
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/addons/mail/res_users.py", line 51, in __init__
- init_res = super(res_users, self).__init__(pool, cr)
- File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/orm.py", line 1080, in __init__
- assert self._rec_name in self._columns.keys() + ['id'], "Invalid rec_name %s for model %s" % (self._rec_name, self._name)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/netsvc.py", line 289, in dispatch_rpc
+ result = ExportService.getService(service_name).dispatch(method, params)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/service/web_services.py", line 614, in dispatch
+ res = fn(db, uid, *params)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 169, in execute_kw
+ return self.execute(db, uid, obj, method, *args, **kw or {})
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 123, in wrapper
+ return f(self, dbname, *args, **kwargs)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 179, in execute
+ res = self.execute_cr(cr, uid, obj, method, *args, **kw)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 166, in execute_cr
+ return getattr(object, method)(cr, uid, *args, **kw)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/addons/base/ir/ir_model.py", line 182, in write
+ return super(ir_model,self).write(cr, user, ids, vals, context)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/orm.py", line 4180, in write
+ result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/fields.py", line 548, in set
+ id_new = obj.create(cr, user, act[2], context=context)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/addons/base/ir/ir_model.py", line 345, in create
+ self.pool.get(vals['model']).__init__(self.pool, cr)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/addons/mail/res_users.py", line 51, in __init__
+ init_res = super(res_users, self).__init__(pool, cr)
+ File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/orm.py", line 1080, in __init__
+ assert self._rec_name in self._columns.keys() + ['id'], "Invalid rec_name %s for model %s" % (self._rec_name, self._name)
AssertionError: Invalid rec_name name for model res.users
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1099359
Title:
[7.0] cannot create a manual field on res.users (probably reproducible
on some other models)
Status in OpenERP Server:
New
Bug description:
Hi,
Reproducible on version 7.0 of OpenERP (runbot).
Steps to reproduce (see the attached screencast):
- Go to Settings > Technical > Database Structure > Models
- Locate the res.users model and edit it
- Add a new manual field
- Save the model
-> AssertionError: Invalid rec_name name for model res.users
The reason is that orm.BaseModel.__init__ assert that the defined
_rec_name is actually a column of the model.
# Validate rec_name
if self._rec_name is not None:
assert self._rec_name in self._columns.keys() + ['id'], "Invalid rec_name %s for model %s" % (self._rec_name, self._name)
else:
self._rec_name = 'name'
In the model res.users, there is no _rec_name explicitely defined, and
there isn't a 'name' column.
When the server starts, self._rec_name is None, so it does not check
the assert, but it assign 'name' to self._rec_name
On the creation of a new field, __init__ is called again on the model.
This time, self._rec_name is 'name', so it checks the assert which is
not valid as there isn't a 'name' column on res.users.
345 self.pool.get(vals['model']).__init__(self.pool,
cr)
The server needs to be restarted because OpenERP becomes hazardous, it
searches for the new field but this latter has not been created:
ProgrammingError: column res_users.x_test does not exist
LINE 1: ...."password",res_users."partner_id",res_users."id",res_users....
This bug may happen on any model which has no 'name' column nor an
explicit _rec_name.
Full traceback:
Traceback (most recent call last):
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/netsvc.py", line 289, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/service/web_services.py", line 614, in dispatch
res = fn(db, uid, *params)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 169, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 123, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 179, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/osv.py", line 166, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/addons/base/ir/ir_model.py", line 182, in write
return super(ir_model,self).write(cr, user, ids, vals, context)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/orm.py", line 4180, in write
result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/fields.py", line 548, in set
id_new = obj.create(cr, user, act[2], context=context)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/addons/base/ir/ir_model.py", line 345, in create
self.pool.get(vals['model']).__init__(self.pool, cr)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/addons/mail/res_users.py", line 51, in __init__
init_res = super(res_users, self).__init__(pool, cr)
File "/home/gbaconnier/code/dev_instances/openerp_magento7/parts/server/openerp/osv/orm.py", line 1080, in __init__
assert self._rec_name in self._columns.keys() + ['id'], "Invalid rec_name %s for model %s" % (self._rec_name, self._name)
AssertionError: Invalid rec_name name for model res.users
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1099359/+subscriptions
Follow ups
References