Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def onchange_edad(self, cr, uid, ids, fecha_nacimiento, context=None):
- res = {}
- if fecha_nacimiento:
- edad = (datetime.now().date() - datetime.strptime(fecha_nacimiento, '%Y-%m-%d').date()).days / 365
- if edad < 0:
- edad = 0
- res = {'edad': edad}
- return {'value': res}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement