IntegrityError: insert or update on table "product_supplierinfo" violates foreign key constraint "product_supplierinfo_name_fkey" DETAIL: Key (name)=(2) is not present in table "res_partner".

Bug #656264 reported by Luca Frosini
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

Bug Description

From minimal profile + crm modules trying to install product modules I obtain this error

Environment Information :
System : Linux-2.6.35-22-generic-x86_64-with-Ubuntu-10.10-maverick
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu maverick (development branch)
Release: 10.10
Codename: maverick
Operating System Release : 2.6.35-22-generic
Operating System Version : #33-Ubuntu SMP Sun Sep 19 20:32:27 UTC 2010
Operating System Architecture : 64bit
Operating System Locale : it_IT.UTF8
Python Version : 2.6.6
OpenERP-Client Version : 5.0.14
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/usr/share/pyshared/openerp-server/netsvc.py", line 256, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/usr/share/pyshared/openerp-server/netsvc.py", line 76, in __call__
    return getattr(self, method)(*params)
  File "/usr/share/pyshared/openerp-server/service/web_services.py", line 638, in execute
    return self._execute(db, uid, wiz_id, datas, action, context)
  File "/usr/share/pyshared/openerp-server/service/web_services.py", line 618, in _execute
    return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
  File "/usr/share/pyshared/openerp-server/wizard/__init__.py", line 178, in execute
    res = self.execute_cr(cr, uid, data, state, context)
  File "/usr/share/pyshared/openerp-server/wizard/__init__.py", line 73, in execute_cr
    action_res = action(self, cr, uid, data, context)
  File "/usr/share/pyshared/openerp-server/addons/base/module/wizard/wizard_module_upgrade.py", line 92, in _upgrade_module
    db, pool = pooler.restart_pool(cr.dbname, update_module=True)
  File "/usr/share/pyshared/openerp-server/pooler.py", line 62, in restart_pool
    return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
  File "/usr/share/pyshared/openerp-server/pooler.py", line 40, in get_db_and_pool
    addons.load_modules(db, force_demo, status, update_module)
  File "/usr/share/pyshared/openerp-server/addons/__init__.py", line 736, in load_modules
    r = load_module_graph(cr, graph, status, report=report)
  File "/usr/share/pyshared/openerp-server/addons/__init__.py", line 637, in load_module_graph
    tools.convert_xml_import(cr, m, fp, idref, mode=mode, noupdate=True, **kwargs)
  File "/usr/share/pyshared/openerp-server/tools/convert.py", line 877, in convert_xml_import
    obj.parse(doc.getroot())
  File "/usr/share/pyshared/openerp-server/tools/convert.py", line 774, in parse
    self._tags[rec.tag](self.cr, rec, n)
  File "/usr/share/pyshared/openerp-server/tools/convert.py", line 746, in _tag_record
    id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode )
  File "/usr/share/pyshared/openerp-server/addons/base/ir/ir_model.py", line 515, in _update
    res_id = model_obj.create(cr, uid, values, context=context)
  File "/usr/share/pyshared/openerp-server/osv/orm.py", line 2869, in create
    cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2))
  File "/usr/share/pyshared/openerp-server/sql_db.py", line 78, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/share/pyshared/openerp-server/sql_db.py", line 123, in execute
    res = self._obj.execute(query, params)
IntegrityError: insert or update on table "product_supplierinfo" violates foreign key constraint "product_supplierinfo_name_fkey"
DETAIL: Key (name)=(2) is not present in table "res_partner".

Revision history for this message
Luca Frosini (lucafrosini) wrote :

Creating a new database with minimal profile and installing product modules it works.
It seems fail if crm module is installed before.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Possibly, you removed a partner with id=2.
Thanks for your participation.

Changed in openobject-server:
status: New → Invalid
milestone: none → 5.0.15
Revision history for this message
Luca Frosini (lucafrosini) wrote :

Sure. Before trying to install the modules I removed some partner, but I don't understand why this should influence a module installation.
Cheers

Revision history for this message
Cristian Salamea (ovnicraft) wrote :

In this way errors about integrity must be friendliest.

Regards,

Revision history for this message
nima (0.5a) wrote :

how could he solve his problem.i have the same thing happening to me.

thanks,

Revision history for this message
jordi (jordic) wrote :

It also happens to me, after delete some clients

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

The clients you removed, have been referenced somewhere else like, as a supplier of a product,or as a customer/supplier for any invoice,on any address ,etc.

Version 6(to be released this december) will come up with a lot of such improvements.
Thanks.

Revision history for this message
Mihai Satmarean (mihai-satmarean) wrote :

I have this error too on V6.0.2, I would really like to find a way to see the exact lines in the database that are not ok.

Thanks.

Revision history for this message
xrg (xrg) wrote : Re: [Bug 656264] Re: IntegrityError: insert or update on table "product_supplierinfo" violates foreign key constraint "product_supplierinfo_name_fkey" ...

On Sunday 15 May 2011, you wrote:
> I have this error too on V6.0.2, I would really like to find a way to
> see the exact lines in the database that are not ok.

...
DETAIL: Key (name)=(2) is not present in table "res_partner".

The 'DETAIL' line will only give you the values, not the id's of the offending
lines. Reason is, Postgres tables are not always supposed to have 'id' or
anything standardized as their primary key. So, the server can only report the
values, not guess and report the primary key(s).

setting "res.partner.name = '2' " ? May I ask why you are trying to do that?

--
Say NO to spam and viruses. Stop using Microsoft Windows!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.