This is related to an issue that I already solved but I could not find any hints in the forum, I hope this post could be helpful for others running in the same problem.
During the upgrade from 7.0-20130315-002515-1 to 7.0-20131227-002443-1, when upgrading the database, I run into the following error:
2013-11-23 14:40:17,439 19551 ERROR alpenerp openerp.netsvc: null value in column "categ_id" violates not-null constraint
CONTEXT: SQL statement "UPDATE ONLY "public"."product_template" SET "categ_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "categ_id""
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 292, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 433, in dispatch
return fn(*params)
File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 444, in exp_authenticate
res_users = pooler.get_pool(db).get('res.users')
File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 49, in get_pool
return get_db_and_pool(db_name, force_demo, status, update_module)[1]
File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 33, in get_db_and_pool
registry = RegistryManager.get(db_name, force_demo, status, update_module)
File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 193, in get
update_module)
File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 219, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 387, in load_modules
pool.get('ir.model.data')._process_end(cr, SUPERUSER_ID, processed_modules)
File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/ir_model.py", line 1124, in _process_end
self.pool.get(model).unlink(cr, uid, [res_id])
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3990, in unlink
'where id IN %s', (sub_ids,))
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 161, in wrapper
return f(self, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
IntegrityError: null value in column "categ_id" violates not-null constraint
CONTEXT: SQL statement "UPDATE ONLY "public"."product_template" SET "categ_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "categ_id""
It turns out the problem is related to the import of product data and the imported external keys in the table ir_model_data. I solved the issue running this query (the imported external keys had the noupdate field set to FALSE in the ir_model_data table, setting it to TRUE does not impact the keys during the upgrade):
UPDATE ir_model_data SET noupdate = TRUE
WHERE noupdate = FALSE AND model LIKE 'product%';