From a6eac0f08ee9100d1a44a4068d4f580b1c7c4b2c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 6 Feb 2015 13:57:20 +0100 Subject: [PATCH] [FIX] share: share feature compatibility with Odoo 8.0 Since rev. 1ce0b70a02294eb58dbe7c0ff1d7048489585e7a, ir.ui.menu was readable for employees and portal users only Since rev. 74aa7406bf1cd1794f9832ed36141482f7ff9353, the navigation menus were displayed for employees and portal users only. Therefore, when sharing a record with the share feature, nothing was displayed when following the link. This rev. introduces a new group "Shared group", implied for all shared groups created through the share feature. Read access to menus is given to this group The possibility to display the webclient navigation menus as well. --- addons/share/__openerp__.py | 1 + addons/share/security/ir.model.access.csv | 2 ++ addons/share/security/share_security.xml | 8 ++++++++ addons/share/views/share.xml | 8 ++++++++ addons/share/wizard/share_wizard.py | 9 ++++++++- 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 addons/share/security/ir.model.access.csv diff --git a/addons/share/__openerp__.py b/addons/share/__openerp__.py index d65a790eaf8..45a2a225925 100644 --- a/addons/share/__openerp__.py +++ b/addons/share/__openerp__.py @@ -44,6 +44,7 @@ synchronization with other companies. 'website': 'https://www.odoo.com', 'demo': ['share_demo.xml'], 'data': [ + 'security/ir.model.access.csv', 'security/share_security.xml', 'res_users_view.xml', 'wizard/share_wizard_view.xml', diff --git a/addons/share/security/ir.model.access.csv b/addons/share/security/ir.model.access.csv new file mode 100644 index 00000000000..526ccde38c8 --- /dev/null +++ b/addons/share/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +"access_ir_ui_menu_group_shared","ir_ui_menu group_shared","base.model_ir_ui_menu",group_shared,1,0,0,0 diff --git a/addons/share/security/share_security.xml b/addons/share/security/share_security.xml index 2c68cc69937..b65875608b7 100644 --- a/addons/share/security/share_security.xml +++ b/addons/share/security/share_security.xml @@ -14,5 +14,13 @@ Members of this groups have access to the sharing wizard, which allows them to i + + + Shared Group + +This group is a template group for shared users, giving basic access needs, the menus for instance. + + 1 + diff --git a/addons/share/views/share.xml b/addons/share/views/share.xml index aa507eed3e2..0495c39e252 100644 --- a/addons/share/views/share.xml +++ b/addons/share/views/share.xml @@ -9,5 +9,13 @@ + diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index b0ff0cfca00..6fa2a43e365 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -212,8 +212,15 @@ class share_wizard(osv.TransientModel): def _create_share_group(self, cr, uid, wizard_data, context=None): group_obj = self.pool.get('res.groups') share_group_name = '%s: %s (%d-%s)' %('Shared', wizard_data.name, uid, time.time()) + values = {'name': share_group_name, 'share': True} + try: + implied_group_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'share', 'group_shared')[1] + except ValueError: + implied_group_id = None + if implied_group_id: + values['implied_ids'] = [(4, implied_group_id)] # create share group without putting admin in it - return group_obj.create(cr, UID_ROOT, {'name': share_group_name, 'share': True}, {'noadmin': True}) + return group_obj.create(cr, UID_ROOT, values, {'noadmin': True}) def _create_new_share_users(self, cr, uid, wizard_data, group_id, context=None): """Create one new res.users record for each email address provided in