Mayur Maheshwari(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-opw-572620-port-mma into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-572620-port-mma/+merge/132038

Hello,
    
step:-
=> create invoice and set Analytic Account in invoice line  & validate it
=> open Analytic Account [Accounting/Configuration/Analytic Account/] &  delete 
it 

Expected :
Analytic account should not be deleted when it has some analytic entries 
reference it 

OPW number :- 572620


Thanks,
Mayur 
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-572620-port-mma/+merge/132038
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-opw-572620-port-mma.
=== modified file 'analytic/analytic.py'
--- analytic/analytic.py	2012-10-29 14:27:06 +0000
+++ analytic/analytic.py	2012-10-30 10:06:30 +0000
@@ -297,6 +297,16 @@
             account_ids = self.search(cr, uid, args, limit=limit, context=context)
         return self.name_get(cr, uid, account_ids, context=context)
 
+    def _check_existing_analytic_line(self, cr, uid, ids, context=None):
+         line_obj = self.pool.get('account.analytic.line')
+         if line_obj.search(cr, uid, [('account_id', 'in', ids)]):
+             raise osv.except_osv(_('Error !'), _('You cannot remove an analytic account which has analytic entries!. Remove the related analytic entries first.'))
+         return True
+
+    def unlink(self, cr, uid, ids, context=None):
+         self._check_existing_analytic_line(cr, uid, ids, context=context)
+         return super(account_analytic_account, self).unlink(cr, uid, ids, context=contex)
+
     def create(self, cr, uid, vals, context=None):
         contract =  super(account_analytic_account, self).create(cr, uid, vals, context=context)
         if contract:

_______________________________________________
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