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.
23 lines
588 B
23 lines
588 B
# -*- coding: utf-8 -*-
|
|
|
|
from openerp import api
|
|
from openerp import models
|
|
|
|
|
|
class ResPartnerStripEmail(models.Model):
|
|
_inherit = 'res.partner'
|
|
|
|
@api.one
|
|
def write(self, vals):
|
|
vals = self._check_email_field(vals)
|
|
return super(ResPartnerStripEmail, self).write(vals)
|
|
|
|
@api.model
|
|
def create(self, vals):
|
|
vals = self._check_email_field(vals)
|
|
return super(ResPartnerStripEmail, self).create(vals)
|
|
|
|
def _check_email_field(self, vals):
|
|
if vals.get('email'):
|
|
vals['email'] = vals['email'].strip()
|
|
return vals
|