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


I have no problems using the search method with sudo but  the browse method gives no result.

search_objs =  env['res.partner'].sudo(user.id).search([])
browse_objs = env['res.partner'].sudo(user.id).browse([])
assert len(search_objs) = len(browse_objs)


Is this result difference intended ?

Is this only happening to my configuration ? .

Do you experience the same ?

الصورة الرمزية
إهمال
أفضل إجابة

Hi Yurdik

Using sudo with browse is not the problem, the issue is that browse receive always a an id or a list of ids to browse. As opposite to search that receive a domain that could be empty the browse method really need the ids to retrieve the results. If you pass a list of ids to the browse you could make the asserts works, like:

search_objs =  env['res.partner'].sudo(user.id).search([])
browse_objs = env['res.partner'].sudo(user.id).browse(search_objs)
assert len(search_objs) = len(browse_objs)# ok
الصورة الرمزية
إهمال
الكاتب

I did forget that. :-) I do work a lot with erppeek, and erppeek allows to specify the search_domain also in browse. Thanks a lot.

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 23
20847
0
نوفمبر 16
2809
Using search count تم الحل
2
ديسمبر 23
19971
2
مارس 15
8256
2
أكتوبر 15
8995