diff --git a/hidden_admin/README.rst b/hidden_admin/README.rst new file mode 100644 index 00000000..b4553592 --- /dev/null +++ b/hidden_admin/README.rst @@ -0,0 +1,20 @@ +Hide admin from user and partner lists +====================================== + +Warning +------- + +As usual user doesn't see admin user it could lead to ignoring Admin user\partner. E.g. Admin could not get notification, because some mail functions are not executed via sudo. + +Unittests could raise errors, because they assume that admin user is available for other users. + +Maintainers +------------ +This module is not maintained since Odoo 11.0. + +Known issues +------------ + +Non-super users will not be able to update ``one2many`` fields to ``res.users`` model, if Admin is specified in values. In such cases, you have to remove Admin from the field before installing the module. Example: **Team Members** field in ``Sales Team`` model. See https://github.com/it-projects-llc/access-addons/issues/36 + +Tested on 9.0 2ec9a9c99294761e56382bdcd766e90b8bc1bb38 diff --git a/hidden_admin/__init__.py b/hidden_admin/__init__.py new file mode 100644 index 00000000..a0fdc10f --- /dev/null +++ b/hidden_admin/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/hidden_admin/__manifest__.py b/hidden_admin/__manifest__.py new file mode 100644 index 00000000..8f7eae72 --- /dev/null +++ b/hidden_admin/__manifest__.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +{ + "name": "Hide admin from user and partner lists", + "vesion": "12.0.1.0.1", + "author": "IT-Projects LLC, Ivan Yelizariev", + "category": "Access", + "support": "apps@itpp.dev", + "website": "https://twitter.com/yelizariev", + "license": "Other OSI approved licence", # MIT + "depends": ["mail", "ir_rule_protected"], + "data": ["security.xml"], + "installable": True, +} diff --git a/hidden_admin/doc/changelog.rst b/hidden_admin/doc/changelog.rst new file mode 100644 index 00000000..90b6aa36 --- /dev/null +++ b/hidden_admin/doc/changelog.rst @@ -0,0 +1,12 @@ +Updates +======= + +`1.0.1` +------- + +- FIX: hide admin in channel chat + +`1.0.0` +------- + +- init version diff --git a/hidden_admin/doc/index.rst b/hidden_admin/doc/index.rst new file mode 100644 index 00000000..5ab3b693 --- /dev/null +++ b/hidden_admin/doc/index.rst @@ -0,0 +1,5 @@ +======================================== + Hide admin from user and partner lists +======================================== + +TODO diff --git a/hidden_admin/i18n/es_CR.po b/hidden_admin/i18n/es_CR.po new file mode 100644 index 00000000..5c2d648f --- /dev/null +++ b/hidden_admin/i18n/es_CR.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hidden_admin +# +# Translators: +# Randall , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-26 19:17+0000\n" +"PO-Revision-Date: 2018-04-26 19:17+0000\n" +"Last-Translator: Randall , 2018\n" +"Language-Team: Spanish (Costa Rica) (https://www.transifex.com/it-projects-" +"llc/teams/76080/es_CR/)\n" +"Language: es_CR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: hidden_admin +#: model:ir.model,name:hidden_admin.model_mail_channel +msgid "Discussion channel" +msgstr "Canal de discusiĆ³n" diff --git a/hidden_admin/models.py b/hidden_admin/models.py new file mode 100644 index 00000000..35704e95 --- /dev/null +++ b/hidden_admin/models.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from odoo import SUPERUSER_ID, api, models + + +class Channel(models.Model): + _inherit = "mail.channel" + + @api.multi + def channel_fetch_listeners(self, uuid): + admin_id = self.env["res.users"].sudo().browse(SUPERUSER_ID).partner_id.id + res = super(Channel, self).channel_fetch_listeners(uuid) + return [p for p in res if p.get("id") != admin_id] diff --git a/hidden_admin/security.xml b/hidden_admin/security.xml new file mode 100644 index 00000000..f5c1288c --- /dev/null +++ b/hidden_admin/security.xml @@ -0,0 +1,27 @@ + + + + + Only admin can see admin user + + + [('id', '!=', 2)] + + + + + + + + Only admin can see admin partner + + + [('user_ids', 'not in', [2])] + + + + + + + + diff --git a/hidden_admin/static/description/icon.png b/hidden_admin/static/description/icon.png new file mode 100644 index 00000000..b43a0a13 Binary files /dev/null and b/hidden_admin/static/description/icon.png differ