c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #07944
[Bug 475621] Re: error trying to add column to class users(osv.osv)
I would like to play down the importance of this "bug". Some tables like "res.users", "res.company" etc. are supposed to be called nearly at each ORM call, and therefore must be pre-initialized.
Try to avoid adding columns in them, it is also a performance issue.
I remember we have these 'property' fields, couldn't we use them
instead, for the functionality you describe?
Note that this bug is mostly mitigated in pg84, by the fact that
browse() doesn't fetch all columns by default.
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/475621
Title:
error trying to add column to class users(osv.osv)
Status in OpenObject Server:
Confirmed
Bug description:
trying to implement
https://blueprints.launchpad.net/openobject-addons/+spec/accounting-period-jail
adding this code to account/account.py
class users(osv.osv):
_name = 'res.users'
_inherit = 'res.users'
_columns = {
'period_id': fields.many2one('account.period', 'Period Accounting', help='Jail for accounting date entry'),
}
users()
causes this error - the period_id s not added.
[2009-11-05 18:00:09,054] INFO:init:module account: creating or updating database tables
[2009-11-05 18:00:09,858] DEBUG:sql:bad query: SELECT "menu_id","address_id","period_id","active","context_lang","password","context_tz","name","company_id","signature","login","action_id",id FROM "res_users" WHERE id IN (1) ORDER BY id
[2009-11-05 18:00:09,859] DEBUG:sql:[01]: column "period_id" does not exist
[2009-11-05 18:00:09,860] DEBUG:sql:[02]: LINE 1: SELECT "menu_id","address_id","period_id","active","context_...
[2009-11-05 18:00:09,860] DEBUG:sql:[03]: ^
Traceback (most recent call last):
File "./openerp-server.py", line 111, in <module>
pooler.get_db_and_pool(db, update_module=tools.config['init'] or tools.config['update'])
File "/home/terp/OpenERP/branch/server/5.0/bin/pooler.py", line 40, in get_db_and_pool
addons.load_modules(db, force_demo, status, update_module)
File "/home/terp/OpenERP/branch/server/5.0/bin/addons/__init__.py", line 728, in load_modules
r = load_module_graph(cr, graph, status, report=report)
File "/home/terp/OpenERP/branch/server/5.0/bin/addons/__init__.py", line 581, in load_module_graph
init_module_objects(cr, package.name, modules)
File "/home/terp/OpenERP/branch/server/5.0/bin/addons/__init__.py", line 366, in init_module_objects
result = obj._auto_init(cr, {'module': module_name})
File "/home/terp/OpenERP/branch/server/5.0/bin/osv/orm.py", line 1875, in _auto_init
default = self._defaults[k](self, cr, 1, {})
File "/home/terp/OpenERP/branch/server/5.0/bin/addons/account/account.py", line 1306, in _default_company
if user.company_id:
File "/home/terp/OpenERP/branch/server/5.0/bin/osv/orm.py", line 229, in __getattr__
return self[name]
File "/home/terp/OpenERP/branch/server/5.0/bin/osv/orm.py", line 190, in __getitem__
datas = self._table.read(self._cr, self._uid, ids, fffields, context=self._context, load="_classic_write")
File "/home/terp/OpenERP/branch/server/5.0/bin/addons/base/res/res_user.py", line 128, in read
result = super(users, self).read(cr, uid, ids, fields, context, load)
File "/home/terp/OpenERP/branch/server/5.0/bin/osv/orm.py", line 2142, in read
result = self._read_flat(cr, user, select, fields, context, load)
File "/home/terp/OpenERP/branch/server/5.0/bin/osv/orm.py", line 2212, in _read_flat
self._order), sub_ids)
File "/home/terp/OpenERP/branch/server/5.0/bin/sql_db.py", line 76, in wrapper
return f(self, *args, **kwargs)
File "/home/terp/OpenERP/branch/server/5.0/bin/sql_db.py", line 120, in execute
res = self._obj.execute(query, params)
psycopg2.ProgrammingError: column "period_id" does not exist
LINE 1: SELECT "menu_id","address_id","period_id","active","context_...