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

I want to change some fields label using  _get_view() method. But it should be based on @api.onchange. when i try to add api.onchange decorator then this error showing 

    if res.get('value'):

AttributeError: 'str' object has no attribute 'get'


Is there any solution for this ?

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

Hi,


The @api.onchange decorator is typically used to trigger a method when the value of a field changes.

If you're trying to dynamically change field labels based on some condition, you might consider using the _get_view() method instead.

arch, view = super()._get_view(view_id, view_type, **options)


Hope it helps


Ả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 25
2741
1
thg 4 25
3504
1
thg 4 25
1080
4
thg 3 25
5880
2
thg 2 25
1941