diff --git a/project_task_timer/__manifest__.py b/project_task_timer/__manifest__.py index cde0465b9..a34f4ec95 100644 --- a/project_task_timer/__manifest__.py +++ b/project_task_timer/__manifest__.py @@ -22,7 +22,7 @@ ############################################################################## { 'name': 'Project Task Timer', - 'version': '10.0.2.0', + 'version': '10.0.3.0', 'summary': """Task Timer With Start & Stop""", 'description': """"This module helps you to track time sheet in project automatically.""", 'category': 'Project', diff --git a/project_task_timer/doc/changelog.rst b/project_task_timer/doc/changelog.rst index 0e1ce0b12..e24b44056 100644 --- a/project_task_timer/doc/changelog.rst +++ b/project_task_timer/doc/changelog.rst @@ -6,3 +6,6 @@ Changelog ------------ - Timer unit changed to minutes (To compact time sheet). +`10.0.3.0.0` +------------ +- Windows Platform Issue: Xpath Changed in XML view. \ No newline at end of file diff --git a/project_task_timer/models/project_task_timer.py~ b/project_task_timer/models/project_task_timer.py~ deleted file mode 100644 index e50be10b3..000000000 --- a/project_task_timer/models/project_task_timer.py~ +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Cybrosys Technologies Pvt. Ltd. -# Copyright (C) 2017-TODAY Cybrosys Technologies(). -# Author: Jesni Banu() -# you can modify it under the terms of the GNU LESSER -# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. -# -# It is forbidden to publish, distribute, sublicense, or sell copies -# of the Software or modified copies of the Software. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. -# -# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE -# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. -# If not, see . -# -############################################################################## -from datetime import datetime -from odoo import models, fields, api - - -class ProjectTaskTimeSheet(models.Model): - _inherit = 'account.analytic.line' - - date_start = fields.Datetime(string='Start Date') - date_end = fields.Datetime(string='End Date', readonly=1) - timer_duration = fields.Float(invisible=1) - - -class ProjectTaskTimer(models.Model): - _inherit = 'project.task' - - def _compute_is_user_working(self): - """ Checks whether the current user is working """ - for order in self: - if order.timesheet_ids.filtered(lambda x: (x.user_id.id == self.env.user.id) and (not x.date_end)): - order.is_user_working = True - else: - order.is_user_working = False - - @api.multi - @api.depends('timesheet_ids.timer_duration') - def _compute_duration(self): - self.duration = 0 - for each in self: - each.duration = sum(each.timesheet_ids.mapped('timer_duration')) - - @api.multi - def toggle_start(self): - for record in self: - record.task_timer = not record.task_timer - if self.task_timer: - self.write({'is_user_working': True}) - time_line = self.env['account.analytic.line'] - for time_sheet in self: - time_line.create({ - 'name': self.env.user.name + ': ' + time_sheet.name, - 'task_id': time_sheet.id, - 'user_id': self.env.user.id, - 'project_id': time_sheet.project_id.id, - 'date_start': datetime.now(), - }) - else: - self.write({'is_user_working': False}) - time_line_obj = self.env['account.analytic.line'] - domain = [('task_id', 'in', self.ids), ('date_end', '=', False)] - for time_line in time_line_obj.search(domain): - time_line.write({'date_end': fields.Datetime.now()}) - if time_line.date_end: - diff = fields.Datetime.from_string(time_line.date_end) - fields.Datetime.from_string( - time_line.date_start) - time_line.timer_duration = round(diff.total_seconds() / 60.0, 2) - time_line.unit_amount = round(diff.total_seconds() / (60.0 * 60.0), 2) - else: - time_line.unit_amount = 0.0 - time_line.timer_duration = 0.0 - - task_timer = fields.Boolean() - is_user_working = fields.Boolean( - 'Is Current User Working', compute='_compute_is_user_working', - help="Technical field indicating whether the current user is working. ") - duration = fields.Float( - 'Real Duration', compute='_compute_duration', - readonly=True, store=True) - - - - - diff --git a/project_task_timer/views/project_task_timer_view.xml b/project_task_timer/views/project_task_timer_view.xml index ad99c1e0e..9285da7de 100644 --- a/project_task_timer/views/project_task_timer_view.xml +++ b/project_task_timer/views/project_task_timer_view.xml @@ -18,15 +18,6 @@ }}'/> - - - @@ -40,6 +31,15 @@ + + +