Kirti Savalia(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-383478-ksa into 
lp:openobject-addons/6.0.

Requested reviews:
  nel (nel-tinyerp)
  Vinay Rana (openerp) (vra-openerp)
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-383478-ksa/+merge/91982

Hello,

When you delete an analytic account at that time related project and task is 
also deleted without any warning.
This fix solves the issue.

Thanks,
KSA

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-383478-ksa/+merge/91982
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-383478-ksa.
=== modified file 'project/project.py'
--- project/project.py	2011-01-18 22:45:39 +0000
+++ project/project.py	2012-02-08 06:16:20 +0000
@@ -753,7 +753,14 @@
         if vals.get('child_ids', False) and context.get('analytic_project_copy', False):
             vals['child_ids'] = []
         return super(account_analytic_account, self).create(cr, uid, vals, context=context)
-
+    
+    def unlink(self, cr, uid, ids, *args, **kwargs):
+        project_obj = self.pool.get('project.project')
+        analytic_ids = project_obj.search(cr, uid, [('analytic_account_id','in',ids)])
+        if analytic_ids:
+            raise osv.except_osv(_('Warning !'), _('Please delete the project linked with this account first.'))
+        return super(account_analytic_account, self).unlink(cr, uid, ids, *args, **kwargs)
+    
 account_analytic_account()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to