Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: (API 8.0) How to know the trigger field of method@api.depends('field_1', 'field_2', ..., 'field_n') ?

by
Vauxoo S.A. de C.V., Yanina Aular
- 04/28/2015 23:45:43
Thanks wangzhsh.

I thought on that solution. But i thought that there any way to know the trigger.



On Tue, Apr 28, 2015 at 10:47 PM, wangzhsh <wangzhsh@liangjiang.com> wrote:
maybe you can use deferent function for each field, just like this :
 

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

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

... and the _filling_method:

@api.depends('field_1')

def _filling_method2(self):

 

@api.depends('field_2')

def _filling_method1(self):

 
 
2015-04-29

wangzhsh

发件人: Yanina Aular
发送时间: 2015-04-29  09:38:20
收件人: Community: Framework
抄送:
主题: (API 8.0) How to know the trigger field of method@api.depends('field_1', 'field_2', ..., 'field_n') ?

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.!


--
B. Sc. in Computer Sciences Yanina Aular
Vauxoo OpenERP's Gold Partner
Programmer - Open Source Consultant
Web:
http://www.yanina.com.ve
Twitter: @yaniaular
Launchpad User: https://launchpad.net/~yanina-aular

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
B. Sc. in Computer Sciences Yanina Aular
Vauxoo OpenERP's Gold Partner
Programmer - Open Source Consultant
Web:
http://www.yanina.com.ve
Twitter: @yaniaular
Launchpad User: https://launchpad.net/~yanina-aular