Merge lp:~openerp-dev/openobject-addons/6.0-opw-579991-han into lp:openobject-addons/6.0

Proposed by Hardik Ansodariya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-579991-han
Merge into: lp:openobject-addons/6.0
Diff against target: 23 lines (+2/-6)
1 file modified
account/account.py (+2/-6)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-579991-han
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+130750@code.launchpad.net

Description of the change

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

To post a comment you must log in.

Unmerged revisions

5360. By Hardik Ansodariya (OpenERP)

[FIX] account_move: Use super instead of execute for catching write method if module want (Maintenance Case: 579991)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account.py'
2--- account/account.py 2012-04-18 06:45:09 +0000
3+++ account/account.py 2012-10-22 08:35:31 +0000
4@@ -1245,18 +1245,14 @@
5 raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of closed periods'))
6 elif not line.journal_id.update_posted:
7 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.'))
8- if ids:
9- cr.execute('UPDATE account_move '\
10- 'SET state=%s '\
11- 'WHERE id IN %s', ('draft', tuple(ids),))
12- return True
13+ return super(account_move, self).write(cr, uid, ids, {'state':'draft'})
14
15 def write(self, cr, uid, ids, vals, context=None):
16 if context is None:
17 context = {}
18 c = context.copy()
19 c['novalidate'] = True
20- result = super(osv.osv, self).write(cr, uid, ids, vals, c)
21+ result = super(account_move, self).write(cr, uid, ids, vals, c)
22 self.validate(cr, uid, ids, context=context)
23 return result
24