@ -0,0 +1,52 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Timesheet PDF Report |
|||
==================== |
|||
This module allows to print the timesheet of selected employee. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
Lesser General Public License, Version 3 (LGPL v3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: Kavya Raveendran |
|||
(V14) Muhammed P |
|||
(V15) Abhishek E T |
|||
(V16) Sumith Sivan |
|||
(V17) Ajith V |
|||
(V18) Jumana Jabin MP |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Jumana Jabin MP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import report |
|||
from . import wizard |
@ -0,0 +1,47 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Jumana Jabin MP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
'name': 'Timesheet PDF Report', |
|||
'version': '18.0.1.0.0', |
|||
"category": "Project", |
|||
'sequence': 25, |
|||
'summary': 'Timesheet PDF Report of Employees', |
|||
'description': 'Comprehensive timesheet PDF report summarizing employee ' |
|||
'work hours and activities for efficient tracking and ' |
|||
'management.', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['hr', 'hr_timesheet'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'report/timesheet_templates.xml', |
|||
'report/timesheet_reports.xml', |
|||
'wizard/timesheet_report_views.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <timesheets_by_employee> |
|||
|
|||
#### 01.10.2024 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial commit for Timesheet PDF Report |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Jumana Jabin MP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import timesheet_report |
@ -0,0 +1,102 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Jumana Jabin MP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, models |
|||
|
|||
|
|||
class ReportTimesheet(models.AbstractModel): |
|||
"""Create an Abstract Class for report data to pass to the templates""" |
|||
_name = 'report.timesheets_by_employee.report_timesheet_employee' |
|||
_description = 'Timesheet Report' |
|||
|
|||
def get_timesheets(self, docs): |
|||
"""Input : name of employee, the starting date and ending date |
|||
output: timesheet by that particular employee within that period and |
|||
the total duration""" |
|||
if docs.from_date and docs.to_date: |
|||
record = self.env['account.analytic.line'].search( |
|||
[('user_id', '=', docs.user_id[0].id), |
|||
('date', '>=', docs.from_date), ('date', '<=', docs.to_date)]) |
|||
elif docs.from_date: |
|||
record = self.env['account.analytic.line'].search( |
|||
[('user_id', '=', docs.user_id[0].id), |
|||
('date', '>=', docs.from_date)]) |
|||
elif docs.to_date: |
|||
record = self.env['account.analytic.line'].search( |
|||
[('user_id', '=', docs.user_id[0].id), |
|||
('date', '<=', docs.to_date)]) |
|||
else: |
|||
record = self.env['account.analytic.line'].search( |
|||
[('user_id', '=', docs.user_id[0].id)]) |
|||
records = [] |
|||
total = 0 |
|||
for rec in record: |
|||
vals = {'project': rec.project_id.name, |
|||
'user': rec.user_id.partner_id.name, |
|||
'duration': rec.unit_amount, |
|||
'date': rec.date, |
|||
} |
|||
total += rec.unit_amount |
|||
records.append(vals) |
|||
return [records, total] |
|||
|
|||
@api.model |
|||
def _get_report_values(self, docids, data=None): |
|||
"""Overwriting this function because we need to show values from other |
|||
models in the report we pass the objects in the docargs dictionary""" |
|||
docs = self.env['timesheet.report'].browse( |
|||
self.env.context.get('active_id')) |
|||
identification = [] |
|||
for rec in self.env['hr.employee'].search( |
|||
[('user_id', '=', docs.user_id[0].id)]): |
|||
if rec: |
|||
identification.append({'id': rec.id, 'name': rec.name}) |
|||
timesheets = self.get_timesheets(docs) |
|||
company_id = self.env['res.company'].search( |
|||
[('name', '=', docs.user_id[0].company_id.name)]) |
|||
period = None |
|||
if docs.from_date and docs.to_date: |
|||
period = "From " + str(docs.from_date) + " To " + str(docs.to_date) |
|||
elif docs.from_date: |
|||
period = "From " + str(docs.from_date) |
|||
elif docs.to_date: |
|||
period = "To " + str(docs.to_date) |
|||
if len(identification) > 1: |
|||
return { |
|||
'doc_ids': self.ids, |
|||
'docs': docs, |
|||
'timesheets': timesheets[0], |
|||
'total': timesheets[1], |
|||
'company': company_id, |
|||
'identification': identification, |
|||
'period': period, |
|||
'data': data, |
|||
} |
|||
else: |
|||
return { |
|||
'doc_ids': self.ids, |
|||
'docs': docs, |
|||
'timesheets': timesheets[0], |
|||
'total': timesheets[1], |
|||
'identification': identification, |
|||
'company': company_id, |
|||
'period': period, |
|||
} |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Create an action for printing pdf report--> |
|||
<record id="action_report_print_timesheets" model="ir.actions.report"> |
|||
<field name="name">Timesheets</field> |
|||
<field name="model">timesheet.report</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">timesheets_by_employee.report_timesheet_employee</field> |
|||
<field name="report_file">timesheets_by_employee.report_timesheet_employee</field> |
|||
<field name="binding_model_id" ref="model_timesheet_report"/> |
|||
<field name="binding_type">report</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,63 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Create a template for display the pdf report design--> |
|||
<template id="timesheets_by_employee.report_timesheet_employee"> |
|||
<t t-call="web.html_container"> |
|||
<t t-call="web.external_layout"> |
|||
<t t-foreach="docs" t-as="o"> |
|||
<div class="page"> |
|||
<div style="padding-bottom:20px !important;" |
|||
class="oe_structure"/> |
|||
<h2 align="center">Timesheet Report by Employees</h2> |
|||
<br/> |
|||
<table class="table table-condensed"> |
|||
<tbody> |
|||
<tr t-if="identification"> |
|||
<th>Employee Name</th> |
|||
<td colspan="2"> |
|||
<span t-esc="identification[0]['name']"/> |
|||
</td> |
|||
<th>Company Name</th> |
|||
<td> |
|||
<span t-esc="company.name"/> |
|||
</td> |
|||
</tr> |
|||
<tr t-if="identification"> |
|||
<th>Timesheet Period</th> |
|||
<td colspan="2"> |
|||
<span t-esc="period"/> |
|||
</td> |
|||
<th>Total Working Hours</th> |
|||
<td> |
|||
<span t-esc="total"/> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<table class="table table-condensed"> |
|||
<tbody> |
|||
<tr> |
|||
<th>Date</th> |
|||
<th>Project</th> |
|||
<th>Worked Time</th> |
|||
</tr> |
|||
<tr t-foreach="timesheets" t-as="t"> |
|||
<td> |
|||
<span t-esc="t['date']"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="t['project']"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="t['duration']"/> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
</odoo> |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 723 KiB |
After Width: | Height: | Size: 46 KiB |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Jumana Jabin MP(odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import timesheet_report |
@ -0,0 +1,59 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Jumana Jabin MP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
from odoo.exceptions import UserError |
|||
from datetime import date |
|||
|
|||
|
|||
class TimesheetReport(models.TransientModel): |
|||
"""Create a Transient model for Wizard""" |
|||
_name = 'timesheet.report' |
|||
_description = 'Timesheet Report Wizard' |
|||
|
|||
user_id = fields.Many2one( |
|||
'res.users', |
|||
string="Employee", |
|||
required=True, help="You can select the employee") |
|||
from_date = fields.Date( |
|||
string="Starting Date", |
|||
help="You can select the starting dates for the PDF report") |
|||
to_date = fields.Date( |
|||
string="Ending Date", |
|||
help="You can select the ending dates for the PDF report") |
|||
|
|||
def print_timesheet(self): |
|||
"""Redirects to the report with the values obtained from the wizard |
|||
'data['form']': name of employee and the date duration""" |
|||
today = fields.Date.today() |
|||
if self.from_date and self.to_date: |
|||
if self.from_date > self.to_date: |
|||
raise UserError("Start date cannot be after end date.") |
|||
if self.from_date > today or self.to_date > today: |
|||
raise UserError("Start date and end date cannot be in the future.") |
|||
data = { |
|||
'employee': self.user_id.id, |
|||
'start_date': self.from_date, |
|||
'end_date': self.to_date, |
|||
} |
|||
return self.env.ref( |
|||
'timesheets_by_employee.action_report_print_timesheets'). \ |
|||
report_action(self, data=data) |
@ -0,0 +1,42 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<odoo> |
|||
<!-- Create a wizard form view in timesheet module--> |
|||
<record id="timesheet_report_view_form" model="ir.ui.view"> |
|||
<field name="name">timesheet.report.view.form</field> |
|||
<field name="model">timesheet.report</field> |
|||
<field name="arch" type="xml"> |
|||
<form> |
|||
<group> |
|||
<group string="Select Employee"> |
|||
<field name="user_id"/> |
|||
</group> |
|||
<group string="Select Date"> |
|||
<field name="from_date"/> |
|||
<field name="to_date"/> |
|||
</group> |
|||
<footer> |
|||
<button string="Print Timesheet" |
|||
name="print_timesheet" type="object" |
|||
class="btn-primary"/> |
|||
<button string="Discard" class="btn-default" |
|||
special="cancel"/> |
|||
</footer> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<!--Create an action for timesheet report--> |
|||
<record id="timesheet_report_action" |
|||
model="ir.actions.act_window"> |
|||
<field name="name">Timesheet Report</field> |
|||
<field name="res_model">timesheet.report</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="timesheet_report_view_form"/> |
|||
<field name="target">new</field> |
|||
</record> |
|||
<!-- Add a new menu item in timesheet reporting.--> |
|||
<menuitem name="Print Employee Timesheet" id="timesheet_report_menu" |
|||
action="timesheet_report_action" |
|||
parent="hr_timesheet.menu_timesheets_reports"/> |
|||
</odoo> |