Merge lp:~pedro.baeza/hr-timesheet/7.0-hr_timesheet_task-imp into lp:~hr-core-editors/hr-timesheet/7.0

Proposed by Pedro Manuel Baeza
Status: Merged
Merged at revision: 68
Proposed branch: lp:~pedro.baeza/hr-timesheet/7.0-hr_timesheet_task-imp
Merge into: lp:~hr-core-editors/hr-timesheet/7.0
Diff against target: 100 lines (+17/-38)
3 files modified
hr_timesheet_task/hr_analytic_timesheet_view.xml (+14/-35)
hr_timesheet_task/hr_timesheet_sheet_view.xml (+0/-1)
timesheet_task/project_task.py (+3/-2)
To merge this branch: bzr merge lp:~pedro.baeza/hr-timesheet/7.0-hr_timesheet_task-imp
Reviewer Review Type Date Requested Status
Stéphane Bidoul (Acsone) (community) code review, no test Approve
Yannick Vaucher @ Camptocamp code review, no test Approve
Review via email: mp+219821@code.launchpad.net

Description of the change

[FIX] hr_timesheet_sheet: Fix error if there is no project associated to task.
[FIX] hr_timesheet_sheet: Tree view for hr.analytic.timesheet inherited instead of overwritten, to allow other modules to modifiy this view (for example, hr_timesheet_department).
[IMP] hr_timesheet_sheet: Remove obsolete type labels on XML views.

To post a comment you must log in.
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Hello Pedro,

Can you explain the use case where you need to enter time on tasks in other state than done?

Domains such as this one may vary from a company to another, but I thought allowing only open tasks was a good default?

Thanks!

review: Needs Information (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I think now in two possible scenarios:

- Bad configured project provokes that initial state of a task is not set.
- There is a third person that inputs all times. I'm thinking now that tasks can be also even in done state, because inputation is done afterwards.

Do you think there is a better way?

Regards.

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

In that case I would change de domain in an additional module that is perhaps specific to your use case, because I believe current users of hr_timesheet_task expect to see only open tasks.

review: Needs Fixing
65. By Pedro Manuel Baeza

Domain of task field reverted to original state.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I have reverted back to original domain. Please review rest of the changes.

Regards.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) :
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 'hr_timesheet_task/hr_analytic_timesheet_view.xml'
2--- hr_timesheet_task/hr_analytic_timesheet_view.xml 2013-04-10 16:14:47 +0000
3+++ hr_timesheet_task/hr_analytic_timesheet_view.xml 2014-05-16 13:48:18 +0000
4@@ -1,56 +1,35 @@
5 <openerp>
6 <data>
7- #---------------------------------------------------------------------------------------------------------
8- # Add task on hr.analytic.timesheet
9- #---------------------------------------------------------------------------------------------------------
10- <record id="hr_timesheet_line_form" model="ir.ui.view">
11+ <!-- Add task on hr.analytic.timesheet -->
12+ <record id="hr_timesheet_line_form" model="ir.ui.view">
13 <field name="name">hr.analytic.timesheet.form</field>
14 <field name="model">hr.analytic.timesheet</field>
15- <field name="type">form</field>
16 <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
17 <field name="arch" type="xml">
18 <field name="user_id" position="after">
19- <field name="task_id" context="{ 'account_id' : account_id}"
20- domain="[('state','=','open'), ('project_id.analytic_account_id','=',account_id)]"/>
21+ <field name="task_id"
22+ context="{'account_id': account_id}"
23+ domain="[('state', '=', 'open'), ('project_id.analytic_account_id','=',account_id)]"/>
24 </field>
25 </field>
26 </record>
27- <record id="hr_timesheet.hr_timesheet_line_tree" model="ir.ui.view">
28+ <record id="hr_timesheet_line_tree" model="ir.ui.view">
29 <field name="name">hr.analytic.timesheet.tree</field>
30 <field name="model">hr.analytic.timesheet</field>
31- <field name="type">tree</field>
32- <field name="priority">2</field>
33+ <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
34 <field name="arch" type="xml">
35- <tree editable="top" string="Timesheet Lines">
36- <field name="date" on_change="on_change_date(date)"/>
37- <field domain="[('type','=','normal'), ('state','=','open')]" name="account_id"/>
38- <field name="task_id" context="{'account_id' : account_id}"
39- domain="[('state','=','open'), ('project_id.analytic_account_id','=',account_id)]"/>
40- <field name="name"/>
41- <field name="unit_amount"
42- on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id, journal_id)"
43- sum="Total time" widget="float_time"/>
44- <field name="user_id" on_change="on_change_user_id(user_id)" required="1"/>
45- <field name="journal_id" invisible="1"/>
46- <field name="product_id"
47- on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id, journal_id)"
48- required="1" domain="[('type','=','service')]" invisible="1"/>
49- <field name="product_uom_id"
50- on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id, journal_id)"
51- invisible="1"/>
52- <field name="amount" sum="Total cost" invisible="1"/>
53- <field name="general_account_id" invisible="1"/>
54- </tree>
55+ <field name="account_id" position="after">
56+ <field name="task_id"
57+ context="{'account_id': account_id}"
58+ domain="[('state', '=', 'open'), ('project_id.analytic_account_id','=',account_id)]"/>
59+ </field>
60 </field>
61 </record>
62- #---------------------------------------------------------------------------------------------------------
63- # Add task on search hr.analytic.timesheet
64- #---------------------------------------------------------------------------------------------------------
65- <record id="hr_timesheet_line_search" model="ir.ui.view">
66+ <!-- Add task on search hr.analytic.timesheet -->
67+ <record id="hr_timesheet_line_search" model="ir.ui.view">
68 <field name="name">hr.analytic.timesheet.search</field>
69 <field name="model">hr.analytic.timesheet</field>
70 <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
71- <field name="type">search</field>
72 <field name="arch" type="xml">
73 <field name="date" position="after">
74 <field name="task_id"/>
75
76=== modified file 'hr_timesheet_task/hr_timesheet_sheet_view.xml'
77--- hr_timesheet_task/hr_timesheet_sheet_view.xml 2013-03-28 17:30:55 +0000
78+++ hr_timesheet_task/hr_timesheet_sheet_view.xml 2014-05-16 13:48:18 +0000
79@@ -6,7 +6,6 @@
80 <field name="name">hr_timesheet_sheet.sheet.filter</field>
81 <field name="model">hr_timesheet_sheet.sheet</field>
82 <field name="inherit_id" ref="hr_timesheet_sheet.view_hr_timesheet_sheet_filter"/>
83- <field name="type">search</field>
84 <field name="arch" type="xml">
85 <filter name="to_approve" position="after">
86 <separator orientation="vertical"/>
87
88=== modified file 'timesheet_task/project_task.py'
89--- timesheet_task/project_task.py 2014-05-06 08:36:59 +0000
90+++ timesheet_task/project_task.py 2014-05-16 13:48:18 +0000
91@@ -58,8 +58,9 @@
92 # project triggers on task are not called
93 res = super(ProjectTask, self)._store_set_values(cr, uid, ids, fields, context=context)
94 for row in self.browse(cr, SUPERUSER_ID, ids, context=context):
95- project = row.project_id
96- project.write({'parent_id': project.parent_id.id})
97+ if row.project_id:
98+ project = row.project_id
99+ project.write({'parent_id': project.parent_id.id})
100 return res
101
102

Subscribers

People subscribed via source and target branches