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

I have a field function named access_user that's returns boolean

When i use it in the domain it does't work :

[('access_user','=',True)]

Always all records are showon, even if access_user is False, , when i use an other type of field than function it works.

Any idea ?

อวตาร
ละทิ้ง

Hi Yug i have the some problem can'i know how do you resolve it

ผู้เขียน

@Nicolas bessi has answered this question bellow

ผู้เขียน

Thank you Mr, nbessi Can you tell me more, please ? I want to implement this, Thanks

คำตอบที่ดีที่สุด

Hello,

You can implement fnct_search optional argument of your function field if you do not want to store it.

Then you will be able to search and filter on it.

อวตาร
ละทิ้ง

This is also useful if there is a faster way to search than comparing all the values or if your search must behave in a particular way.

คำตอบที่ดีที่สุด

You can use a function field in domain and searches if you defined this field as store=True or store={triggers} in your model.

Remember that without setting triggers, your value will be recomputed only if the record itself is modified, if the formulas is related on value of on some relations, this has to be triggered by triggers.

Reference: store parameter in v6.1 doc (also valid for v7)

EDIT: more info based on Guewen's comment

อวตาร
ละทิ้ง

A precision: the value must be stored in the database (vs. computed) to be searchable. So, store should be True or use more precise triggers.

คำตอบที่ดีที่สุด

hi Yug Faa

i have the same problem do you resolve it ?

regrads
 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 24
13928
3
ก.ค. 20
8081
0
มี.ค. 15
3991
3
เม.ย. 23
34024
5
ก.ย. 20
12882