Merge lp:~akretion-team/hr-timesheet/70-fix-timesheet-task-bug1316456 into lp:~hr-core-editors/hr-timesheet/7.0

Proposed by Alexis de Lattre
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp
Approved revision: 64
Merged at revision: 65
Proposed branch: lp:~akretion-team/hr-timesheet/70-fix-timesheet-task-bug1316456
Merge into: lp:~hr-core-editors/hr-timesheet/7.0
Diff against target: 51 lines (+12/-6)
2 files modified
timesheet_task/project_task.py (+10/-4)
timesheet_task/project_task_view.xml (+2/-2)
To merge this branch: bzr merge lp:~akretion-team/hr-timesheet/70-fix-timesheet-task-bug1316456
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no test Approve
Stéphane Bidoul (Acsone) (community) code review, no test Approve
Pedro Manuel Baeza code review Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+218364@code.launchpad.net

Description of the change

I have fixed the bug https://bugs.launchpad.net/hr-timesheet/+bug/1316456 in this merge proposal. Please refer to the bug report to get a complete bug description with the scenario to reproduce it.

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM.

Regards.

review: Approve (code review)
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Makes sense.

review: Approve (code review, no test)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM thanks for the fix

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'timesheet_task/project_task.py'
2--- timesheet_task/project_task.py 2013-10-08 11:06:18 +0000
3+++ timesheet_task/project_task.py 2014-05-06 08:39:54 +0000
4@@ -135,7 +135,8 @@
5 _name = "hr.analytic.timesheet"
6
7 def on_change_unit_amount(self, cr, uid, sheet_id, prod_id, unit_amount, company_id,
8- unit=False, journal_id=False, task_id=False, to_invoice=False,
9+ unit=False, journal_id=False, task_id=False,
10+ to_invoice=False, project_id=False,
11 context=None):
12 res = super(HrAnalyticTimesheet, self).on_change_unit_amount(cr,
13 uid,
14@@ -146,9 +147,14 @@
15 unit,
16 journal_id,
17 context)
18- if 'value' in res and task_id:
19- task_obj = self.pool.get('project.task')
20- p = task_obj.browse(cr, uid, task_id).project_id
21+ if 'value' in res and (task_id or project_id):
22+ if task_id:
23+ task_obj = self.pool.get('project.task')
24+ p = task_obj.browse(
25+ cr, uid, task_id, context=context).project_id
26+ elif project_id:
27+ p = self.pool['project.project'].browse(
28+ cr, uid, project_id, context=context)
29 if p:
30 res['value']['account_id'] = p.analytic_account_id.id
31 if p.to_invoice and not to_invoice:
32
33=== modified file 'timesheet_task/project_task_view.xml'
34--- timesheet_task/project_task_view.xml 2013-04-24 12:53:33 +0000
35+++ timesheet_task/project_task_view.xml 2014-05-06 08:39:54 +0000
36@@ -76,7 +76,7 @@
37 required="1" invisible="1"/>
38 <field name="name" />
39 <field name="unit_amount"
40- on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id, parent.id, to_invoice)"
41+ on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id, parent.id, to_invoice, parent.project_id, context)"
42 sum="Total time" widget="float_time" />
43 <field name="date"
44 on_change="on_change_date(date)" />
45@@ -209,4 +209,4 @@
46 </record>
47
48 </data>
49-</openerp>
50\ No newline at end of file
51+</openerp>

Subscribers

People subscribed via source and target branches