-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.0] [MIG] project_indicators: Migrated module in v11. #26
Open
Chandresh-SerpentCS
wants to merge
14
commits into
OCA:11.0
Choose a base branch
from
Chandresh-SerpentCS:11.0-MIG-project_indicators
base: 11.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3177520
[ADD] First commit of the first generic modules to move in our new pu…
jgrandguillaume 83d30e9
[IMP] Little patch from Ferdinand to correct the color used in projec…
jgrandguillaume 556d5f6
[MRG] from 6.1
14124ec
[MRG] from upstream
a198d86
Merge from upstream
sbidoul 5177a61
[MIGR] created 7.0 branch, marked modules as not installable
gurneyalex 7948ff9
[FIX] project_indicators - add encoding on mako template to fix trans…
yvaucher 0462c33
[REF] auto-fix conventions
moylop260 ef95427
[FIX] Travis
pedrobaeza 593de9d
[PRT] Move modules to __unported__ for 8.0 branch creation
ddfbc30
[MOV] move addons out of __unported__ (they remain not installable)
sbidoul 8f17059
[MIG] Rename manifest files
pedrobaeza 98113af
[MIG] Migrated project_indicators module in v11.
Chandresh-SerpentCS 00a425e
[ADD] Added runbot link.
Chandresh-SerpentCS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# list the OCA project dependencies, one per line | ||
# add a github url if you need a forked version | ||
project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <https://github.com/OCA/project-reporting/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 <https://github.com/OCA/project-reporting/issues/new?body=module:%20project_billing_utils%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Camptocamp <[email protected]> | ||
* Serpent Consulting Services Pvt. Ltd. <[email protected]> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import project_tracking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<template id="project_tracking"> | ||
<t t-call="web.html_container"> | ||
<t t-foreach="docs" t-as="project"> | ||
<t t-call="web.external_layout"> | ||
<div class="page"> | ||
<br/> | ||
<br/> | ||
<div style="text-align:center"><b>Project:<t t-esc="project.name"/></b></div> | ||
<br/> | ||
<table class="table table-bordered table-condensed" width="100%"> | ||
<tr style="background-color:#D9D8CA;"> | ||
<td style="border: 1px solid #000000;text-align:center;width:100%;" colspan="2"><b>Total (With Timesheets)</b></td> | ||
</tr> | ||
</table> | ||
<br/> | ||
<br/> | ||
<table class="table table-bordered table-condensed" width="100%"> | ||
<tr style="background-color:#D9D8CA;text-align:center;"> | ||
<td style="border: 1px solid #000000;"><b>Task</b></td> | ||
<td style="border: 1px solid #000000;"><b>Status</b></td> | ||
<td style="border: 1px solid #000000;"><b>Hours Spent</b></td> | ||
<td style="border: 1px solid #000000;"><b>Remaining Hours</b></td> | ||
<td style="border: 1px solid #000000;"><b>Total Hours</b></td> | ||
<td style="border: 1px solid #000000;"><b>Planned Hours</b></td> | ||
<td style="border: 1px solid #000000;"><b>Delay Hours</b></td> | ||
<td style="border: 1px solid #000000;"><b>Error (%)</b></td> | ||
</tr> | ||
<tr style="text-align:center;" t-foreach="project.tasks" t-as="task"> | ||
<td style="border: 1px solid #000000;"><span t-esc="task.name"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="task.stage_id and task.stage_id.name or ''"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="float_time_convert(task.effective_hours)"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="task.remaining_hours < 0 and 'exceeded' or ''"/><span t-esc="float_time_convert(task.remaining_hours)"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="float_time_convert(task.total_hours)"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="float_time_convert(task.planned_hours)"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="float_time_convert(task.delay_hours)"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="task.planning_error_percentage or 0"/></td> | ||
</tr> | ||
<tr style="text-align:center;" t-foreach="total_project(project)" t-as="task_total"> | ||
<td style="border: 1px solid #000000;" colspan="2"><b>Totals</b></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="float_time_convert(task_total['effective_hours'])"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="float_time_convert(task_total['total_hours'] - task_total['effective_hours'])"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="float_time_convert(task_total['total_hours'])"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="float_time_convert(task_total['planned_hours'])"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="float_time_convert(task_total['total_hours'] - task_total['planned_hours'])"/></td> | ||
<td style="border: 1px solid #000000;"><span t-esc="task_total['planned_hours'] and round((task_total['total_hours'] - task_total['planned_hours']) / task_total['planned_hours'] * 100, 2) or 0"/></td> | ||
</tr> | ||
</table> | ||
</div> | ||
</t> | ||
</t> | ||
</t> | ||
</template> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
#--------------------------------------------------------------------------------------------------------- | ||
# Add useful fields on task view tree | ||
#--------------------------------------------------------------------------------------------------------- | ||
<record id="view_task_tree2_time_fields" model="ir.ui.view"> | ||
<field name="name">project.task.tree.time.fields</field> | ||
<field name="model">project.task</field> | ||
<field name="type">tree</field> | ||
<field name="inherit_id" ref="project.view_task_tree2" /> | ||
<field name="arch" type="xml"> | ||
<data> | ||
<field name="planned_hours" position="replace"> | ||
<field name="planned_hours" widget="float_time" sum="Planned Hours" /> | ||
</field> | ||
<field name="total_hours" position="replace"> | ||
<field name="total_hours" widget="float_time" sum="Total Hours" /> | ||
</field> | ||
<field name="effective_hours" position="replace"> | ||
<field name="effective_hours" widget="float_time" sum="Spent Hours"/> | ||
</field> | ||
<field name="remaining_hours" position="after"> | ||
<field name="delay_hours" widget="float_time" sum="Delay Hours"/> | ||
<field name="planning_error_percentage" sum="Percentage Error"/> | ||
</field> | ||
</data> | ||
</field> | ||
</record> | ||
|
||
#--------------------------------------------------------------------------------------------------------- | ||
# Add useful fields on task view form | ||
#--------------------------------------------------------------------------------------------------------- | ||
<record id="view_task_form2_time_fields" model="ir.ui.view"> | ||
<field name="name">project.task.form.time.fields</field> | ||
<field name="model">project.task</field> | ||
<field name="type">form</field> | ||
<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited" /> | ||
<field name="arch" type="xml"> | ||
<field name="progress" position="after"> | ||
<field name="delay_hours" widget="float_time" sum="Delay Hours"/> | ||
<field name="planning_error_percentage" sum="Percentage Error"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<report auto="False" | ||
id="report_project_tracking_indicator" | ||
model="project.project" | ||
name="project_indicators.project_tracking" | ||
string="Project Tracking" | ||
report_type="qweb-pdf"/> | ||
|
||
</odoo> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kindly add usage section so it will help end user to check on runbot.
https://raw.githubusercontent.com/OCA/maintainer-tools/master/template/module/README.rst