openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #06550
[Merge] lp:~akretion-team/hr-timesheet/70-fix-timesheet-task-bug1316456 into lp:hr-timesheet
Alexis de Lattre has proposed merging lp:~akretion-team/hr-timesheet/70-fix-timesheet-task-bug1316456 into lp:hr-timesheet.
Requested reviews:
HR Core Editors (hr-core-editors)
Related bugs:
Bug #1316456 in HR - Timesheet Management: "hr_timesheet_task : can't save new task : "Analytic Account" field is invalid"
https://bugs.launchpad.net/hr-timesheet/+bug/1316456
For more details, see:
https://code.launchpad.net/~akretion-team/hr-timesheet/70-fix-timesheet-task-bug1316456/+merge/218364
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.
--
https://code.launchpad.net/~akretion-team/hr-timesheet/70-fix-timesheet-task-bug1316456/+merge/218364
Your team HR Core Editors is requested to review the proposed merge of lp:~akretion-team/hr-timesheet/70-fix-timesheet-task-bug1316456 into lp:hr-timesheet.
=== modified file 'timesheet_task/project_task.py'
--- timesheet_task/project_task.py 2013-10-08 11:06:18 +0000
+++ timesheet_task/project_task.py 2014-05-06 08:39:54 +0000
@@ -135,7 +135,8 @@
_name = "hr.analytic.timesheet"
def on_change_unit_amount(self, cr, uid, sheet_id, prod_id, unit_amount, company_id,
- unit=False, journal_id=False, task_id=False, to_invoice=False,
+ unit=False, journal_id=False, task_id=False,
+ to_invoice=False, project_id=False,
context=None):
res = super(HrAnalyticTimesheet, self).on_change_unit_amount(cr,
uid,
@@ -146,9 +147,14 @@
unit,
journal_id,
context)
- if 'value' in res and task_id:
- task_obj = self.pool.get('project.task')
- p = task_obj.browse(cr, uid, task_id).project_id
+ if 'value' in res and (task_id or project_id):
+ if task_id:
+ task_obj = self.pool.get('project.task')
+ p = task_obj.browse(
+ cr, uid, task_id, context=context).project_id
+ elif project_id:
+ p = self.pool['project.project'].browse(
+ cr, uid, project_id, context=context)
if p:
res['value']['account_id'] = p.analytic_account_id.id
if p.to_invoice and not to_invoice:
=== modified file 'timesheet_task/project_task_view.xml'
--- timesheet_task/project_task_view.xml 2013-04-24 12:53:33 +0000
+++ timesheet_task/project_task_view.xml 2014-05-06 08:39:54 +0000
@@ -76,7 +76,7 @@
required="1" invisible="1"/>
<field name="name" />
<field name="unit_amount"
- on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id, parent.id, to_invoice)"
+ on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id, parent.id, to_invoice, parent.project_id, context)"
sum="Total time" widget="float_time" />
<field name="date"
on_change="on_change_date(date)" />
@@ -209,4 +209,4 @@
</record>
</data>
-</openerp>
\ No newline at end of file
+</openerp>
Follow ups