Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions tko_base_user_partner_email_sync/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
TKO Base User Partner Email Sync
================================

Description
-----------

When creating user, the email field needs to be a valid email.

Credits
=======

Contributors
------------

* Alexandre Rüffer <alexandre.ruffer@tkobr.com>
* Purnendu Singh <purnendusingh@geminatecs.com>

Maintainer
----------

![TKO](https://tkobr.tkobr.com/website/image/ir.attachment/50170_af65c50/datas)

This module is maintained by TKO.

To contribute to this module, please visit https://github.com/thinkopensolutions/tko-social
8 changes: 8 additions & 0 deletions tko_base_user_partner_email_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Thinkopen - Brasil
# Copyright (C) Thinkopen Solutions (<http://www.thinkopensolutions.com.br>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

import models
20 changes: 20 additions & 0 deletions tko_base_user_partner_email_sync/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Thinkopen - Brasil
# Copyright (C) Thinkopen Solutions (<http://www.thinkopensolutions.com.br>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
'name' : 'Tko Base User Partner Email Sync',
'version' : '10.0.0.0.0',
'category' : 'Mail',
"license" : "AGPL-3",
'author' : 'TKO',
'website' : 'tko.tko-uk.com',
'depends' : ['base'],
'data' : [],
'installable': True,
'auto_install': False,
'application': True
}
8 changes: 8 additions & 0 deletions tko_base_user_partner_email_sync/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Thinkopen - Brasil
# Copyright (C) Thinkopen Solutions (<http://www.thinkopensolutions.com.br>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

import model
Binary file added tko_base_user_partner_email_sync/models/__init__.pyc
Binary file not shown.
28 changes: 28 additions & 0 deletions tko_base_user_partner_email_sync/models/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from odoo import api, models, _
from odoo.exceptions import ValidationError
from validate_email import validate_email

class Users(models.Model):
_inherit = "res.users"

@api.model
def create(self, vals):
res = super(Users, self).create(vals)
is_valid = False
for user in res:
is_valid = validate_email(str(user.login))
if is_valid == True:
return res
else:
raise ValidationError(_('Invalid email address!'))

@api.multi
def write(self, values):
res = super(Users, self).write(values)
is_valid = False
for user in self:
is_valid = validate_email(str(user.login))
if is_valid == True:
return res
else:
raise ValidationError(_('Invalid email address!'))
Binary file added tko_base_user_partner_email_sync/models/model.pyc
Binary file not shown.