diff --git a/email_id_validation/README.rst b/email_id_validation/README.rst new file mode 100644 index 000000000..ed6ce8c99 --- /dev/null +++ b/email_id_validation/README.rst @@ -0,0 +1,24 @@ +Validate E-mail ID v10 +====================== +With this plugin, you can validate the E-mail ID entered in Partner/Employee form. This app will help +you to maintain a consistent and reliable address details for your Partner/Employee. +The plugin uses 'addr-spec' portion of RFC 2822 for validating the ID.That is, with this plugin you can +correctly identify any email address that is likely to be in use as of 2011. + +Installation +============ +You must install following packages to work the App properly: +* pip install validate_email +* pip install pyDNS + +NOTE: Since the Plugin performs verification through online you must be connected to the internet while +checking the Id + +Configuration +============= + +Nothing to configure. + +Credits +======= +Developer: Saritha Sahadevan @ cybrosys, saritha@cybrosys.in diff --git a/email_id_validation/__init__.py b/email_id_validation/__init__.py new file mode 100644 index 000000000..59befdb62 --- /dev/null +++ b/email_id_validation/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Saritha Sahadevan() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from . import models diff --git a/email_id_validation/__manifest__.py b/email_id_validation/__manifest__.py new file mode 100644 index 000000000..066c76552 --- /dev/null +++ b/email_id_validation/__manifest__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Saritha Sahadevan() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': "Validate E-mail ID", + 'version': '10.0.1.0.0', + 'summary': """Check Whether A Given E-mail ID Is Valid Or Not""", + 'description': """Check Whether A Given E-mail ID Is Valid Or Not In Partner And Employee Form""", + 'author': "Cybrosys Techno Solutions", + 'website': "https://www.cybrosys.com", + 'maintainer': 'Cybrosys Techno Solutions', + 'category': 'Extra Tools', + 'depends': ['base', 'hr', 'sale'], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'external_dependencies': {'python': ['validate_email', 'pyDNS']}, + 'application': False, +} diff --git a/email_id_validation/models/__init__.py b/email_id_validation/models/__init__.py new file mode 100644 index 000000000..85f906a1a --- /dev/null +++ b/email_id_validation/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Saritha Sahadevan() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from . import email_id_validation diff --git a/email_id_validation/models/email_id_validation.py b/email_id_validation/models/email_id_validation.py new file mode 100644 index 000000000..4035d7bdf --- /dev/null +++ b/email_id_validation/models/email_id_validation.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Saritha Sahadevan() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from validate_email import validate_email +from odoo.exceptions import ValidationError +from odoo import models, api, _ + + +class PartnerEmailValidation(models.Model): + _inherit = 'res.partner' + + @api.constrains('email') + def validate(self): + is_valid = validate_email(self.email, check_mx=False, verify=True, debug=False, smtp_timeout=10) + if is_valid is not True: + raise ValidationError(_('You can use only valid email address.Email address %s is invalid or does not exit') + % self.email) + + +class EmployeeEmailValidation(models.Model): + _inherit = 'hr.employee' + + @api.constrains('work_email') + def validate(self): + is_valid = validate_email(self.work_email, check_mx=False, verify=True, debug=False, smtp_timeout=10) + if is_valid is not True: + raise ValidationError(_('You can use only valid email address.Email address %s is invalid or does not exit') + % self.work_email) diff --git a/email_id_validation/static/description/banner.jpg b/email_id_validation/static/description/banner.jpg new file mode 100644 index 000000000..8b0a3aab9 Binary files /dev/null and b/email_id_validation/static/description/banner.jpg differ diff --git a/email_id_validation/static/description/cybro_logo.png b/email_id_validation/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/email_id_validation/static/description/cybro_logo.png differ diff --git a/email_id_validation/static/description/icon.png b/email_id_validation/static/description/icon.png new file mode 100644 index 000000000..a72272ed7 Binary files /dev/null and b/email_id_validation/static/description/icon.png differ diff --git a/email_id_validation/static/description/index.html b/email_id_validation/static/description/index.html new file mode 100644 index 000000000..56c820013 --- /dev/null +++ b/email_id_validation/static/description/index.html @@ -0,0 +1,93 @@ +
+
+

Validate E-mail ID

+

Check Whether A Given E-mail ID Is Valid Or Not .

+

Cybrosys Technologies

+
+
+ +
+
+
+

Overview

+

+ With this plugin, you can validate the E-mail ID entered in Partner/Employee form. This app will help + you to maintain a consistent and reliable address details for your Partner/Employee. + The plugin uses 'addr-spec' portion of RFC 2822 for validating the ID.That is, with this plugin you can + correctly identify any email address that is likely to be in use as of 2011. +

+
+
+
+ +
+
+

