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

Hello community friends.

I am working with the new api 8.0 of odoo 
And Please I need you help... 

I have two fields: field_1 and field_2:

field_1 = fields.Many2one(........, compute='_filling_method')

field_2 = fields.Many2one(........, compute='_filling_method')

... and the _filling_method:

@api.depends('field_1', 'field_2')

def _filling_method(self):
     .......


How I can know what is the trigger field in the method? field_1 or field_2?


@api.depends('field_1', 'field_2')

def _filling_method(self):

     if trigger == 'field_1':
         ......
     if trigger == 'field_2':

         .....

Is there any way?

Thanks a lot.!

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

Why do not you use:

@api.depends('field_1')
def _filling_method_AAA(self):
...
@api.depends('field_2')
def _filling_method_BBB(self):
...


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

And what if you have just one only field_1 (with its one compute method) that depends on field_2 and field_3, and you need to know which one triggers the method in order to give a value to field_1?

Tác giả Câu trả lời hay nhất

I believed that it was possible. I will do with two methods. Thanks a lot zbik

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 3 16
14127
2
thg 2 22
5502
2
thg 1 20
15221
16
thg 8 19
10183
1
thg 1 19
5438