-
Notifications
You must be signed in to change notification settings - Fork 76
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
[ADD][BR1187][T24354]timesheet_activity_report_improve #211
base: 10.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
================================= | ||
Timesheet Activity Report Improve | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Timesheet completion report There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @elicoidal @lonelysun |
||
================================= | ||
|
||
This module extends the functionality of project adding a timesheet report listed at timesheet completion analysis. | ||
You can use this report to communicate the timesheet analysis to the project members. | ||
|
||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to have basic modules installed: | ||
|
||
* timesheet_activity_report | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/Elico-Corp/odoo-addons/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smash it by providing detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this section (only for OCA modules) |
||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
|
||
Contributors | ||
------------ | ||
|
||
* Eric Caudal <[email protected]> | ||
* Sébastien Maillard <[email protected]> | ||
* Miya Xing <[email protected]> | ||
|
||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://www.elico-corp.com/logo.png | ||
:alt: Elico Corp | ||
:target: https://www.elico-corp.com | ||
|
||
This module is maintained by Elico Corporation. | ||
|
||
Elico Corp is an innovative actor in China, Hong-Kong and Singapore servicing | ||
well known international companies and as well as local mid-sized businesses. | ||
Since 2010, our seasoned Sino-European consultants have been providing full | ||
range Odoo services: | ||
|
||
* Business consultancy for Gap analysis, BPM, operational work-flows review. | ||
* Ready-to-use ERP packages aimed at starting businesses. | ||
* Odoo implementation for manufacturing, international trading, service industry | ||
and e-commerce. | ||
* Connectors and integration with 3rd party software (Magento, Taobao, Coswin, | ||
Joomla, Prestashop, Tradevine etc...). | ||
* Odoo Support services such as developments, training, maintenance and hosting. | ||
|
||
Our headquarters are located in Shanghai with branch in Singapore servicing | ||
customers from all over Asia Pacific. | ||
|
||
Contact information: `Sales <[email protected]>`__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2017 Elico corp (https://www.elico-corp.com) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need copyright in init.py files |
||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2017 Elico corp (https://www.elico-corp.com) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
'name': 'Timesheet Activities Report', | ||
'version': '10.0.1.1.0', | ||
'category': 'Human Resources', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add Project Management |
||
'depends': [ | ||
'timesheet_activity_report', | ||
], | ||
'author': 'Elico Corp', | ||
'support': '[email protected]', | ||
'license': 'AGPL-3', | ||
'website': 'https://www.elico-corp.com', | ||
'data': [ | ||
'views/timesheet_report_improve.xml', | ||
'views/button_view.xml', | ||
], | ||
'installable': True, | ||
'application': True | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import timesheet_activity_report_improve | ||
from . import button_fuction |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File name |
||
# © 2016 Elico Corp | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models, api, _ | ||
|
||
|
||
class BRButtonFunction(models.Model): | ||
_inherit = "business.requirement" | ||
|
||
@api.multi | ||
def br_open_tms_activity_report(self): | ||
for record in self: | ||
domain = [('br_id', '=', record.id)] | ||
return { | ||
'name': _('BR_timesheet_activity_report'), | ||
'type': 'ir.actions.act_window', | ||
'view_type': 'form', | ||
'view_mode': 'graph', | ||
'res_model': 'timesheet.activity.report', | ||
'target': 'current', | ||
'domain': domain, | ||
} | ||
|
||
|
||
class ProjectButtonFunction(models.Model): | ||
_inherit = "project.project" | ||
|
||
@api.multi | ||
def project_open_tms_activity_rep(self): | ||
for record in self: | ||
domain = [('project_id', '=', record.id)] | ||
return { | ||
'name': _('Project_timesheet_activity_report'), | ||
'type': 'ir.actions.act_window', | ||
'view_type': 'form', | ||
'view_mode': 'graph', | ||
'res_model': 'timesheet.activity.report', | ||
'target': 'current', | ||
'domain': domain, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Elico Corp | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models, fields, api, tools | ||
|
||
|
||
class TimesheetReportImprove(models.Model): | ||
_inherit = 'timesheet.activity.report' | ||
|
||
br_master_project = fields.Many2one( | ||
'project.project', string='BR Master Pro.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pro. -> Project |
||
) | ||
br_status = fields.Selection( | ||
[('draft', 'Draft'), | ||
('confirmed', 'Confirmed'), | ||
('approved', 'Approved'), | ||
('stakeholder_approval', 'Stakeholder Approval'), | ||
('in_progress', 'In progress'), | ||
('done', 'Done'), | ||
('cancel', 'Cancel'), | ||
('drop', 'Drop')], | ||
string='BR status', | ||
) | ||
department_id = fields.Many2one('hr.department', string='Department') | ||
|
||
def _select(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @seb-elico please review this part |
||
select_str = """ | ||
SELECT | ||
ts.id, | ||
-- Check if the timesheet is linked to a task | ||
-- or an issue | ||
CASE WHEN (select id from project_task where id = al.task_id) | ||
IS NOT NULL THEN 'task' | ||
ELSE ( | ||
CASE WHEN (select id from project_issue where id = | ||
al.issue_id) IS NOT NULL THEN 'issue' | ||
-- Timesheet created in the timesheet | ||
-- activities panel | ||
ELSE ( | ||
CASE WHEN al.id IS NOT NULL THEN 'timesheet' | ||
-- No timesheet attached to this | ||
-- task/project/BR | ||
ELSE NULL | ||
END | ||
) | ||
END | ||
) | ||
END AS activity_type, | ||
-- Description from the task first | ||
-- because the one in the timesheet | ||
-- is wrong when it's linked to a task | ||
b.state AS br_status, | ||
b.project_id AS br_master_project, | ||
em.department_id AS department_id, | ||
CASE WHEN p.active = True THEN 'Active' | ||
WHEN p.active=False THEN 'Archived' END AS project_state, | ||
COALESCE((select name from project_task where id = | ||
al.task_id), al.name) AS description, | ||
al.unit_amount AS hours, | ||
al.user_id, | ||
al.product_id, | ||
al.date, | ||
al.project_id, | ||
COALESCE((select stage_id from project_task where id = | ||
al.task_id), (select stage_id from project_issue where id = | ||
al.issue_id)) AS activity_stage_id, | ||
COALESCE(a.id, al.account_id) AS account_id, | ||
COALESCE((select id from project_task where id = al.task_id), | ||
(select id from project_issue where id = al.issue_id)) | ||
AS activity_id, | ||
COALESCE((select name from project_task where id = | ||
al.task_id), (select name from project_issue where id = | ||
al.issue_id)) AS activity_name, | ||
(select categ_id from project_task where id = | ||
al.task_id) AS categ_id, | ||
b.id AS br_id, | ||
a.partner_id, | ||
(select project_categ_id from project_project where id = | ||
al.project_id) | ||
""" | ||
return select_str | ||
|
||
def _from(self): | ||
from_str = """ | ||
hr_timesheet_sheet_sheet ts | ||
LEFT OUTER JOIN account_analytic_line al | ||
ON ts.id = al.sheet_id | ||
LEFT OUTER JOIN account_analytic_account a | ||
ON a.id = al.account_id | ||
LEFT OUTER JOIN res_users ru | ||
ON ru.id = al.user_id | ||
LEFT OUTER JOIN res_partner rp | ||
on rp.id = ru.partner_id | ||
LEFT OUTER JOIN hr_employee em | ||
on em.name_related = rp.name | ||
LEFT OUTER JOIN project_project p | ||
on a.id = p.analytic_account_id | ||
LEFT OUTER JOIN business_requirement b | ||
ON b.id = (select business_requirement_id from project_project | ||
where id = al.project_id) | ||
""" | ||
return from_str | ||
|
||
@api.model_cr | ||
def init(self): | ||
tools.drop_view_if_exists(self.env.cr, self._table) | ||
self.env.cr.execute("""CREATE or REPLACE VIEW %s as ( | ||
%s | ||
FROM ( %s ) | ||
)""" % (self._table, self._select(), self._from())) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="view_business_requirement_form_improve" model="ir.ui.view"> | ||
<field name="name">business.requirement.form</field> | ||
<field name="model">business.requirement</field> | ||
<field name="inherit_id" | ||
ref="business_requirement.view_business_requirement_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr='//div[@name="buttons"]/button[1]' position='before'> | ||
<button class="oe_inline oe_stat_button" | ||
type="object" name="br_open_tms_activity_report" | ||
icon="fa-tasks" string="TMS Com. Rep"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TMS Completion Report |
||
</button> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
<record id="project_to_project_completion_report" model="ir.ui.view"> | ||
<field name="name">project.project.form</field> | ||
<field name="model">project.project</field> | ||
<field name="inherit_id" ref="project.edit_project"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr='//button[@name="toggle_active"]' position='before'> | ||
<button class="oe_inline oe_stat_button" | ||
type="object" name="project_open_tms_activity_rep" | ||
icon="fa-tasks" string="TMS Com. Rep" > | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here too |
||
</button> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version = "1.0" encoding = "utf-8"?> | ||
<odoo> | ||
<record id="action_timesheet_activity_tree_inherit" model="ir.ui.view"> | ||
<field name="name">timesheet.activity.report.tree</field> | ||
<field name="model">timesheet.activity.report</field> | ||
<field name="inherit_id" | ||
ref="timesheet_activity_report.action_timesheet_activity_tree"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='br_id']" position='after'> | ||
<field name="br_status" /> | ||
</xpath> | ||
<xpath expr="//field[@name='user_id']" position='after'> | ||
<field name="department_id" /> | ||
</xpath> | ||
<xpath expr="//field[@name='activity_id']" position='before'> | ||
<field name="br_master_project" /> | ||
</xpath> | ||
<xpath expr="//field[@name='account_id']" position = 'after'> | ||
<field name="project_state" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
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.
Are you sure this file should be here?