From 31bcd2588fb89eb67533781fff36e8326b07f628 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Thu, 14 Apr 2011 12:53:04 +0530 Subject: [PATCH] [FIX]: crm: Fixed missing functionalities for "Allow unlink" in case sections bzr revid: rpa@tinyerp.com-20110414072304-cqvsezoeb5g20182 --- addons/crm/crm.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index f25e4c1a0bf..7014fd77517 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -199,6 +199,13 @@ class crm_case(object): user = self.pool.get('res.users').browse(cr, uid, uid, context=context) return user.context_section_id.id or False + def unlink(self, cr, uid, ids, context={}): + for case in self.browse(cr, uid, ids, context): + if (not case.section_id.allow_unlink) and (case.state <> 'draft'): + raise osv.except_osv(_('Warning !'), + _('You can not delete this case. You should better cancel it.')) + return super(crm_case, self).unlink(cr, uid, ids, context) + def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False