Browse Source

strip email is work

pull/1/head^2
Ilnur Gallyamov 10 years ago
parent
commit
51dec40c48
  1. 30
      __openerp__.py
  2. 18
      models.py

30
__openerp__.py

@ -1,34 +1,20 @@
# -*- coding: utf-8 -*-
{
'name': "res_partner_strip_email",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "Your Company",
'website': "http://www.yourcompany.com",
'name': "Strip email in partner form",
'summary': """Trim email's field""",
'description': """Email will be trim when create/save""",
'author': "It-Projects LLC",
'website': "https://www.it-projects.info/",
# 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': 'Uncategorized',
'version': '0.1',
'category': 'Base',
'version': '1.0.0',
# any module necessary for this one to work correctly
'depends': ['base'],
# always loaded
'data': [
# 'security/ir.model.access.csv',
'templates.xml',
],
# only loaded in demonstration mode
'demo': [
'demo.xml',
],
'data': [ ],
}

18
models.py

@ -2,7 +2,19 @@
from openerp import models, fields, api
# class res_partner_strip_email(models.Model):
# _name = 'res_partner_strip_email.res_partner_strip_email'
class res_partner_strip_email(models.Model):
_inherit = 'res.partner'
# name = fields.Char()
@api.one
def write(self, vals):
if 'email' in vals:
vals['email']=vals['email'].strip()
res = super(res_partner_strip_email, self).write(vals)
return res
@api.model
def create(self, vals):
if vals['email']:
vals['email']=vals['email'].strip()
res = super(res_partner_strip_email, self).create(vals)
return res
Loading…
Cancel
Save