Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Computed fields in Odoo9

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 253
    Comment on it

    Computed fields indicates many2one and one2many filed in selection filed . For example you can see below code in you .py file .

    test = fields.Char(compute='_compute_upper',
                        inverse='_inverse_test',
                        search='_search_test')
    
    @api.depends('name')
    def _compute_test(self):
        for rec in self:
            rec. test = rec.name.test () if rec.name else False
    
    def _inverse_test(self):
        for rec in self:
            rec.name = rec.test.lower() if rec. test else False
    
    def _search_test(self, operator, value):
        if operator == 'like':
            operator = 'ilike'
        return [('name', operator, value)]

    Note with the help of this code you can set your selection fileds and api.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: