Hỏi Đáp

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

Tùy biến thuộc tính readonly cho field với domain??

Ảnh đại diện
Nhat Vy

Em có 1 field 'data_evalute': fields.selection([('python','Mã Python'),('sql_query','SQL query'),('user_enter','Người dùng nhập')], 'Dữ liệu đánh gía'),
ở model "category.contract".
- Em tạo thêm một: class evaluation_orther:
có chứa 2 fields:
- 'name': many2one('category.contract'),
- 'note': fields.char('Ghi chú').
Điều kiện hiển thị của fields 'note' là khi thuộc tính của 'data_evalute' có gía trị khác sql_query.
Vậy trong xml, em viết attrs=" " như thế nào ạ.
Em cảm ơn nhiều ạ.

Ảnh đại diện
Huỷ bỏ
2 Trả lời
0
Ảnh đại diện
Nhat Vy
Bài trả lời tốt nhất

Nhưng fields 'data_evalute' là của class "category.contract".
Còn 'note' là của class "evaluation_orther". Nếu viết như vậy làm sao để nó hiểu được. Giữa 2 bảng này có một fields many2one.

Ảnh đại diện
Huỷ bỏ
0
Ảnh đại diện
Leo Tran
Bài trả lời tốt nhất

Hi Nhat Vy,

Bạn có thể viết code trong xml như sau:

<field name="note" attrs="{'invisible': [('data_evalute', '=', 'sql_query')]}"></field>

Hy vọng giúp được bạn!
Ảnh đại diện
Huỷ bỏ