Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
10845 มุมมอง

I want to see all event/meeting where "user_id==uid" and "uid.name == partner_ids"?

I try to create a new filter :

domain=[|,('user_id','=',uid),('partner_ids','ilike',uid.name)]

But uid.name is not a variable. I try "uid.name", uid.name , "user_id.name" , user_id.name and domain="[('partner_ids','ilike',self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id.name)]" but no one work.

I think I'm misunderstanding the right way to use domain field, not just in search view.

How can I use a var that is not a field of model but from database like res_users.name or res_users.partner_id.name ?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can't use the dot notation in the domain. If you need to know che partner name, you must insert a related field in your classe (with store=True) and search the value in this one.

domain=[|,('user_id','=',uid),('partner_ids','ilike',your_related)]
อวตาร
ละทิ้ง
ผู้เขียน

Thanks but the related field depend of the current user. I can't store this. I edit my post with this: domain="[('partner_ids','ilike',self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id.name)]" Is it possible to have a var like this in a domain? Or maybe I 've to use a context but I don't know how.

What kind of field is partner_ids? a one2many? What table point to?

In the xml view you can't use ORM method. So, self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id.name can't work in your case.

ผู้เขียน

it's a many2many field. it point to crm_meeting_partner_rel table. If I set ('partner_ids','ilike','paul') I've the right filter.

If you use domain=[|,('user_id','=',uid),('partner_ids','=',uid)] it works?

ผู้เขียน

No, I've this error : "TypeError: results.group_by is undefined"

Maybe domain=[|,('user_id','=',uid),('partner_ids','in',uid)] can works

ผู้เขียน

no, I've the same error. Thanks a lot for trying to help me.

There isn't document about it. This is the only link in the internet world...:D http://mohsinpage.wordpress.com/2011/09/29/openerp-many2many-domain-filtering-example/

ผู้เขียน

I will try this solution.

ผู้เขียน

thanks for the link, can you post it as an answer to validate the solution?

ผู้เขียน

thanks for the link, can you post it as an answer to validate the solution?

ผู้เขียน

thanks for the link, can you post it as an answer to validate the solution?

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ส.ค. 18
5433
8
ก.ค. 24
16248
6
ก.ย. 20
19973
How to auto refresh view? แก้ไขแล้ว
12
ธ.ค. 23
44007
1
พ.ค. 18
8532