Reputation: 93
I can search it in oracle using SQL (not plsql) but don't know how to in odoo framework.
Want to find as below -the middle part, which value is variable length-please help how to in python (.py) file where I can have an onchange function to assign this value to a computed field?
Upvotes: 0
Views: 795
Reputation: 834
ok, try this:
value_field = fields.Char("Value")
extracted = fields.Char("Extracted", compute="_compute_extracted")
@api.depends('value_field')
def _compute_extracted(self):
for rec in self:
split_str = (rec.value_field or '').split('-')
rec.extracted = split_str[1] if len(split_str) > 1 else ''
Upvotes: 1