Activity log for bug #799378

Date Who What changed Old value New value Message
2011-06-19 12:29:28 Lorenzo Battistini bug added bug
2011-06-20 12:03:38 Vinay Rana (OpenERP) openobject-server: status New Incomplete
2011-06-20 13:14:12 Lorenzo Battistini attachment added add_field_to_partner_address.zip https://bugs.launchpad.net/openobject-server/+bug/799378/+attachment/2175872/+files/add_field_to_partner_address.zip
2011-06-20 13:14:22 Lorenzo Battistini openobject-server: status Incomplete New
2011-06-20 13:38:32 Vinay Rana (OpenERP) openobject-server: importance Undecided Low
2011-06-20 13:38:32 Vinay Rana (OpenERP) openobject-server: status New Confirmed
2011-06-20 13:38:32 Vinay Rana (OpenERP) openobject-server: assignee OpenERP's Framework R&D (openerp-dev-framework)
2011-06-24 13:29:30 Yogesh (SerpentCS) openobject-server: status Confirmed In Progress
2011-06-29 05:43:48 Yogesh (SerpentCS) openobject-server: status In Progress Confirmed
2011-07-13 09:41:25 Naresh(OpenERP) openobject-server: status Confirmed Fix Released
2011-07-13 11:31:40 Vo Minh Thu openobject-server: status Fix Released Triaged
2011-09-10 08:22:35 Stéphane Bidoul (Acsone) bug added subscriber Stéphane Bidoul
2011-12-15 17:12:01 Olivier Dony (Odoo) summary Error reading fields of an object inherited by prototyping models inheriting by prototype (_inherit with different _name) do not get updated when parent model is modified
2012-02-14 19:50:06 Antony Lesuisse (OpenERP) openobject-server: status Triaged Incomplete
2012-03-12 09:24:29 Lorenzo Battistini openobject-server: status Incomplete Fix Released
2012-07-26 15:49:28 Olivier Dony (Odoo) openobject-server: status Fix Released Confirmed
2012-07-26 15:58:13 Olivier Dony (Odoo) description openobject-server/6.0 revno 3445 Steps: 1 - Install 'crm' module 2 - Make a module that adds a field to 'res.partner.address' (for instance, you can use 'base_partner_surname' http://apps.openerp.com/addon/1526 or 'l10n_it_base' http://apps.openerp.com/addon/4528) and install it 3 - Try to create a new lead you get: [2011-06-19 14:16:01,056][test] ERROR:db.cursor:Programming error: column crm_lead.last_name does not exist LINE 1: SELECT crm_lead.date_closed,crm_lead.last_name,date_trunc('s... ^ , in query SELECT crm_lead.date_closed,crm_lead.last_name,date_trunc('second', crm_lead.create_date) as create_date,crm_lead.probability,crm_lead.type_id,crm_lead.partner_address_id,crm_lead.date_action_last,crm_lead.day_close,crm_lead.street,crm_lead.day_open,crm_lead.contact_name,crm_lead.partner_id,crm_lead.date_action_next,crm_lead.city,crm_lead.first_name,crm_lead.user_id,crm_lead.zip,crm_lead.title,crm_lead.partner_name,crm_lead.planned_revenue,crm_lead.country_id,crm_lead.company_id,crm_lead.id,crm_lead.priority,crm_lead.state,crm_lead.email_cc,crm_lead.type,crm_lead.email,crm_lead.function,crm_lead.fax,crm_lead.optin,crm_lead.description,crm_lead.street2,crm_lead.ref2,crm_lead.section_id,crm_lead.title_action,crm_lead.phone,date_trunc('second', crm_lead.write_date) as write_date,crm_lead.active,crm_lead.date_action,crm_lead.categ_id,crm_lead.name,crm_lead.stage_id,crm_lead.date_open,crm_lead.date_deadline,crm_lead.optout,crm_lead.mobile,crm_lead.ref,crm_lead.birthdate,crm_lead.channel_id,crm_lead.state_id,crm_lead.email_from,crm_lead.referred,crm_lead.id FROM "crm_lead" WHERE crm_lead.id IN %s ORDER BY priority,date_action,id desc [2011-06-19 14:16:01,057][test] ERROR:web-services:Uncaught exception Traceback (most recent call last): File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/osv.py", line 122, in wrapper return f(self, dbname, *args, **kwargs) File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/osv.py", line 176, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/osv.py", line 167, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 3694, in create self.pool.get(object)._store_set_values(cr, user, ids, fields2, context) File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 3788, in _store_set_values result = self._columns[val[0]].get(cr, self, ids, val, 1, context=context) File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/fields.py", line 800, in get res = self._fnct(obj, cr, user, ids, name, self._arg, context) File "/home/elbati/workspace/openerp/openerp6/server/bin/addons/crm/crm_lead.py", line 69, in _compute_day if lead.date_closed: File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 292, in __getattr__ return self[name] File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 194, in __getitem__ fields_to_fetch = filter(lambda x: x[1]._classic_write, self._table._columns.items()) File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 2942, in read result = self._read_flat(cr, user, select, fields, context, load) File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 3001, in _read_flat cr.execute(query, (tuple(sub_ids),)) File "/home/elbati/workspace/openerp/openerp6/server/bin/sql_db.py", line 78, in wrapper return f(self, *args, **kwargs) File "/home/elbati/workspace/openerp/openerp6/server/bin/sql_db.py", line 131, in execute res = self._obj.execute(query, params) ProgrammingError: column crm_lead.last_name does not exist LINE 1: SELECT crm_lead.date_closed,crm_lead.last_name,date_trunc('s... ^ This is because 'crm.lead' inherits 'res.partner.address' by prototyping, but the new module (base_partner_surname) has been installed after 'crm', so, when 'crm' was installed, 'last_name' didn't exist. Investigating, I noticed that at line 194 http://bazaar.launchpad.net/~openerp/openobject-server/6.0/view/3445/bin/osv/orm.py#L190 'self._table._columns' contains 'last_name' while that column, as mentioned above, is not present within the database. Workarounds =========== - In all cases, forcing a manual module update of the module in which the error occurs will take care of the error permanently. For example the error can occur if you install `base_contact` after installing `crm`. As the error message pops up when you are trying to use crm leads, forcing a manual update of the `crm` module will fix the error (by creating the missing columns) - If the error happens in a custom module, you could also avoid it by making an explicit dependency on the other module that is causing the error to happen. In the previous example, the error would be avoided if `crm` had an explicit dependency on `base_contact`, because base_contact would always be installed and loaded *before* `crm`. Original Description ==================== openobject-server/6.0 revno 3445 Steps: 1 - Install 'crm' module 2 - Make a module that adds a field to 'res.partner.address' (for instance, you can use 'base_partner_surname' http://apps.openerp.com/addon/1526 or 'l10n_it_base' http://apps.openerp.com/addon/4528) and install it 3 - Try to create a new lead you get: [2011-06-19 14:16:01,056][test] ERROR:db.cursor:Programming error: column crm_lead.last_name does not exist LINE 1: SELECT crm_lead.date_closed,crm_lead.last_name,date_trunc('s...                                     ^ , in query SELECT crm_lead.date_closed,crm_lead.last_name,date_trunc('second', crm_lead.create_date) as create_date,crm_lead.probability,crm_lead.type_id,crm_lead.partner_address_id,crm_lead.date_action_last,crm_lead.day_close,crm_lead.street,crm_lead.day_open,crm_lead.contact_name,crm_lead.partner_id,crm_lead.date_action_next,crm_lead.city,crm_lead.first_name,crm_lead.user_id,crm_lead.zip,crm_lead.title,crm_lead.partner_name,crm_lead.planned_revenue,crm_lead.country_id,crm_lead.company_id,crm_lead.id,crm_lead.priority,crm_lead.state,crm_lead.email_cc,crm_lead.type,crm_lead.email,crm_lead.function,crm_lead.fax,crm_lead.optin,crm_lead.description,crm_lead.street2,crm_lead.ref2,crm_lead.section_id,crm_lead.title_action,crm_lead.phone,date_trunc('second', crm_lead.write_date) as write_date,crm_lead.active,crm_lead.date_action,crm_lead.categ_id,crm_lead.name,crm_lead.stage_id,crm_lead.date_open,crm_lead.date_deadline,crm_lead.optout,crm_lead.mobile,crm_lead.ref,crm_lead.birthdate,crm_lead.channel_id,crm_lead.state_id,crm_lead.email_from,crm_lead.referred,crm_lead.id FROM "crm_lead" WHERE crm_lead.id IN %s ORDER BY priority,date_action,id desc [2011-06-19 14:16:01,057][test] ERROR:web-services:Uncaught exception Traceback (most recent call last):   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/osv.py", line 122, in wrapper     return f(self, dbname, *args, **kwargs)   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/osv.py", line 176, in execute     res = self.execute_cr(cr, uid, obj, method, *args, **kw)   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/osv.py", line 167, in execute_cr     return getattr(object, method)(cr, uid, *args, **kw)   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 3694, in create     self.pool.get(object)._store_set_values(cr, user, ids, fields2, context)   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 3788, in _store_set_values     result = self._columns[val[0]].get(cr, self, ids, val, 1, context=context)   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/fields.py", line 800, in get     res = self._fnct(obj, cr, user, ids, name, self._arg, context)   File "/home/elbati/workspace/openerp/openerp6/server/bin/addons/crm/crm_lead.py", line 69, in _compute_day     if lead.date_closed:   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 292, in __getattr__     return self[name]   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 194, in __getitem__     fields_to_fetch = filter(lambda x: x[1]._classic_write, self._table._columns.items())   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 2942, in read     result = self._read_flat(cr, user, select, fields, context, load)   File "/home/elbati/workspace/openerp/openerp6/server/bin/osv/orm.py", line 3001, in _read_flat     cr.execute(query, (tuple(sub_ids),))   File "/home/elbati/workspace/openerp/openerp6/server/bin/sql_db.py", line 78, in wrapper     return f(self, *args, **kwargs)   File "/home/elbati/workspace/openerp/openerp6/server/bin/sql_db.py", line 131, in execute     res = self._obj.execute(query, params) ProgrammingError: column crm_lead.last_name does not exist LINE 1: SELECT crm_lead.date_closed,crm_lead.last_name,date_trunc('s...                                     ^ This is because 'crm.lead' inherits 'res.partner.address' by prototyping, but the new module (base_partner_surname) has been installed after 'crm', so, when 'crm' was installed, 'last_name' didn't exist. Investigating, I noticed that at line 194 http://bazaar.launchpad.net/~openerp/openobject-server/6.0/view/3445/bin/osv/orm.py#L190 'self._table._columns' contains 'last_name' while that column, as mentioned above, is not present within the database.