diff --git a/oca_dependencies.txt b/oca_dependencies.txt new file mode 100644 index 0000000..3c22dc8 --- /dev/null +++ b/oca_dependencies.txt @@ -0,0 +1,3 @@ +# list the OCA project dependencies, one per line +# add a github url if you need a forked version +project diff --git a/project_indicators/README.rst b/project_indicators/README.rst new file mode 100644 index 0000000..77f03ce --- /dev/null +++ b/project_indicators/README.rst @@ -0,0 +1,53 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Project Indicators +================================================= + + +You can track your all the project status with the respective tasks list. +Also you can print the Project Tracking Report in PDF format. + + +For further information, please visit: + +* https://www.odoo.com/forum/help-1 + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/139/11.0 + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + + +Credits +======= + +Contributors +------------ + +* Camptocamp +* Serpent Consulting Services Pvt. Ltd. + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/project_indicators/__init__.py b/project_indicators/__init__.py new file mode 100644 index 0000000..cf606f6 --- /dev/null +++ b/project_indicators/__init__.py @@ -0,0 +1,9 @@ +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA +# @author Guewen Baconnier +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +############################################################################## + +from . import models +from . import report diff --git a/project_indicators/__manifest__.py b/project_indicators/__manifest__.py new file mode 100644 index 0000000..6d40d9f --- /dev/null +++ b/project_indicators/__manifest__.py @@ -0,0 +1,23 @@ +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA +# @author Guewen Baconnier +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +############################################################################## + + +{ + "name": "Project indicators", + "version": "11.0.1.0.0", + "author": "Camptocamp,Odoo Community Association (OCA)", + "category": "Generic Modules/Projects & Services", + "website": "http://camptocamp.com", + "license": "AGPL-3", + "depends": ['sale_timesheet', + 'web'], + "data": ['views/project_view.xml', + 'views/report.xml', + 'report/project_tracking.xml'], + "application": False, + "installable": True, +} diff --git a/project_indicators/models/__init__.py b/project_indicators/models/__init__.py new file mode 100644 index 0000000..b87a163 --- /dev/null +++ b/project_indicators/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import project diff --git a/project_indicators/models/project.py b/project_indicators/models/project.py new file mode 100644 index 0000000..3354672 --- /dev/null +++ b/project_indicators/models/project.py @@ -0,0 +1,25 @@ +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA +# @author Guewen Baconnier +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +############################################################################## + +from odoo import models, fields, api + + +class ProjectTask(models.Model): + _inherit = 'project.task' + + @api.multi + @api.depends('delay_hours', 'planned_hours') + def _get_planning_error(self): + for task in self: + if task.delay_hours and task.planned_hours: + task.planning_error_percentage = round( + 100.0 * task.delay_hours / task.planned_hours, 2) + + planning_error_percentage = fields.Float( + compute='_get_planning_error', string='Error (%)', + group_operator="avg", + help="Computed as: Delay Hours / Planned Hours.") diff --git a/project_indicators/report/__init__.py b/project_indicators/report/__init__.py new file mode 100644 index 0000000..dc75964 --- /dev/null +++ b/project_indicators/report/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import project_tracking diff --git a/project_indicators/report/project_tracking.py b/project_indicators/report/project_tracking.py new file mode 100644 index 0000000..311021f --- /dev/null +++ b/project_indicators/report/project_tracking.py @@ -0,0 +1,68 @@ +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA +# @author Guewen Baconnier +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +############################################################################## + +import math +from odoo import models, api + + +class ProjectTrackingQwebReport(models.AbstractModel): + + _name = 'report.project_indicators.project_tracking' + + @api.multi + def float_time_convert(self, float_val): + sign = float_val < 0 and '-' or '' + hours = math.floor(abs(float_val)) + mins = round(abs(float_val) % 1 + 0.01, 2) + if mins >= 1.0: + hours += 1 + mins = 0.0 + else: + mins *= 60 + float_time = '%s%02d:%02d' % (sign, hours, mins) + return float_time + + @api.multi + def total_project_analysis(self, project_id): + res = {} + effective_hours = 0.0 + remaining_hours = 0.0 + total_hours = 0.0 + planned_hours = 0.0 + delay_hours = 0.0 + planning_error_percentage = 0.0 + for task in project_id.tasks: + effective_hours += task.effective_hours + remaining_hours += task.remaining_hours + total_hours += task.total_hours + planned_hours += task.planned_hours + delay_hours += task.delay_hours + planning_error_percentage += task.planning_error_percentage + res.update({'effective_hours': effective_hours, + 'remaining_hours': remaining_hours, + 'total_hours': total_hours, + 'planned_hours': planned_hours, + 'delay_hours': delay_hours, + 'planning_error_percentage': planning_error_percentage + }) + return [res] + + @api.model + def get_report_values(self, docids, data=None): + docs = self.env['project.project'].browse(docids) + if data is None: + data = {} + if not docids: + docids = data.get('docids') + return { + 'doc_ids': docids, + 'doc_model': 'project.project', + 'data': data, + 'docs': docs, + 'float_time_convert': self.float_time_convert, + 'total_project': self.total_project_analysis + } diff --git a/project_indicators/report/project_tracking.xml b/project_indicators/report/project_tracking.xml new file mode 100644 index 0000000..73825ec --- /dev/null +++ b/project_indicators/report/project_tracking.xml @@ -0,0 +1,55 @@ + + + + diff --git a/project_indicators/views/project_view.xml b/project_indicators/views/project_view.xml new file mode 100644 index 0000000..162d388 --- /dev/null +++ b/project_indicators/views/project_view.xml @@ -0,0 +1,46 @@ + + + #--------------------------------------------------------------------------------------------------------- + # Add useful fields on task view tree + #--------------------------------------------------------------------------------------------------------- + + project.task.tree.time.fields + project.task + tree + + + + + + + + + + + + + + + + + + + + + #--------------------------------------------------------------------------------------------------------- + # Add useful fields on task view form + #--------------------------------------------------------------------------------------------------------- + + project.task.form.time.fields + project.task + form + + + + + + + + + + diff --git a/project_indicators/views/report.xml b/project_indicators/views/report.xml new file mode 100644 index 0000000..39500a4 --- /dev/null +++ b/project_indicators/views/report.xml @@ -0,0 +1,11 @@ + + + + + +