콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
4104 화면

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?

작성자 베스트 답변

Hi Hilar,

I am trying to update a field present in sale.order and crm.lead and it takes res_user ids. In my case, it is not taking for id=52, but other id it is taking.


Hi Mitul,

When I am not considering res_partner table in that field, why is that id checked into that table. It is of course present in res_user table and my field also correspond to same table.

And how can I save that id=52 in my crm_lead/sale_order.


Regards

Sumit Sinha

아바타
취소
베스트 답변

hello

the problem is the reference for the partner table field is not proper set into the field.

for eg. here you get an error like Key (rep)=(52) is not present in table "res_partner". so it means 52 number id is not present into the table res_partner. and when you write into the field of crm_lead/sale_order table's partner field at that time the id which is you set that is from some another tables not from the res_partner. that's why you get this error. 

아바타
취소
관련 게시물 답글 화면 활동
1
11월 20
6828
2
7월 24
2337
2
5월 24
3063
1
2월 24
1846
1
3월 23
2426