Validate Email ID

+

+ You will get a warning message if you entered an invalid ID. +

+
+
+ +
+
+ +
+
+
+
+ +
+
+

Installation

+

+ You must install following packages to work the App properly: +

+
+
+ +
+
+
+
+ +
+
+
+
+

+ Since the Plugin performs verification through online you must be connected to the internet while + checking the Id +

+
+
+ +
+

Need Any Help?

+ +
+ + + + diff --git a/email_id_validation/static/description/pyDns.png b/email_id_validation/static/description/pyDns.png new file mode 100644 index 000000000..1c8efa10c Binary files /dev/null and b/email_id_validation/static/description/pyDns.png differ diff --git a/email_id_validation/static/description/validate_email.png b/email_id_validation/static/description/validate_email.png new file mode 100644 index 000000000..2514271aa Binary files /dev/null and b/email_id_validation/static/description/validate_email.png differ diff --git a/email_id_validation/static/description/validation.png b/email_id_validation/static/description/validation.png new file mode 100644 index 000000000..bbef915ea Binary files /dev/null and b/email_id_validation/static/description/validation.png differ diff --git a/email_id_validation/static/description/validation_hr.png b/email_id_validation/static/description/validation_hr.png new file mode 100644 index 000000000..428b66e1f Binary files /dev/null and b/email_id_validation/static/description/validation_hr.png differ diff --git a/sales_team_parent/__manifest__.py b/sales_team_parent/__manifest__.py index 5d08a0072..2b4824c71 100644 --- a/sales_team_parent/__manifest__.py +++ b/sales_team_parent/__manifest__.py @@ -22,7 +22,7 @@ ############################################################################## { 'name': 'Parent Team & Targets', - 'version': '10.0.1.0.0', + 'version': '10.0.2.0.0', 'category': 'Sales', 'summary': 'Sales Team Targets and Parent Teams', 'author': 'Cybrosys Techno Solutions', @@ -38,4 +38,4 @@ ], 'installable': True, 'auto_install': False, -} \ No newline at end of file +} diff --git a/sales_team_parent/__manifest__.py~ b/sales_team_parent/__manifest__.py~ new file mode 100644 index 000000000..5d08a0072 --- /dev/null +++ b/sales_team_parent/__manifest__.py~ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'Parent Team & Targets', + 'version': '10.0.1.0.0', + 'category': 'Sales', + 'summary': 'Sales Team Targets and Parent Teams', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'http://www.cybrosys.com', + 'depends': ['crm', 'sale'], + 'images': ['static/description/banner.jpg'], + 'data': [ + 'views/parent_team.xml', + 'views/sales_man_target.xml', + 'views/sales_team_target.xml', + 'security/ir.model.access.csv', + ], + 'installable': True, + 'auto_install': False, +} \ No newline at end of file diff --git a/sales_team_parent/models/crm_target_team.py b/sales_team_parent/models/crm_target_team.py index 5bce926d2..3ba91bb08 100644 --- a/sales_team_parent/models/crm_target_team.py +++ b/sales_team_parent/models/crm_target_team.py @@ -32,7 +32,7 @@ class CrmTeam(models.Model): team_target = fields.Float(string='Team Target', compute="compute_team_target") parent_team = fields.Many2one('crm.team', string='Parent Team', copy=False) - currency_id = fields.Many2one('res.currency', store=True, string='Currency', readonly=True, default=lambda self: self.get_currency()) + currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, default=lambda self: self.get_currency()) @api.one def compute_team_target(self): diff --git a/sales_team_parent/models/crm_target_team.py~ b/sales_team_parent/models/crm_target_team.py~ new file mode 100644 index 000000000..5bce926d2 --- /dev/null +++ b/sales_team_parent/models/crm_target_team.py~ @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from odoo import models, fields, api + + +class CrmTeam(models.Model): + _inherit = 'crm.team' + + def get_currency(self): + return self.env.user.company_id.currency_id.id + + team_target = fields.Float(string='Team Target', compute="compute_team_target") + parent_team = fields.Many2one('crm.team', string='Parent Team', copy=False) + currency_id = fields.Many2one('res.currency', store=True, string='Currency', readonly=True, default=lambda self: self.get_currency()) + + @api.one + def compute_team_target(self): + total = 0 + childs = self.get_childs(self.id) + childs += self + for team in childs: + for member_id in team.member_ids: + target = team.env['crm.target'].search([('user_id', '=', member_id.id)]) + if target: + for t in target: + total += t.target_amount + + team.team_target = total + return + + def get_childs(self, team_id): + child_teams = self.search([('parent_team.id', '=', team_id)]) + if child_teams: + for team in child_teams: + child_teams += self.get_childs(team.id) + return child_teams + +