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

[MIG-12] hidden_admin #240

Open
wants to merge 1 commit into
base: 12.0
Choose a base branch
from
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
20 changes: 20 additions & 0 deletions hidden_admin/README.rst
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions hidden_admin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models
13 changes: 13 additions & 0 deletions hidden_admin/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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": "[email protected]",
"website": "https://twitter.com/yelizariev",
"license": "Other OSI approved licence", # MIT
"depends": ["mail", "ir_rule_protected"],
"data": ["security.xml"],
"installable": True,
}
12 changes: 12 additions & 0 deletions hidden_admin/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Updates
=======

`1.0.1`
-------

- FIX: hide admin in channel chat

`1.0.0`
-------

- init version
5 changes: 5 additions & 0 deletions hidden_admin/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
========================================
Hide admin from user and partner lists
========================================

TODO
25 changes: 25 additions & 0 deletions hidden_admin/i18n/es_CR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hidden_admin
#
# Translators:
# Randall <[email protected]>, 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 <[email protected]>, 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"
12 changes: 12 additions & 0 deletions hidden_admin/models.py
Original file line number Diff line number Diff line change
@@ -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]
27 changes: 27 additions & 0 deletions hidden_admin/security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<openerp>
<data>
<record id="admin_user_hidden" model="ir.rule">
<field name="name">Only admin can see admin user</field>
<field name="model_id" ref="base.model_res_users" />
<field name="global" eval="1" />
<field name="domain_force">[('id', '!=', 2)]</field>
<field name="perm_read" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_unlink" eval="True" />
<field name="protected" eval="True" />
</record>
<record id="admin_partner_hidden" model="ir.rule">
<field name="name">Only admin can see admin partner</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="global" eval="1" />
<field name="domain_force">[('user_ids', 'not in', [2])]</field>
<field name="perm_read" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_unlink" eval="True" />
<field name="protected" eval="True" />
</record>
</data>
</openerp>
Binary file added hidden_admin/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.