From 421fb60b25bfea67ccf0309f3cf7385dafafc350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Nu=C3=B1ez?= Date: Sat, 22 Aug 2020 19:39:20 -0300 Subject: [PATCH] [MIG-12] hidden_admin --- hidden_admin/README.rst | 20 +++++++++++++++++ hidden_admin/__init__.py | 2 ++ hidden_admin/__manifest__.py | 13 +++++++++++ hidden_admin/doc/changelog.rst | 12 ++++++++++ hidden_admin/doc/index.rst | 5 +++++ hidden_admin/i18n/es_CR.po | 25 +++++++++++++++++++++ hidden_admin/models.py | 12 ++++++++++ hidden_admin/security.xml | 27 +++++++++++++++++++++++ hidden_admin/static/description/icon.png | Bin 0 -> 3035 bytes 9 files changed, 116 insertions(+) create mode 100644 hidden_admin/README.rst create mode 100644 hidden_admin/__init__.py create mode 100644 hidden_admin/__manifest__.py create mode 100644 hidden_admin/doc/changelog.rst create mode 100644 hidden_admin/doc/index.rst create mode 100644 hidden_admin/i18n/es_CR.po create mode 100644 hidden_admin/models.py create mode 100644 hidden_admin/security.xml create mode 100644 hidden_admin/static/description/icon.png 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 0000000000000000000000000000000000000000..b43a0a135f903a4c0c401f03a8690fbbd021a2ab GIT binary patch literal 3035 zcmV<13ncW3P))ueQQHJ1Rg98mIup&<-zh`c?djM9xM-*2g`%y!SWDzusm2EEDx3k%Y)@1 z@L+kcJXjvA!P)%o{8@9>FT5*fw0hgsc`>kZ>zPoCrz~G;M%wh{vnQ0~t0Ouo+OX8y zhTV}O`(vk%|Nd`EGA56^<&*^l80F5*XUA9QYYVkB*EZPqpZ?rzUO^Vxb+~r(C!Njh zw}i5oaPj(ulYdrVkm_y^JYHabirzV=a3ZJoddeVC7Mj8U^&=UR$L2rvg9x4TM&^vx zO;v;jzJG82Wbnf}6+8wVE5S%IWD7gUEn$YASMDF6$6=M+|Hj`3EiBYgw06FdPjKB| z2QpgS_8#0atkeE0re=tX!6o6Ru)f@qJV@mfO|o| z&b)>Khn-s=lVbTW8&@8GY~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