One many2one field in crm_lead and sale_order is corresponding to res_user ids.
When I am selecting one id in res_users where id=52 (related partner present in res.partner where id=43171), it is not getting saved either in lead/opportunity or sales order. But it accepts for other res_user ids in either objects.
When I try to update it using SQL query, either in crm.lead or sale.order it shows error :
ERROR: insert or update on table "crm_lead" violates foreign key constraint "crm_lead_rep_fkey"
DETAIL: Key (rep)=(52) is not present in table "res_partner".
********** Error **********
ERROR: insert or update on table "crm_lead" violates foreign key constraint "crm_lead_rep_fkey"
SQL state: 23503
Detail: Key (rep)=(52) is not present in table "res_partner".
When I check the res_partner table, id=52 is not present. But as per query I don't understand the relation with res_partner table, instead the related partner id of Rahul in res.partner is 43171.
Everything remaining same in testing instance, write function is working. (There also id=52 is not present in res_partner, but the record is getting saved here).
So l am confused why write is not happening only in live server and that too for res_user id=52 which has got no relation with res_partner table id=52.
Can anyone help in this ?
Regards
Sumit Sinha
which field is actually you are trying to update?