You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
604 B

  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class res_partner_strip_email(models.Model):
  4. _inherit = 'res.partner'
  5. @api.one
  6. def write(self, vals):
  7. if 'email' in vals and type(vals['email']) is not bool:
  8. vals['email'] = vals['email'].strip()
  9. res = super(res_partner_strip_email, self).write(vals)
  10. return res
  11. @api.model
  12. def create(self, vals):
  13. if vals['email']:
  14. vals['email'] = vals['email'].strip()
  15. res = super(res_partner_strip_email, self).create(vals)
  16. return res