diff --git a/addons/mail/views/res_users_views.xml b/addons/mail/views/res_users_views.xml
index bee14dc64ec..d76e05d43cb 100644
--- a/addons/mail/views/res_users_views.xml
+++ b/addons/mail/views/res_users_views.xml
@@ -16,18 +16,6 @@
-
-
-
res.users.form.mail
diff --git a/addons/share/__init__.py b/addons/share/__init__.py
index dd5cb0e353b..62d47e36261 100644
--- a/addons/share/__init__.py
+++ b/addons/share/__init__.py
@@ -2,5 +2,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import ir_model
-import res_users
import wizard
diff --git a/addons/share/res_users.py b/addons/share/res_users.py
deleted file mode 100644
index f0fcb6afdf4..00000000000
--- a/addons/share/res_users.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- coding: utf-8 -*-
-# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from openerp.osv import fields, osv
-from openerp import SUPERUSER_ID
-
-class res_users(osv.osv):
- _name = 'res.users'
- _inherit = 'res.users'
-
- def _is_share(self, cr, uid, ids, name, args, context=None):
- res = {}
- for user in self.browse(cr, uid, ids, context=context):
- res[user.id] = not self.has_group(cr, user.id, 'base.group_user')
- return res
-
- def _get_users_from_group(self, cr, uid, ids, context=None):
- result = set()
- groups = self.pool['res.groups'].browse(cr, uid, ids, context=context)
- # Clear cache to avoid perf degradation on databases with thousands of users
- groups.invalidate_cache()
- for group in groups:
- result.update(user.id for user in group.users)
- return list(result)
-
- _columns = {
- 'share': fields.function(_is_share, string='Share User', type='boolean',
- store={
- 'res.users': (lambda self, cr, uid, ids, c={}: ids, None, 50),
- 'res.groups': (_get_users_from_group, None, 50),
- }, help="External user with limited access, created only for the purpose of sharing data."),
- }
-
-
-class res_groups(osv.osv):
- _name = "res.groups"
- _inherit = 'res.groups'
- _columns = {
- 'share': fields.boolean('Share Group', readonly=True,
- help="Group created to set access rights for sharing data with some users.")
- }
-
- def init(self, cr):
- # force re-generation of the user groups view without the shared groups
- self.update_user_groups_view(cr, SUPERUSER_ID)
- parent_class = super(res_groups, self)
- if hasattr(parent_class, 'init'):
- parent_class.init(cr)
-
- def get_application_groups(self, cr, uid, domain=None, context=None):
- if domain is None:
- domain = []
- domain.append(('share', '=', False))
- return super(res_groups, self).get_application_groups(cr, uid, domain=domain, context=context)
diff --git a/addons/share/res_users_view.xml b/addons/share/res_users_view.xml
deleted file mode 100644
index cd9f7ad4f4c..00000000000
--- a/addons/share/res_users_view.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- res.users.search.share
- res.users
-
-
-
-
-
-
-
-
-
-
-
-
-
- Users
- {'search_default_no_share': 1}
-
-
-
- res.groups.search.share
- res.groups
-
-
-
-
-
-
-
-
-
-
-
-
- Groups
- {'search_default_no_share': 1}
-
-
- res.groups.form
- res.groups
-
-
-
- {'search_default_no_share':1}
-
-
-
-
-
-
-
-
diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py
index 5e01192fc1c..570db6f2e30 100644
--- a/openerp/addons/base/res/res_users.py
+++ b/openerp/addons/base/res/res_users.py
@@ -85,6 +85,8 @@ class res_groups(osv.osv):
'comment' : fields.text('Comment', size=250, translate=True),
'category_id': fields.many2one('ir.module.category', 'Application', select=True),
'full_name': fields.function(_get_full_name, type='char', string='Group Name', fnct_search=_search_group),
+ 'share': fields.boolean('Share Group',
+ help="Group created to set access rights for sharing data with some users.")
}
_sql_constraints = [
@@ -146,6 +148,21 @@ class res_users(osv.osv):
def _get_password(self, cr, uid, ids, arg, karg, context=None):
return dict.fromkeys(ids, '')
+ def _is_share(self, cr, uid, ids, name, args, context=None):
+ res = {}
+ for user in self.browse(cr, uid, ids, context=context):
+ res[user.id] = not self.has_group(cr, user.id, 'base.group_user')
+ return res
+
+ def _get_users_from_group(self, cr, uid, ids, context=None):
+ result = set()
+ groups = self.pool['res.groups'].browse(cr, uid, ids, context=context)
+ # Clear cache to avoid perf degradation on databases with thousands of users
+ groups.invalidate_cache()
+ for group in groups:
+ result.update(user.id for user in group.users)
+ return list(result)
+
_columns = {
'id': fields.integer('ID'),
'login_date': fields.datetime('Latest connection', select=1, copy=False),
@@ -171,6 +188,11 @@ class res_users(osv.osv):
'company_id': fields.many2one('res.company', 'Company', required=True,
help='The company this user is currently working for.', context={'user_preference': True}),
'company_ids':fields.many2many('res.company','res_company_users_rel','user_id','cid','Companies'),
+ 'share': fields.function(_is_share, string='Share User', type='boolean',
+ store={
+ 'res.users': (lambda self, cr, uid, ids, c={}: ids, None, 50),
+ 'res.groups': (_get_users_from_group, None, 50),
+ }, help="External user with limited access, created only for the purpose of sharing data."),
}
# overridden inherited fields to bypass access rights, in case you have
@@ -759,7 +781,10 @@ class groups_view(osv.osv):
return True
def get_application_groups(self, cr, uid, domain=None, context=None):
- return self.search(cr, uid, domain or [])
+ if domain is None:
+ domain = []
+ domain.append(('share', '=', False))
+ return self.search(cr, uid, domain, context=context)
def get_groups_by_application(self, cr, uid, context=None):
""" return all groups classified by application (module category), as a list of pairs:
diff --git a/openerp/addons/base/res/res_users_view.xml b/openerp/addons/base/res/res_users_view.xml
index 71ea27df5e4..c5fb955a8ac 100644
--- a/openerp/addons/base/res/res_users_view.xml
+++ b/openerp/addons/base/res/res_users_view.xml
@@ -43,6 +43,8 @@
+
+
@@ -55,10 +57,11 @@
+
-
+
@@ -115,6 +118,7 @@
ir.actions.act_windowres.groupsform
+ {'search_default_no_share': 1}A group is a set of functional areas that will be assigned to the user in order to give them access and rights to specific applications and tasks in the system. You can create custom groups or edit the ones existing by default in order to customize the view of the menu that users will be able to see. Whether they can have a read, write, create and delete access right can be managed from here.
@@ -231,6 +235,8 @@
+
+
@@ -250,6 +256,7 @@
form
+ {'search_default_no_share': 1}Create and manage users that will connect to the system. Users can be deactivated should there be a period of time during which they will/should not connect to the system. You can assign them groups in order to give them specific access to the applications they need to use in the system.