Browse Source

Merge branch '8.0' of /home/iii/addons-yelizariev/../res_partner_strip_email into 8.0

pull/1/head
Ildar Nasyrov 9 years ago
parent
commit
4f2be672a7
  1. 1
      res_partner_strip_email/README.rst
  2. 2
      res_partner_strip_email/__init__.py
  3. 20
      res_partner_strip_email/__openerp__.py
  4. 22
      res_partner_strip_email/models.py
  5. BIN
      res_partner_strip_email/static/description/icon.png

1
res_partner_strip_email/README.rst

@ -0,0 +1 @@
Trim email field in partner form.

2
res_partner_strip_email/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import models

20
res_partner_strip_email/__openerp__.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
{
'name': "Trim partner's email",
'summary': "",
'author': "IT-Projects LLC, Ivan Yelizariev",
'license': 'GPL-3',
'website': "https://yelizariev.github.io",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
# for the full list
'category': 'Tools',
'version': '1.0.0',
# any module necessary for this one to work correctly
'depends': ['base'],
# always loaded
'data': [],
}

22
res_partner_strip_email/models.py

@ -0,0 +1,22 @@
# -*- 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

BIN
res_partner_strip_email/static/description/icon.png

After

Width: 100  |  Height: 100  |  Size: 3.0 KiB

Loading…
Cancel
Save