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.

22 lines
586 B

# -*- coding: utf-8 -*-
from openerp import models, fields, api
class res_partner_strip_email(models.Model):
_inherit = 'res.partner'
@api.one
def write(self, vals):
vals = self._check_email_field(vals)
return super(res_partner_strip_email, self).write(vals)
@api.model
def create(self, vals):
vals = self._check_email_field(vals)
return super(res_partner_strip_email, self).create(vals)
def _check_email_field(self, vals):
if vals.get('email'):
vals['email'] = vals['email'].strip()
return vals