Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
2066 Vistas

Hi 

I am trying to insert a quotation from one country server to another country server. I could insert crm and sales order successfully but when i try to insert quotation, it is showing below error for partner ID.can pls advise


'23503: insert or update on table "sale_order" violates foreign key constraint "sale_order_partner_id_fkey"

thanks for the information . Partner id for this customer in country A db is 6580 but in target db is  6463 this case should i change the partner id to make both id same? will this solve the problem. But when i update the id ,as below 

update public.res_partner set id='6580' where ID='6463';

it is showing below error

ERROR: update or delete on table "res_partner" violates foreign key constraint "crm_lead_partner_id_fkey" on table "crm_lead"
DETAIL: Key (id)=(6463) is still referenced from table "crm_lead".
********** Error **********

ERROR: update or delete on table "res_partner" violates foreign key constraint "crm_lead_partner_id_fkey" on table "crm_lead"
SQL state: 23503
Detail: Key (id)=(6463) is still referenced from table "crm_lead".


When i update crm_lead as below,then below error is showing:

update crm_lead set partner_id = '6580' where id='756'

ERROR: insert or update on table "crm_lead" violates foreign key constraint "crm_lead_partner_id_fkey"
DETAIL: Key (partner_id)=(6580) is not present in table "res_partner".

********** Error **********

ERROR: insert or update on table "crm_lead" violates foreign key constraint "crm_lead_partner_id_fkey"
SQL state: 23503
Detail: Key (partner_id)=(6580) is not present in table "res_partner".


Partner is existing in both db but the id is different. Now i tried to insert the same parterid (hard coded the id)same as taget table in the insert query but still the error message is showing as below

Npgsql.PostgresException: '23503: insert or update on table "sale_order" violates foreign key constraint "sale_order_partner_id_fkey"

create a mapping model to map the partner_id of one database to the other database-  can help to provide link for this. Thanks 

Avatar
Descartar
Autor Mejor respuesta

Npgsql.PostgresException: '23503: insert or update on table "sale_order" violates foreign key constraint "sale_order_partner_id_fkey"

Avatar
Descartar
Mejor respuesta

i don't think you can change the partner_id as it is being used in other models.  what I suggest is to create a mapping model to map the partner_id of one database to the other database.  You can then use this model to translate the partner_id

Avatar
Descartar
Mejor respuesta

It looks like you are trying to insert an order associated with a partner that does not exist in the target DB.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
feb 25
2010
1
dic 24
2125
2
mar 24
2463
2
mar 24
2991
0
sept 23
1546