From 6db4b0b2118b4fc57451cd8b6febffe1434c807f Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Mon, 12 Nov 2012 19:01:44 +0100 Subject: [PATCH] [IMP] remove restrictions on lead deletion After a short conversation with fp, al, odo, abo: it seems that it would be nice for usability's sake to remove restrictions on leads deletion, in the CRM module. This condition on leads' state was introduced several years ago by fp to avoid unfortunate misclicks. It has been followed by another one bypassing the first one in case where the sales team had the allow_unlink flag set. Since the Delete button has been thrown away in the More menu, it shouldn't get misclicked anymore, preventing damages in the CRM pipe. This will simplify access rights for users: if you want to delete a lead, you can, whatever its state, whatever its sales team. Access restriction is still possible though by creating a record rule with a domain on the lead.state. lp bug: https://launchpad.net/bugs/1078037 fixed bzr revid: abo@openerp.com-20121112180144-utqcm39etuuzxdsu --- addons/crm/crm.py | 2 -- addons/crm/crm_lead.py | 8 -------- addons/crm/crm_view.xml | 1 - 3 files changed, 11 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index eb602b98c09..368656224ac 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -115,7 +115,6 @@ class crm_case_section(osv.osv): 'code': fields.char('Code', size=8), 'active': fields.boolean('Active', help="If the active field is set to "\ "true, it will allow you to hide the sales team without removing it."), - 'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"), 'change_responsible': fields.boolean('Reassign Escalated', help="When escalating to this team override the salesman with the team leader."), 'user_id': fields.many2one('res.users', 'Team Leader'), 'member_ids':fields.many2many('res.users', 'sale_member_rel', 'section_id', 'member_id', 'Team Members'), @@ -137,7 +136,6 @@ class crm_case_section(osv.osv): _defaults = { 'active': 1, - 'allow_unlink': 1, 'stage_ids': _get_stage_common, 'alias_domain': False, # always hide alias during creation } diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 64ba9476701..547b25af27c 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -779,14 +779,6 @@ class crm_lead(base_stage, format_address, osv.osv): } return res - def unlink(self, cr, uid, ids, context=None): - for lead in self.browse(cr, uid, ids, context): - if (not lead.section_id.allow_unlink) and (lead.state != 'draft'): - raise osv.except_osv(_('Error!'), - _("You cannot delete lead '%s' because it is not in 'Draft' state. " \ - "You can still cancel it, instead of deleting it.") % lead.name) - return super(crm_lead, self).unlink(cr, uid, ids, context) - def write(self, cr, uid, ids, vals, context=None): if vals.get('stage_id') and not vals.get('probability'): # change probability of lead(s) if required by stage diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index 5fa647f7253..99d3752529e 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -102,7 +102,6 @@ @ -