Skip to content

Commit

Permalink
[MIG] project_timesheet_time_control: Migration to 16.0
Browse files Browse the repository at this point in the history
Co-Authored-By: Stefan Ungureanu <stefan.ungureanu@tecnativa.com>
  • Loading branch information
aktiv-heli-kantawala authored and stefan-tecnativa committed Jul 10, 2023
1 parent 7e82526 commit d0b5283
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 73 deletions.
7 changes: 2 additions & 5 deletions project_timesheet_time_control/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@

{
"name": "Project timesheet time control",
"version": "15.0.1.1.0",
"version": "16.0.1.0.0",
"category": "Project",
"author": "Tecnativa," "Odoo Community Association (OCA)",
"maintainers": ["ernestotejeda"],
"website": "https://github.com/OCA/project",
"depends": [
"hr_timesheet_task_domain",
"hr_timesheet_task_stage",
"web_ir_actions_act_multi",
"web_ir_actions_act_view_reload",
"hr_timesheet",
],
"data": [
"security/ir.model.access.csv",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def test_project_time_control_flow(self):
with self.assertRaises(exceptions.UserError):
self.project.button_end_work()
# All lines stopped, start new one
self.task.invalidate_cache()
self.project.invalidate_cache()
self.assertEqual(self.project.show_time_control, "start")
start_action = self.project.button_start_work()
Expand Down Expand Up @@ -206,7 +207,6 @@ def test_task_time_control_flow(self):
with self.assertRaises(exceptions.UserError):
self.task.button_end_work()
# All lines stopped, start new one
self.task.invalidate_cache()
self.assertEqual(self.task.show_time_control, "start")
start_action = self.task.button_start_work()
wizard = self._create_wizard(start_action, self.task)
Expand Down Expand Up @@ -246,17 +246,7 @@ def test_wizard_standalone(self):
)
self.assertFalse(wizard.running_timer_id)
self.assertFalse(wizard.running_timer_duration)
new_act = wizard.action_switch()
self.assertEqual(
new_act,
{
"type": "ir.actions.act_multi",
"actions": [
{"type": "ir.actions.act_window_close"},
{"type": "ir.actions.act_view_reload"},
],
},
)
wizard.action_switch()
new_line = self.env["account.analytic.line"].search(
[
("name", "=", "Standalone 2"),
Expand Down
41 changes: 20 additions & 21 deletions project_timesheet_time_control/views/account_analytic_line_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,30 @@
<record id="hr_timesheet_line_form" model="ir.ui.view">
<field name="name">account.analytic.line.form.inherit</field>
<field name="model">account.analytic.line</field>
<field
name="inherit_id"
ref="hr_timesheet_task_stage.account_analytic_line_form"
/>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form" />
<field name="arch" type="xml">
<div name="button_box" position="inside">
<xpath expr="//sheet/group" position="before">
<div class="oe_button_box" name="button_box">
<field name="show_time_control" invisible="1" />
<button
name="button_resume_work"
type="object"
icon="fa-play-circle text-success"
attrs="{'invisible': [('show_time_control', '!=', 'resume')]}"
class="oe_stat_button"
context="{'show_created_timer': True}"
title="Resume work"
/>
name="button_resume_work"
type="object"
icon="fa-play-circle text-success"
attrs="{'invisible': [('show_time_control', '!=', 'resume')]}"
class="oe_stat_button"
context="{'show_created_timer': True}"
title="Resume work"
/>
<button
name="button_end_work"
type="object"
icon="fa-stop-circle text-warning"
attrs="{'invisible': [('show_time_control', '!=', 'stop')]}"
class="oe_stat_button"
title="Stop work"
/>
</div>
name="button_end_work"
type="object"
icon="fa-stop-circle text-warning"
attrs="{'invisible': [('show_time_control', '!=', 'stop')]}"
class="oe_stat_button"
title="Stop work"
/>
</div>
</xpath>
<field name="date" position="attributes">
<attribute name="invisible">1</attribute>
</field>
Expand Down
12 changes: 0 additions & 12 deletions project_timesheet_time_control/views/project_project_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
<field name="name">Add timesheet time controls</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="hr_timesheet.project_invoice_form" />
<field
name="groups_id"
eval="[(6, 0, [ref('hr_timesheet.group_hr_timesheet_user')])]"
/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<field name="show_time_control" invisible="1" />
Expand Down Expand Up @@ -36,10 +32,6 @@
<field name="name">Add timesheet time controls</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="hr_timesheet.view_project_kanban_inherited" />
<field
name="groups_id"
eval="[(6, 0, [ref('hr_timesheet.group_hr_timesheet_user')])]"
/>
<field name="arch" type="xml">
<xpath expr="//*[hasclass('o_project_kanban_boxes')]" position="inside">
<field name="show_time_control" invisible="1" />
Expand Down Expand Up @@ -78,10 +70,6 @@
<field name="name">Add timesheet time controls</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.view_project" />
<field
name="groups_id"
eval="[(6, 0, [ref('hr_timesheet.group_hr_timesheet_user')])]"
/>
<field name="arch" type="xml">
<tree position="inside">
<field name="show_time_control" invisible="1" />
Expand Down
12 changes: 0 additions & 12 deletions project_timesheet_time_control/views/project_task_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
<field name="name">Add timesheet time controls</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited" />
<field
name="groups_id"
eval="[(6, 0, [ref('hr_timesheet.group_hr_timesheet_user')])]"
/>
<field name="arch" type="xml">
<!-- Main task form action buttons -->
<div name="button_box" position="inside">
Expand Down Expand Up @@ -148,10 +144,6 @@
<field name="name">Add timesheet time controls</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_kanban" />
<field
name="groups_id"
eval="[(6, 0, [ref('hr_timesheet.group_hr_timesheet_user')])]"
/>
<field name="arch" type="xml">
<xpath expr="//*[hasclass('oe_kanban_bottom_left')]" position="inside">
<field name="show_time_control" invisible="1" />
Expand All @@ -178,10 +170,6 @@
<field name="name">Add timesheet time controls</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="hr_timesheet.view_task_tree2_inherited" />
<field
name="groups_id"
eval="[(6, 0, [ref('hr_timesheet.group_hr_timesheet_user')])]"
/>
<field name="arch" type="xml">
<tree position="inside">
<field name="show_time_control" invisible="1" />
Expand Down
8 changes: 0 additions & 8 deletions project_timesheet_time_control/wizards/hr_timesheet_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,3 @@ def action_switch(self):
"view_type": "form",
"views": [(form_view.id, "form")],
}
# Close wizard and reload view
return {
"type": "ir.actions.act_multi",
"actions": [
{"type": "ir.actions.act_window_close"},
{"type": "ir.actions.act_view_reload"},
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<field name="project_id" required="1" />
<field name="task_id" />
<field name="company_id" groups="base.group_multi_company" />
<field name="company_id" invisible="1" />
</group>
<group
<div
name="messages"
string="Previous timer"
attrs="{'invisible': [('running_timer_id', '=', False)]}"
>
<p>
Expand Down Expand Up @@ -64,7 +64,7 @@
>
That is a lot of time! Make sure it is fine before saving.
</div>
</group>
</div>
</sheet>
<!-- Footer buttons -->
<footer>
Expand Down

0 comments on commit d0b5283

Please sign in to comment.