Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portal Email Readonly #1056

Closed
wants to merge 2 commits into from
Closed
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
73 changes: 73 additions & 0 deletions portal_email_readonly/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
=====================
portal_email_readonly
=====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a7c01604e594821136f726fe12fc2e738e0b97e4eb5331b9474ceedbbca35dce
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github
:target: https://github.com/OCA/website/tree/14.0/portal_email_readonly
:alt: OCA/website
.. |badge3| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/website-14-0/website-14-0-portal_email_readonly
:alt: Translate me on Weblate
.. |badge4| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/website&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4|

This module is an addition to Odoo's portal module, and makes sure that the email field on the 'My Account' page in the portal / website / webshop is not editable by the portal user.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/website/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/website/issues/new?body=module:%20portal_email_readonly%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* TOSC - K.Sushma

Contributors
~~~~~~~~~~~~

* Kumari Sushma <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/website <https://github.com/OCA/website/tree/14.0/portal_email_readonly>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions portal_email_readonly/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions portal_email_readonly/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "portal_email_readonly",
"summary": """
This module is an addition to Odoo's portal module, and makes sure that the email field on the 'My Account' page in the portal / website / webshop is not editable by the portal user.
This can be very useful when making use of an extended authentication tooling that uses the email address as the user id, and you do not want this to be changed.
The module also introduces an error pop-up when a back office user is trying to change the email address field in any res.partner record after portal access has been granted to the res.user of the concerning res.partner.""",
"author": "TOSC - K.Sushma, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/website",
# Categories can be used to filter modules in modules listing
"category": "Hidden",
"version": "14.0.0.0.0",
"license": "",
# any module necessary for this one to work correctly
"depends": ["portal"],
# always loaded
"data": [
"views/portal_templates.xml",
],
# only loaded in demonstration mode
"demo": [],
}
55 changes: 55 additions & 0 deletions portal_email_readonly/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * portal_email_readonly
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-24 07:33+0000\n"
"PO-Revision-Date: 2024-07-24 07:33+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: portal_email_readonly
#: model:ir.model,name:portal_email_readonly.model_res_partner
msgid "Contact"
msgstr ""

#. module: portal_email_readonly
#: model:ir.model.fields,field_description:portal_email_readonly.field_res_partner__display_name
msgid "Display Name"
msgstr "Schermnaam"

#. module: portal_email_readonly
#: model_terms:ir.ui.view,arch_db:portal_email_readonly.portal_email_readonly
msgid "Email"
msgstr ""

#. module: portal_email_readonly
#: model:ir.model.fields,field_description:portal_email_readonly.field_res_partner__id
msgid "ID"
msgstr ""

#. module: portal_email_readonly
#: model:ir.model.fields,field_description:portal_email_readonly.field_res_partner____last_update
msgid "Last Modified on"
msgstr "Laatst gewijzigd op"

#. module: portal_email_readonly
#: code:addons/portal_email_readonly/models/res_partner.py:0
#, python-format
msgid ""
"You cannot change the email address of a portal user. Please create a new "
"contact person!"
msgstr "Je kunt het email adres van een portaalgebruiker niet aanpassen. Maak een nieuwe contactpersoon aan."

#. module: portal_email_readonly
#: model_terms:ir.ui.view,arch_db:portal_email_readonly.portal_email_readonly
msgid ""
"You cannot change the email address. Please create a new contact person."
msgstr "Je kunt het email adres van een portaalgebruiker niet aanpassen. Maak een nieuwe contactpersoon aan."
1 change: 1 addition & 0 deletions portal_email_readonly/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_partner
27 changes: 27 additions & 0 deletions portal_email_readonly/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from odoo import _, models
from odoo.exceptions import UserError


class Partner(models.Model):
_inherit = "res.partner"

def can_edit_email(self):
"""Can't edit `email` if there is 'base.group_portal'."""
return not self.env.user.has_group("base.group_portal")

def write(self, vals):
ctx = self.env.context
for obj in self:
if not ctx.get("website_id", False):
if (
obj.user_ids
and obj.user_ids[0].has_group("base.group_portal")
and "email" in vals
):
raise UserError(
_(
"You cannot change the email address of a portal user. "
"Please create a new contact person!"
)
)
return super(Partner, self).write(vals)
1 change: 1 addition & 0 deletions portal_email_readonly/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Kumari Sushma <[email protected]>
1 change: 1 addition & 0 deletions portal_email_readonly/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module is an addition to Odoo's portal module, and makes sure that the email field on the 'My Account' page in the portal / website / webshop is not editable by the portal user.
Loading
Loading