← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 475621] Re: res.* osv.osv objects may be read() before being fully initialized

 

Keeping this bugreport in radar for framework improvements after v6.0

** Summary changed:

- error trying to add column to class users(osv.osv)
+ res.* osv.osv objects may be read() before being fully initialized

** Changed in: openobject-server
   Importance: Medium => Wishlist

-- 
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:
  res.* osv.osv objects may be read() before being fully initialized

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_...