[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
This commit is contained in:
Antonin Bourguignon 2012-11-12 19:01:44 +01:00
parent 4fccab7afc
commit 6db4b0b211
3 changed files with 0 additions and 11 deletions

View File

@ -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
}

View File

@ -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

View File

@ -102,7 +102,6 @@
<field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/>
</div>
<field name="change_responsible"/>
<field name="allow_unlink"/>
</group>
<separator string="Team Members"/>
<field name="member_ids" widget="many2many_kanban">