Community: Framework mailing list archives

expert-framework@mail.odoo.com

@api.depends cannot be set for tracking other module fields?

by
Maxim Litnitskiy
- 09/06/2014 05:46:58
Hi dear developers!
I have a question regarding new api.
Seems we lost a good piese of functionality with new @api.depends.
Here is the example

Old api:

    _columns = {
        'name': fields.function(_get_name, method=True, type='char', string='Name', store={
            'astpbx.exten': (
                lambda self, cr, uid, ids, c={}: ids,
                ['exten_type', 'peer_id', 'pattern', 'custom_dialplan'],
                1,
                ),
                'res.partner': (_get_partner_user_exten, ['name'], 1),
                'res.users': (_get_user_exten, ['exten'], 1),
            }
        ),

I redefine column 'name' when partner name is changed and also when my model's fields are changed.

Now how can I move that code to new api?

@api.one
@api.depends('exten_type', 'peer_id', 'pattern', 'custom_dialplan')
def _do_name(self):
    # code here

How can I specify other models??


@api.one
@api.depends('exten_type', 'peer_id', 'pattern', 'custom_dialplan')
@api.depends('res.partner.name') ???
def _do_name(self):
    # code here

Thanks.