If you want to Computed fields in OpenERP(Odoo) follow the below mentioned code and paste it in your (Python).py file:
upper = fields.Char(compute='_compute_upper',
inverse='_inverse_upper',
search='_search_upper')
@api.depends('name')
def _compute_upper(self):
for rec in self:
rec.upper = rec.name.upper() if rec.name else False
def _inverse_upper(self):
for rec in self:
rec.name = rec.upper.lower() if rec.upper else False
def _search_upper(self, operator, value):
if operator == 'like':
operator = 'ilike'
return [('name', operator, value)]
Note- Above code are compute, inverse and search are model methods.
Hope this will help you :)
0 Comment(s)