diff --git a/helpdesk_mgmt_timesheet/__manifest__.py b/helpdesk_mgmt_timesheet/__manifest__.py index d748ad130b..9136443bca 100644 --- a/helpdesk_mgmt_timesheet/__manifest__.py +++ b/helpdesk_mgmt_timesheet/__manifest__.py @@ -15,7 +15,7 @@ "website": "https://github.com/OCA/helpdesk", "license": "AGPL-3", "category": "After-Sales", - "version": "14.0.1.0.1", + "version": "16.0.1.0.0", "depends": [ "helpdesk_mgmt_project", "hr_timesheet", diff --git a/helpdesk_mgmt_timesheet/demo/helpdesk_mgmt_timesheet_demo.xml b/helpdesk_mgmt_timesheet/demo/helpdesk_mgmt_timesheet_demo.xml index efbadd1b15..a496dffbab 100644 --- a/helpdesk_mgmt_timesheet/demo/helpdesk_mgmt_timesheet_demo.xml +++ b/helpdesk_mgmt_timesheet/demo/helpdesk_mgmt_timesheet_demo.xml @@ -1,38 +1,36 @@ - - - - Helpdesk general project - - - Helpdesk general task - - - - - - - - - - - - - - - Initial analysis - - - - - - - - Resolution - - - - - - + + + Helpdesk general project + + + Helpdesk general task + + + + + + + + + + + + + + + Initial analysis + + + + + + + + Resolution + + + + + diff --git a/helpdesk_mgmt_timesheet/models/helpdesk_ticket.py b/helpdesk_mgmt_timesheet/models/helpdesk_ticket.py index 304682a3ae..d8bc1193ca 100644 --- a/helpdesk_mgmt_timesheet/models/helpdesk_ticket.py +++ b/helpdesk_mgmt_timesheet/models/helpdesk_ticket.py @@ -16,18 +16,16 @@ def _relation_with_timesheet_line(self): string="Allow Timesheet", related="team_id.allow_timesheet", ) - planned_hours = fields.Float(string="Planned Hours", tracking=True) + planned_hours = fields.Float(tracking=True) progress = fields.Float( compute="_compute_progress_hours", group_operator="avg", store=True, - string="Progress", ) remaining_hours = fields.Float( compute="_compute_progress_hours", readonly=True, store=True, - string="Remaining Hours", ) timesheet_ids = fields.One2many( comodel_name="account.analytic.line", @@ -35,7 +33,7 @@ def _relation_with_timesheet_line(self): string="Timesheet", ) total_hours = fields.Float( - compute="_compute_total_hours", readonly=True, store=True, string="Total Hours" + compute="_compute_total_hours", readonly=True, store=True ) last_timesheet_activity = fields.Date( compute="_compute_last_timesheet_activity", diff --git a/helpdesk_mgmt_timesheet/models/helpdesk_ticket_team.py b/helpdesk_mgmt_timesheet/models/helpdesk_ticket_team.py index 95be41eaba..32ac584e17 100644 --- a/helpdesk_mgmt_timesheet/models/helpdesk_ticket_team.py +++ b/helpdesk_mgmt_timesheet/models/helpdesk_ticket_team.py @@ -7,9 +7,7 @@ class HelpdeskTicketTeam(models.Model): _inherit = "helpdesk.ticket.team" - allow_timesheet = fields.Boolean( - string="Allow Timesheet", - ) + allow_timesheet = fields.Boolean() default_project_id = fields.Many2one( comodel_name="project.project", string="Default Project", diff --git a/helpdesk_mgmt_timesheet/tests/test_helpdesk_mgmt_timesheet.py b/helpdesk_mgmt_timesheet/tests/test_helpdesk_mgmt_timesheet.py index 8a76d0ec7f..2301a4a798 100644 --- a/helpdesk_mgmt_timesheet/tests/test_helpdesk_mgmt_timesheet.py +++ b/helpdesk_mgmt_timesheet/tests/test_helpdesk_mgmt_timesheet.py @@ -25,16 +25,7 @@ def setUpClass(cls): ) def generate_timesheet(self, ticket, hours=1.0, days_ago=0): - return self.env["account.analytic.line"].create( - { - "amount": 0, - "date": fields.Date.today() - timedelta(days=days_ago), - "name": "Test Timesheet", - "unit_amount": hours, - "ticket_id": ticket.id, - "project_id": ticket.project_id.id, - } - ) + return def generate_ticket(self): return self.env["helpdesk.ticket"].create( @@ -46,18 +37,37 @@ def generate_ticket(self): ) def test_helpdesk_mgmt_timesheet(self): + Timesheet = self.env["account.analytic.line"] ticket = self.generate_ticket() self.assertFalse(ticket.last_timesheet_activity) ticket._onchange_team_id() self.assertEqual(ticket.project_id.id, self.team_id.default_project_id.id) ticket.planned_hours = 5 days_ago = 1 - timesheet1 = self.generate_timesheet(ticket, hours=2, days_ago=days_ago) + timesheet1 = Timesheet.with_user().create( + { + "amount": 0, + "date": fields.Date.today() - timedelta(days=days_ago), + "name": "Test Timesheet", + "unit_amount": 2, + "ticket_id": ticket.id, + "project_id": ticket.project_id.id, + } + ) self.assertEqual( ticket.last_timesheet_activity, fields.Date.today() - timedelta(days=days_ago), ) - timesheet2 = self.generate_timesheet(ticket, hours=1) + timesheet2 = Timesheet.with_user().create( + { + "amount": 0, + "date": fields.Date.today() - timedelta(days=0), + "name": "Test Timesheet", + "unit_amount": 1, + "ticket_id": ticket.id, + "project_id": ticket.project_id.id, + } + ) self.assertEqual(ticket.last_timesheet_activity, fields.Date.today()) self.assertEqual( ticket.total_hours, timesheet1.unit_amount + timesheet2.unit_amount diff --git a/helpdesk_mgmt_timesheet/views/helpdesk_ticket_view.xml b/helpdesk_mgmt_timesheet/views/helpdesk_ticket_view.xml index 2e2f29203d..de25a45a1a 100644 --- a/helpdesk_mgmt_timesheet/views/helpdesk_ticket_view.xml +++ b/helpdesk_mgmt_timesheet/views/helpdesk_ticket_view.xml @@ -34,10 +34,6 @@ helpdesk.ticket.view.tree helpdesk.ticket - remaining_hours < 0 @@ -70,6 +66,7 @@ icon="fa-play-circle text-success" attrs="{'invisible': [('show_time_control', '!=', 'start')]}" class="oe_stat_button" + groups="hr_timesheet.group_hr_timesheet_user" />