Hardik Ansodariya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-579991-han into 
lp:openobject-addons/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-579991-han/+merge/130750

Hello,

Use write method to update this insted of query be cause query will not let you 
catch the write event in module.

with reference of Maintenance case : 579991


Thanks
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-579991-han/+merge/130750
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-579991-han.
=== modified file 'account/account.py'
--- account/account.py	2012-04-18 06:45:09 +0000
+++ account/account.py	2012-10-22 08:35:31 +0000
@@ -1245,18 +1245,14 @@
                 raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of closed periods'))
             elif not line.journal_id.update_posted:
                 raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !\nYou should set the journal to allow cancelling entries if you want to do that.'))
-        if ids:
-            cr.execute('UPDATE account_move '\
-                       'SET state=%s '\
-                       'WHERE id IN %s', ('draft', tuple(ids),))
-        return True
+        return super(account_move, self).write(cr, uid, ids, {'state':'draft'})
 
     def write(self, cr, uid, ids, vals, context=None):
         if context is None:
             context = {}
         c = context.copy()
         c['novalidate'] = True
-        result = super(osv.osv, self).write(cr, uid, ids, vals, c)
+        result = super(account_move, self).write(cr, uid, ids, vals, c)
         self.validate(cr, uid, ids, context=context)
         return result
 

_______________________________________________
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