[FIX] project: If a project is deleted its related analytic account should also be deleted.

lp bug: https://launchpad.net/bugs/758699 fixed

bzr revid: uco@tinyerp.com-20110414053311-ucmrf4vkl3ogl872
This commit is contained in:
Ujjvala Collins (OpenERP)
2011-04-14 11:03:11 +05:30
parent ad0ececa4e
commit 3b31cb4369
+2
View File
@@ -118,9 +118,11 @@ class project(osv.osv):
return result.keys()
def unlink(self, cr, uid, ids, *args, **kwargs):
analytic_obj = self.pool.get('account.analytic.account')
for proj in self.browse(cr, uid, ids):
if proj.tasks:
raise osv.except_osv(_('Operation Not Permitted !'), _('You can not delete a project with tasks. I suggest you to deactivate it.'))
analytic_obj.unlink(cr, uid, [proj.analytic_account_id.id])
return super(project, self).unlink(cr, uid, ids, *args, **kwargs)
_columns = {