Merge lp:~therp-nl/therp-backports/server-6.1-lp923645-unlink_timesheet_lines_fails into lp:therp-backports

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 6715
Proposed branch: lp:~therp-nl/therp-backports/server-6.1-lp923645-unlink_timesheet_lines_fails
Merge into: lp:therp-backports
Diff against target: 13 lines (+1/-2)
1 file modified
hr_timesheet/hr_timesheet.py (+1/-2)
To merge this branch: bzr merge lp:~therp-nl/therp-backports/server-6.1-lp923645-unlink_timesheet_lines_fails
Reviewer Review Type Date Requested Status
Ronald Portier (Therp) Approve
Holger Brunn (Therp) Approve
Review via email: mp+140393@code.launchpad.net

Description of the change

This is a backport of the (as yet unreviewed) OPW fix, but only the code and not the updated record rules.\

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Sorry, this is actually a merge proposal on the addons branch, in spite of the name of this branch.

Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve
Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

As the modified unlink does not call super(), it will result in the unlink not working any more at all.

review: Needs Fixing
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

It looks trickier than it is. The hr.analytic.timesheet model inherits account.analytic.line. Upon unlinking of account.analytic.line, the hr.analytic.timesheet that inherits it is unlinked as per cascade. So I stand by this version of the fix.

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

Approve, explanation by Stefan is clear enough.

Just wondering why in the original code toremove is not simply an array that is filled with all id's to remove, but a dictionary that is later reduced to an array with the keys() method....

review: Approve
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Good point ;-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_timesheet/hr_timesheet.py'
2--- hr_timesheet/hr_timesheet.py 2012-02-14 12:25:20 +0000
3+++ hr_timesheet/hr_timesheet.py 2012-12-18 11:24:33 +0000
4@@ -74,8 +74,7 @@
5 toremove = {}
6 for obj in self.browse(cr, uid, ids, context=context):
7 toremove[obj.line_id.id] = True
8- self.pool.get('account.analytic.line').unlink(cr, uid, toremove.keys(), context=context)
9- return super(hr_analytic_timesheet, self).unlink(cr, uid, ids, context=context)
10+ return self.pool.get('account.analytic.line').unlink(cr, uid, toremove.keys(), context=context)
11
12
13 def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, company_id, unit=False, journal_id=False, context=None):

Subscribers

People subscribed via source and target branches

to all changes: