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

I would hide fields dynamically from python, required them, or read-only; from python I've seen that can return a 'domain' for a field, is it possible this same way also return 'attrs'?

example: 

                res.setdefault('domain', {})
                res['domain']['sale_tax'] = repr(sale_tax_domain)
                res['domain']['purchase_tax'] = repr(purchase_tax_domain)

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

attrs can be set using domain.  You can set the domain to use turn readonly, required, and invisible of the attrs based on the value of a field (or combination of those).  Or, if you really need, create a function field of boolean type to calculate the readonly, required, and invisible, then use that in the attrs domain.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 24
27642
0
thg 6 25
301
1
thg 5 23
2010
1
thg 1 24
15133
3
thg 8 22
3884