Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo 8 ORM API - Passing a function to depends decorator

Eduardo BP
on 6/17/15, 11:26 AM 646 views

Hi Oddoers,

I was reading the documentation about the depends decorator of the ORM API and I don't understand the following statement written in the documentation:

One may also pass a single function as argument. In that case, the dependencies are given by calling the function with the field's model.

I suposse that it means that I can use a name function as an argument in *args, as that this function returns the dependencies.

For example:

pname = fields.Char(compute='_compute_pname')

def _compute_pname(self):
    if self.partner_id.is_company:
        self.pname = (self.partner_id.name or "").upper()
        self.pname = self.partner_id.name

def my_function(self): return ???

What should my_function return?. Should it return the dependencies into a list or into another kind of data structure type?.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 6/17/15, 11:26 AM
Seen: 646 times
Last updated: 6/17/15, 11:26 AM