14 changed files with 405 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
import report |
||||
|
import wizard |
@ -0,0 +1,41 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
{ |
||||
|
'name': 'Timesheet PDF Report', |
||||
|
'version': '10.0.1.0.0', |
||||
|
'category': 'Human Resource', |
||||
|
'sequence': 25, |
||||
|
'summary': 'Timesheet PDF Report of Employee', |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'website': 'www.cybrosys.com', |
||||
|
'depends': ['hr_timesheet'], |
||||
|
'data': [ |
||||
|
'report/report_timesheets.xml', |
||||
|
'wizard/timesheet_wizard.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
import report_timesheets |
@ -0,0 +1,85 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from odoo import models, fields, api |
||||
|
|
||||
|
|
||||
|
class ReportTimesheet(models.AbstractModel): |
||||
|
_name = 'report.timesheets_by_employee.report_timesheets' |
||||
|
|
||||
|
def get_timesheets(self, docs): |
||||
|
"""input : name of employee and the starting date and ending date |
||||
|
output: timesheets by that particular employee within that period and the total duration""" |
||||
|
|
||||
|
if docs.from_date and docs.to_date: |
||||
|
rec = self.env['account.analytic.line'].search([('user_id', '=', docs.employee[0].id), |
||||
|
('date', '>=', docs.from_date),('date', '<=', docs.to_date)]) |
||||
|
elif docs.from_date: |
||||
|
rec = self.env['account.analytic.line'].search([('user_id', '=', docs.employee[0].id), |
||||
|
('date', '>=', docs.from_date)]) |
||||
|
elif docs.to_date: |
||||
|
rec = self.env['account.analytic.line'].search([('user_id', '=', docs.employee[0].id), |
||||
|
('date', '<=', docs.to_date)]) |
||||
|
else: |
||||
|
rec = self.env['account.analytic.line'].search([('user_id', '=', docs.employee[0].id)]) |
||||
|
records = [] |
||||
|
total = 0 |
||||
|
for r in rec: |
||||
|
vals = {'project': r.project_id.name, |
||||
|
'user': r.user_id.partner_id.name, |
||||
|
'duration': r.unit_amount, |
||||
|
'date': r.date, |
||||
|
} |
||||
|
total += r.unit_amount |
||||
|
records.append(vals) |
||||
|
return [records, total] |
||||
|
|
||||
|
@api.model |
||||
|
def render_html(self, docids, data=None): |
||||
|
"""we are overwriting this function because we need to show values from other models in the report |
||||
|
we pass the objects in the docargs dictionary""" |
||||
|
|
||||
|
self.model = self.env.context.get('active_model') |
||||
|
docs = self.env[self.model].browse(self.env.context.get('active_id')) |
||||
|
identification = [] |
||||
|
for i in self.env['hr.employee'].search([('user_id', '=', docs.employee[0].id)]): |
||||
|
if i: |
||||
|
identification.append({'id': i.identification_id, 'name': i.name_related}) |
||||
|
|
||||
|
timesheets = self.get_timesheets(docs) |
||||
|
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.from_date: |
||||
|
period = " To " + str(docs.to_date) |
||||
|
docargs = { |
||||
|
'doc_ids': self.ids, |
||||
|
'doc_model': self.model, |
||||
|
'docs': docs, |
||||
|
'timesheets': timesheets[0], |
||||
|
'total': timesheets[1], |
||||
|
'company': docs.employee[0].company_id.name, |
||||
|
'identification': identification, |
||||
|
'period': period, |
||||
|
} |
||||
|
return self.env['report'].render('timesheets_by_employee.report_timesheets', docargs) |
@ -0,0 +1,72 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<template id="report_timesheets"> |
||||
|
<t t-call="report.html_container"> |
||||
|
<t t-foreach="docs" t-as="o"> |
||||
|
<div class="page"> |
||||
|
<t t-call="report.external_layout"> |
||||
|
<div class="row"> |
||||
|
<div class="mt32 mb32"> |
||||
|
<table style="border:1px solid;width:100%;"> |
||||
|
<thead> |
||||
|
<tr style="height:35px;border:1px solid"> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid">Company Name</th> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid">Employee Number</th> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid">Employee Name</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr style="width:100%;height:30px;border:1px solid"> |
||||
|
<td style="vertical-align:middle;text-align:center;border:1px solid"><span t-esc="company"/></td> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid"><span t-esc="identification[0]['id']"/></th> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid"><span t-esc="identification[0]['name']"/></th> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="mt32 mb32"> |
||||
|
<table style="border:1px solid;width:100%;"> |
||||
|
<thead> |
||||
|
<tr style="height:35px;border:1px solid"> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid">Timesheet Period</th> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid">Total</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr style="height:35px;border:1px solid"> |
||||
|
<td style="vertical-align:middle;text-align:center;border:1px solid"><span t-esc="period"/></td> |
||||
|
<td style="vertical-align:middle;text-align:center;border:1px solid"><span t-esc="total"/></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="row"> |
||||
|
<div class="mt32 mb32"> |
||||
|
<table style="border:1px solid;width:100%;"> |
||||
|
<thead> |
||||
|
<tr style="height:35px;border:1px solid"> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid">Date</th> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid">Project</th> |
||||
|
<th style="vertical-align:middle;text-align:center;border:1px solid">Worked Time</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr t-foreach="timesheets" t-as="t" style="height:35px;border:1px solid"> |
||||
|
<td style="vertical-align:middle;text-align:center;border:1px solid"><span t-esc="t['date']"/></td> |
||||
|
<td style="vertical-align:middle;text-align:center;border:1px solid"><span t-esc="t['project']"/></td> |
||||
|
<td style="vertical-align:middle;text-align:center;border:1px solid"><span t-esc="t['duration']"/></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 48 KiB |
@ -0,0 +1,50 @@ |
|||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<h2 class="oe_slogan">Timesheet PDF Report of Employee</h2> |
||||
|
<h3 class="oe_slogan">..Print timesheets of selected employees..</h3> |
||||
|
<h4 class="oe_slogan">Cybrosys Technologies , www.cybrosys.com</h4> |
||||
|
<div> |
||||
|
<p class='oe_mt32' style="text-align: center;"> |
||||
|
This module by Cybrosys Technologies allows to print the timesheets of selected employee. It will group all timesheet lines |
||||
|
of selected employee in wizard by period. |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container oe_dark"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<div class="oe_span12"> |
||||
|
<h3 class="oe_slogan">Generate Timesheet Report Wizard With Dates:</h3> |
||||
|
<div class="oe_demo oe_picture oe_screenshot"> |
||||
|
<img src="image1.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<div class="oe_span12"> |
||||
|
<h3 class="oe_slogan">PDF Report Of Employee Timesheet:</h3> |
||||
|
<div class="oe_demo oe_picture oe_screenshot"> |
||||
|
<img src="image2.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container oe_dark" style="padding-top: 153px;"> |
||||
|
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
||||
|
<div class="oe_slogan" style="margin-top:10px !important;"> |
||||
|
<a class="btn btn-primary btn-lg mt8" |
||||
|
style="color: #FFFFFF !important;" href="http://www.cybrosys.com"><i |
||||
|
class="fa fa-envelope"></i> Email </a> <a |
||||
|
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;" |
||||
|
href="http://www.cybrosys.com/contact/"><i |
||||
|
class="fa fa-phone"></i> Contact Us </a> <a |
||||
|
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;" |
||||
|
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i |
||||
|
class="fa fa-check-square"></i> Request Customization </a> |
||||
|
</div> |
||||
|
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
||||
|
</section> |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
import timesheet_employee |
@ -0,0 +1,39 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
from odoo import models, fields |
||||
|
|
||||
|
|
||||
|
class EmployeeTimesheet(models.TransientModel): |
||||
|
_name = 'timesheet.wizard' |
||||
|
|
||||
|
employee = fields.Many2one('res.users', string="Employee", required=True) |
||||
|
from_date = fields.Date(string="Starting Date") |
||||
|
to_date = fields.Date(string="Ending Date") |
||||
|
|
||||
|
def print_timesheet(self, data): |
||||
|
"""Redirects to the report with the values obtained from the wizard |
||||
|
'data['form']': name of employee and the date duration""" |
||||
|
data = {} |
||||
|
data['form'] = self.read(['employee', 'from_date', 'to_date'])[0] |
||||
|
return self.env['report'].get_action(self, 'timesheets_by_employee.report_timesheets', data=data) |
||||
|
|
@ -0,0 +1,51 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
|
<odoo> |
||||
|
<data> |
||||
|
<record id="timesheets_report_view" model="ir.ui.view"> |
||||
|
<field name="name">Timesheets Wizard</field> |
||||
|
<field name="model">timesheet.wizard</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form> |
||||
|
<group> |
||||
|
<group string="Select Employee"> |
||||
|
<field name="employee"/> |
||||
|
</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> |
||||
|
|
||||
|
<record id="action_print_timesheet_wizard" model="ir.actions.act_window"> |
||||
|
<field name="name">Generate Timesheet Report</field> |
||||
|
<field name="res_model">timesheet.wizard</field> |
||||
|
<field name="type">ir.actions.act_window</field> |
||||
|
<field name="view_type">form</field> |
||||
|
<field name="view_mode">form</field> |
||||
|
<field name="view_id" ref="timesheets_report_view"/> |
||||
|
<field name="target">new</field> |
||||
|
</record> |
||||
|
|
||||
|
<menuitem name="Print Timesheets" id="print_timesheets" action="action_print_timesheet_wizard" parent="hr_timesheet.menu_timesheets_reports"/> |
||||
|
|
||||
|
<report |
||||
|
id="action_report_print_timesheets" |
||||
|
model="timesheet.wizard" |
||||
|
report_type="qweb-pdf" |
||||
|
string="Timesheets" |
||||
|
name="timesheets_by_employee.report_timesheets" |
||||
|
file="timesheets_by_employee.report_timesheets" |
||||
|
menu="False" |
||||
|
/> |
||||
|
</data> |
||||
|
</odoo> |
||||
|
|
||||
|
|
||||
|
|
Loading…
Reference in new issue