[FIX] crm: apply threshold for leads/opportunities in merge wizard
Purpose of this task is to prevent merging of opportunities when a regular (non super) user selects more than five records. This commit limits total number of recorrds to be merged, up to maximum five leads / opportunities for non superuser environment, and raises a UserError otherwise explaining the threshold limit. closes odoo/odoo#55024 Task-id: 2256126 X-original-commit: c25d7654f250c888cea84c20af16b2a32cc5b365 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Dharmraj Jhala
parent
0ca24b9af1
commit
c7ae1d2cb5
@@ -969,6 +969,9 @@ class Lead(models.Model):
|
||||
if len(self.ids) <= 1:
|
||||
raise UserError(_('Please select more than one element (lead or opportunity) from the list view.'))
|
||||
|
||||
if len(self.ids) > 5 and not self.env.is_superuser():
|
||||
raise UserError(_("To prevent data loss, Leads and Opportunities can only be merged by groups of 5."))
|
||||
|
||||
opportunities = self._sort_by_confidence_level(reverse=True)
|
||||
|
||||
# get SORTED recordset of head and tail, and complete list
|
||||
|
||||
Reference in New Issue
Block a user