Comment 2 for bug 475621

Revision history for this message
vinayrks (vinay-rks) wrote : Re: [Bug 475621] Re: error trying to add column to class users(osv.osv)

many time I face similar problem , when I try to add new field to existing
object
server restart may solve this problem
if problem persist first compile the source code with python , then update
your module list and then upgarde particular module

for compiling use python2.5 /path-to -addons/modulename/__init__.py

hope this will solve your problem otherwise feel free to contact

On Thu, Nov 5, 2009 at 11:33 PM, Jan Verlaan (Veritos)
<email address hidden>wrote:

> I can not help you with your bug, but please take care of the used English
> while developing new code as help='Jail for accounting date'
> jail is a synoniem for prison.
> Better to use something that is clear for all users like: help='Check and
> accept accounting period' Perhaps you have even a better description.
>
> See discussio
> http://openobject.com/wiki/index.php/English_Improvements#A-Z
>
> --
> error trying to add column to class users(osv.osv)
> https://bugs.launchpad.net/bugs/475621
> You received this bug notification because you are subscribed to
> OpenObject Addons.
>
> Status in OpenObject Addons Modules: New
>
> 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_...
>

--
**********************************
Vinay Yadav
B.tech(IT) , JSSATEN
<email address hidden>
del.icio.us/vinayrks
***********************************