-
-
Notifications
You must be signed in to change notification settings - Fork 857
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add user rights to limit access to certain users (and give all rights…
… to others)
- Loading branch information
1 parent
e52554c
commit e0a359f
Showing
4 changed files
with
28 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -340,6 +340,16 @@ def _merge(self, cr, uid, partner_ids, dst_partner=None, context=None): | |
|
||
partner_ids = proxy.exists(cr, uid, list(partner_ids), | ||
context=context) | ||
|
||
if not self.pool['res.users'].has_group( | ||
cr, uid, 'base_partner_merge.group_partner_merge' | ||
): | ||
raise orm.except_orm( | ||
_('Error'), | ||
_("You do not belong in the 'Partner Merge' group. " | ||
"Please contact the Administrator to get access to " | ||
"the partner merge functionality.")) | ||
|
||
if len(partner_ids) < 2: | ||
return | ||
|
||
|
@@ -350,10 +360,9 @@ def _merge(self, cr, uid, partner_ids, dst_partner=None, context=None): | |
"together. You can re-open the wizard several times if " | ||
"needed.")) | ||
|
||
if (openerp.SUPERUSER_ID != uid | ||
and len(set(partner.email for partner | ||
in proxy.browse(cr, uid, partner_ids, | ||
context=context))) > 1): | ||
if (len(set(partner.email for partner | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mdietrichc2c
Author
|
||
in proxy.browse(cr, uid, partner_ids, | ||
context=context))) > 1): | ||
raise orm.except_orm( | ||
_('Error'), | ||
_("All contacts must have the same email. Only the " | ||
|
@@ -371,23 +380,6 @@ def _merge(self, cr, uid, partner_ids, dst_partner=None, context=None): | |
src_partners = ordered_partners[:-1] | ||
_logger.info("dst_partner: %s", dst_partner.id) | ||
|
||
if (openerp.SUPERUSER_ID != uid | ||
and self._model_is_installed(cr, uid, 'account.move.line', | ||
context=context) | ||
and self.pool.get('account.move.line' | ||
).search(cr, openerp.SUPERUSER_ID, | ||
[('partner_id', | ||
'in', | ||
[partner.id for partner | ||
in src_partners])], | ||
context=context)): | ||
raise orm.except_orm( | ||
_('Error'), | ||
_("Only the destination contact may be linked to existing " | ||
"Journal Items. Please ask the Administrator if you need to" | ||
" merge several contacts linked to existing Journal " | ||
"Items.")) | ||
|
||
call_it = lambda function: function(cr, uid, src_partners, | ||
dst_partner, context=context) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
<record model="res.groups" id="group_partner_merge"> | ||
<field name="name">Partner Merge</field> | ||
</record> | ||
<record model="res.groups" id="base.group_system"> | ||
<field name="implied_ids" eval="[(4, ref('group_partner_merge'))]"/> | ||
</record> | ||
</data> | ||
</openerp> |
After delete the condition
openerp.SUPERUSER_ID != uid
, logged in admin user got error message when try to merge contacts, since it is admin this error should not displayed, fixed in 1ef1fe3