Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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) 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%';
After further investigation, it appears the problem was with the import module that created the rows for external keys with module "product" instead of module "__export__", the proper query for fixing the data was therefore:
UPDATE ir_model_data SET module = '__export__' WHERE noupdate = FALSE AND model LIKE 'product%';
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 12/27/13, 8:17 AM|
|Seen: 1514 times|
|Last updated: 3/16/15, 8:10 AM|