Odoo Help

0
1 Answer
0
Nabeen Najeeb
3/14/18, 6:45 AM

Just return the field names that your computed fields depends on as a list of strings. 

Quoting From your example 

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

@api.one
@api.depends(lambda self: self.my_function())
def _compute_pname(self):
    if self.partner_id.is_company:
        self.pname = (self.partner_id.name or "").upper()
    else:
        self.pname = self.partner_id.namedef my_function(self):
 
def my_function(self):
    return ['partner_id.name']
Ask a Question
Writer
About This Community

This platform 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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now