Odoo Help

Welcome!

This community 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.

0

Integrity error while updating database

v7
By
richa soni
on 4/10/14, 12:21 PM 2,368 views

Hello,

I am getting Integrity error while updating database.. i deleted some entries..how can i recover database.. or resolve this error. Below is error:

IntegrityError: insert or update on table "wkf_workitem" violates foreign key constraint "wkf_workitem_inst_id_fkey" DETAIL: Key (inst_id)=(1351) is not present in table "wkf_instance".

Client Traceback (most recent call last): File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, **self.params) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/addons/web/controllers/main.py", line 864, in authenticate req.session.authenticate(db, login, password, env) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/addons/web/session.py", line 115, in authenticate uid = self.proxy('common').authenticate(db, login, password, env) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/addons/web/session.py", line 30, in proxy_method result = self.session.send(self.service_name, method, *args) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/addons/web/session.py", line 103, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last): File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/service/web_services.py", line 433, in dispatch return fn(params) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/service/web_services.py", line 444, in exp_authenticate res_users = pooler.get_pool(db).get('res.users') File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/pooler.py", line 49, in get_pool return get_db_and_pool(db_name, force_demo, status, update_module)[1] File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/pooler.py", line 33, in get_db_and_pool registry = RegistryManager.get(db_name, force_demo, status, update_module) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/modules/registry.py", line 193, in get update_module) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/modules/registry.py", line 219, in new openerp.modules.load_modules(registry.db, force_demo, status, update_module) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/modules/loading.py", line 301, in load_modules loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=update_module, report=report) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/modules/loading.py", line 165, in load_module_graph init_module_models(cr, package.name, models) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/modules/module.py", line 381, in init_module_models obj._auto_end(cr, {'module': module_name}) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/osv/orm.py", line 3243, in _auto_end cr.execute('ALTER TABLE "%s" ADD FOREIGN KEY ("%s") REFERENCES "%s" ON DELETE %s' % (t, k, r, d)) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/sql_db.py", line 161, in wrapper return f(self, *args, kwargs) File "/home/richa/Documents/openerp-7.0-20140113-001013/openerp/sql_db.py", line 226, in execute res = self._obj.execute(query, params) *IntegrityError: insert or update on table "wkf_workitem" violates foreign key constraint "wkf_workitem_inst_id_fkey" DETAIL: Key (inst_id)=(1351) is not present in table "wkf_instance".

Please tell me how to resolve. Thanks in advance

0

Brett Lehrer

--Brett Lehrer--
1252
| 5 4 8
Milwaukee, United States
--Brett Lehrer--
Director of IT and open source enthusiast.
Brett Lehrer
On 4/10/14, 1:39 PM

Run this SQL statement on your database:

DELETE FROM wkf_workitem WHERE inst_id=1351;

If you manually deleted a workflow instance but didn't cascade that out to the associated workitems, it'll try to join using a foreign key entry that goes to a non-existent row. This just drops that workitem so you can get back up and running.

Your Answer

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/10/14, 12:21 PM
Seen: 2368 times
Last updated: 3/16/15, 8:10 AM