تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
4049 أدوات العرض

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
نوفمبر 20
6797
2
يوليو 24
2267
2
مايو 24
2363
1
فبراير 24
1799
1
مارس 23
2363