Merge lp:~openerp-dev/openobject-addons/6.1-opw-575493-rha into lp:openobject-addons/6.1

Proposed by Rifakat Husen (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-575493-rha
Merge into: lp:openobject-addons/6.1
Diff against target: 38 lines (+11/-13)
1 file modified
project_timesheet/ (+11/-13)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-575493-rha
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) (community) Needs Fixing
Amit Dodiya (OpenERP) (community) Needs Resubmitting
Naresh(OpenERP) (community) Approve
Review via email:

Description of the change


Fixed journal_id keyerror while a user tries to edit the task work entry from task.
Did a code refactor in order to get the value of journal_id. (Courtesy to Amit Parikh <email address hidden>)

Thanks for your review,
Rifakat Haradwala

To post a comment you must log in.
Revision history for this message
Leonardo Pistone (lepistone) wrote :

can we please merge this one? There is a support ticket on that issue as well.


Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :


This bug was qualified as Already Fixed on Trunk (means that it was already fixed and merged in Trunk). If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Naresh Soni

Revision history for this message
Amit Dodiya (OpenERP) (ado-openerp) wrote :


I have updated the merge proposal for following issue
Issue : Analytic line entry amount is not updated while changing the users in task work entry

1). Install project_timesheet module
2). Create two users with different with different cost price for invoicing on tasks.
3). Now create one task and fill task work entry with one user so the analytic line for invoicing is created
4). After that change the user in above created entry the amount will not get updated according to the user's cost.


review: Needs Resubmitting
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

in line 18 of the diff, you say

if 'hours' or 'user_id' in vals:

this is nasty as it always will be true, which will create a lot of bogus error messages to the user. the line should read

if 'hours' in vals or 'user_id' in vals

review: Needs Fixing

Unmerged revisions

7099. By Amit Dodiya<email address hidden>

[FIX]: project_timesheet :(1) analytic line is not updated while changing the users in task work entry (2) edit task work gives traceback

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'project_timesheet/'
2--- project_timesheet/ 2012-01-31 13:36:57 +0000
3+++ project_timesheet/ 2012-12-10 13:03:42 +0000
4@@ -140,23 +140,21 @@
5 vals_line = {}
6 if 'name' in vals:
7 vals_line['name'] = '%s: %s' % (tools.ustr(, tools.ustr(vals['name']) or '/')
8- if 'user_id' in vals:
9- vals_line['user_id'] = vals['user_id']
10- result = self.get_user_related_details(cr, uid, vals['user_id'])
11- for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'):
12- if result.get(fld, False):
13- vals_line[fld] = result[fld]
15 if 'date' in vals:
16 vals_line['date'] = vals['date'][:10]
17- if 'hours' in vals:
18+ if 'hours' or 'user_id' in vals:
19+ vals_line['user_id'] = vals.get('user_id',
20 default_uom = self.pool.get('res.users').browse(cr, uid, uid)
21- vals_line['unit_amount'] = vals['hours']
22+ vals_line['unit_amount'] = vals.get('hours', task.hours)
23+ result = self.get_user_related_details(cr, uid, vals.get('user_id',
24+ for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'):
25+ if result.get(fld):
26+ vals_line[fld] = result[fld]
28+ if result.get('product_uom_id',False) and (not result['product_uom_id'] == default_uom):
29+ vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals.get('hours', task.hours), result['product_uom_id'])
31 prod_id = vals_line.get('product_id', # False may be set
33- if result.get('product_uom_id',False) and (not result['product_uom_id'] == default_uom):
34- vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
36 # Compute based on pricetype
37 amount_unit = timesheet_obj.on_change_unit_amount(cr, uid,,
38 prod_id=prod_id, company_id=False,