[FIX] share: multi-sharing with an empty filter was not working

An empty share filter should be translated as a dummy ir.rule
to make sure it is properly combined with other rules after
multiple shared access are granted to the same user.

bzr revid: odo@openerp.com-20110505162701-eq02jb3c0942x3bt
This commit is contained in:
Olivier Dony
2011-05-05 18:27:01 +02:00
parent 4d9ce4260f
commit 6d512bb2da
+5 -1
View File
@@ -31,6 +31,9 @@ from tools.safe_eval import safe_eval
FULL_ACCESS = ('perm_read', 'perm_write', 'perm_create', 'perm_unlink')
READ_ONLY_ACCESS = ('perm_read',)
# Pseudo-domain to represent an empty filter, constructed using
# osv.expression's DUMMY_LEAF
DOMAIN_ALL = [(1, '=', 1)]
RANDOM_PASS_CHARACTERS = [chr(x) for x in range(48, 58) + range(97, 123) + range(65, 91)]
RANDOM_PASS_CHARACTERS.remove('l') #lowercase l, easily mistaken as one or capital i
@@ -427,11 +430,12 @@ class share_create(osv.osv_memory):
# to uid, and it must be replaced correctly)
rule_obj = self.pool.get('ir.rule')
# A.
main_domain = wizard_data.domain if wizard_data.domain != '[]' else DOMAIN_ALL
rule_obj.create(cr, 1, {
'name': _('Sharing filter created by user %s (%s) for group %s') % \
(current_user.name, current_user.login, group_id),
'model_id': model.id,
'domain_force': wizard_data.domain,
'domain_force': main_domain,
'groups': [(4,group_id)]
})
# B.