[FIX] share: share feature compatibility with Odoo 8.0

Since rev. 1ce0b70a02, ir.ui.menu
was readable for employees and portal users only

Since rev. 74aa7406bf, 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.
This commit is contained in:
Denis Ledoux 2015-02-06 13:57:20 +01:00
parent 0cbf8d5386
commit a6eac0f08e
5 changed files with 27 additions and 1 deletions

View File

@ -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',

View File

@ -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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_ir_ui_menu_group_shared ir_ui_menu group_shared base.model_ir_ui_menu group_shared 1 0 0 0

View File

@ -14,5 +14,13 @@ Members of this groups have access to the sharing wizard, which allows them to i
<field name="category_id" ref="module_category_share"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<record id="group_shared" model="res.groups">
<field name="name">Shared Group</field>
<field name="comment">
This group is a template group for shared users, giving basic access needs, the menus for instance.</field>
<field name="category_id" ref="module_category_share"/>
<field name="share">1</field>
</record>
</data>
</openerp>

View File

@ -9,5 +9,13 @@
<script type="text/javascript" src="/share/static/src/js/share.js"></script>
</xpath>
</template>
<template id="webclient_bootstrap" name="Webclient Bootstrap - Share" inherit_id="web.webclient_bootstrap">
<xpath expr="//nav[@id='oe_main_menu_navbar']" position="attributes">
<attribute name="groups">base.group_user,base.group_portal,share.group_shared</attribute>
</xpath>
<xpath expr="//div[@class='openerp openerp_webclient_container']//div" position="attributes">
<attribute name="groups">base.group_user,base.group_portal,share.group_shared</attribute>
</xpath>
</template>
</data>
</openerp>

View File

@ -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