[IMP] share: better way to restrict the feature to the technical group.
authorBhavik Bagdiya <bba@openerp.com>
Wed, 10 Sep 2014 12:52:04 +0000 (18:22 +0530)
committerThibault Delavallée <tde@openerp.com>
Fri, 12 Sep 2014 14:38:08 +0000 (16:38 +0200)
Reverted commit 57a12121057df9fee039a54f5b947c0e8a917fe9 that introduced an unnecessary
call to has_group, as it could be done un share_wizard.py once for the session.

Removed the group_share_user, not necessary anymore.

addons/share/__openerp__.py
addons/share/security/share_security.xml
addons/share/share_data.xml [deleted file]
addons/share/share_demo.xml [deleted file]
addons/share/static/src/js/share.js
addons/share/wizard/share_wizard.py

index 49879d4..f413a12 100644 (file)
@@ -42,12 +42,10 @@ This is extremely useful for collaborative work, knowledge sharing,
 synchronization with other companies.
     """,
     'website': 'https://www.odoo.com',
-    'demo': ['share_demo.xml'],
     'data': [
         'security/share_security.xml',
         'res_users_view.xml',
         'wizard/share_wizard_view.xml',
-        'share_data.xml',
         'views/share.xml',
     ],
     'installable': True,
index 2c68cc6..9d21f62 100644 (file)
@@ -6,13 +6,5 @@
             <field name="parent_id" ref="base.module_category_tools"/>
             <field name="sequence">26</field>
         </record>
-
-        <record id="group_share_user" model="res.groups">
-            <field name="name">User</field>
-            <field name="comment">
-Members of this groups have access to the sharing wizard, which allows them to invite external users to view or edit some of their documents.</field>
-            <field name="category_id" ref="module_category_share"/>
-            <field name="users" eval="[(4, ref('base.user_root'))]"/>
-        </record>
     </data>
 </openerp>
diff --git a/addons/share/share_data.xml b/addons/share/share_data.xml
deleted file mode 100644 (file)
index c64a909..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data noupdate="1">
-        <record id="base.public_user" model="res.users">
-            <field eval="[(4, ref('group_share_user'))]" name="groups_id"/>
-        </record>
-    </data>
-</openerp>
diff --git a/addons/share/share_demo.xml b/addons/share/share_demo.xml
deleted file mode 100644 (file)
index 139c81d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-        <record id="base.user_demo" model="res.users">
-            <field eval="[(4, ref('group_share_user'))]" name="groups_id"/>
-        </record>
-    </data>
-</openerp>
index ed9366f..2211295 100644 (file)
@@ -56,18 +56,14 @@ openerp.share = function(session) {
             var self = this;
             this._super(this);
             has_share(function() {
-                new session.web.Model('res.users').call('has_group', ['base.group_no_one']).done(function(group_status) {
-                    if (group_status == true) {
-                        self.add_items('other', [
-                            {   label: _t('Share'),
-                                callback: self.on_click_share,
-                                classname: 'oe_share' },
-                            {   label: _t('Embed'),
-                                callback: self.on_click_share_link,
-                                classname: 'oe_share' },
-                        ]);
-                    }
-                });
+                self.add_items('other', [
+                    {   label: _t('Share'),
+                        callback: self.on_click_share,
+                        classname: 'oe_share' },
+                    {   label: _t('Embed'),
+                        callback: self.on_click_share_link,
+                        classname: 'oe_share' },
+                ]);
             });
         },
 
index 4ce33e2..ac8874f 100644 (file)
@@ -70,7 +70,7 @@ class share_wizard(osv.TransientModel):
         return group_id in self.pool.get('res.users').read(cr, uid, [uid], ['groups_id'], context=context)[0]['groups_id']
 
     def has_share(self, cr, uid, unused_param, context=None):
-        return self.has_group(cr, uid, module='share', group_xml_id='group_share_user', context=context)
+        return self.has_group(cr, uid, module='base', group_xml_id='group_no_one', context=context)
 
     def _user_type_selection(self, cr, uid, context=None):
         """Selection values may be easily overridden/extended via inheritance"""
@@ -641,7 +641,7 @@ class share_wizard(osv.TransientModel):
                      _('Action and Access Mode are required to create a shared access.'),
                      context=context)
         self._assert(self.has_share(cr, uid, wizard_data, context=context),
-                     _('You must be a member of the Share/User group to use the share wizard.'),
+                     _('You must be a member of the Technical group to use the share wizard.'),
                      context=context)
         if wizard_data.user_type == 'emails':
             self._assert((wizard_data.new_users or wizard_data.email_1 or wizard_data.email_2 or wizard_data.email_3),