Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
20442 Lượt xem

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 ?

Ảnh đại diện
Huỷ bỏ

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

Tác giả

@Nicolas bessi has answered this question bellow

Tác giả

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

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ

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.

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

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.

Câu trả lời hay nhất

hi Yug Faa

i have the same problem do you resolve it ?

regrads
 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 24
13920
3
thg 7 20
8073
0
thg 3 15
3983
3
thg 4 23
34010
5
thg 9 20
12875