diff --git a/timesheets_by_employee/__init__.py b/timesheets_by_employee/__init__.py new file mode 100644 index 000000000..4b748e404 --- /dev/null +++ b/timesheets_by_employee/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# 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 . +# +############################################################################## +import report +import wizard diff --git a/timesheets_by_employee/__manifest__.py b/timesheets_by_employee/__manifest__.py new file mode 100644 index 000000000..78145d88b --- /dev/null +++ b/timesheets_by_employee/__manifest__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# 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 . +# +############################################################################## +{ + '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, +} diff --git a/timesheets_by_employee/report/__init__.py b/timesheets_by_employee/report/__init__.py new file mode 100644 index 000000000..3360d21fb --- /dev/null +++ b/timesheets_by_employee/report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# 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 . +# +############################################################################## +import report_timesheets diff --git a/timesheets_by_employee/report/report_timesheets.py b/timesheets_by_employee/report/report_timesheets.py new file mode 100644 index 000000000..7b7454ecd --- /dev/null +++ b/timesheets_by_employee/report/report_timesheets.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# 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 . +# +############################################################################## +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) diff --git a/timesheets_by_employee/report/report_timesheets.xml b/timesheets_by_employee/report/report_timesheets.xml new file mode 100644 index 000000000..0d527eac4 --- /dev/null +++ b/timesheets_by_employee/report/report_timesheets.xml @@ -0,0 +1,72 @@ + + + + \ No newline at end of file diff --git a/timesheets_by_employee/static/description/banner.jpg b/timesheets_by_employee/static/description/banner.jpg new file mode 100644 index 000000000..61a8c596b Binary files /dev/null and b/timesheets_by_employee/static/description/banner.jpg differ diff --git a/timesheets_by_employee/static/description/cybro_logo.png b/timesheets_by_employee/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/timesheets_by_employee/static/description/cybro_logo.png differ diff --git a/timesheets_by_employee/static/description/icon.png b/timesheets_by_employee/static/description/icon.png new file mode 100644 index 000000000..ee52f55b3 Binary files /dev/null and b/timesheets_by_employee/static/description/icon.png differ diff --git a/timesheets_by_employee/static/description/image1.png b/timesheets_by_employee/static/description/image1.png new file mode 100644 index 000000000..2ee674479 Binary files /dev/null and b/timesheets_by_employee/static/description/image1.png differ diff --git a/timesheets_by_employee/static/description/image2.png b/timesheets_by_employee/static/description/image2.png new file mode 100644 index 000000000..fec41bed0 Binary files /dev/null and b/timesheets_by_employee/static/description/image2.png differ diff --git a/timesheets_by_employee/static/description/index.html b/timesheets_by_employee/static/description/index.html new file mode 100644 index 000000000..406f404b0 --- /dev/null +++ b/timesheets_by_employee/static/description/index.html @@ -0,0 +1,50 @@ +
+
+

Timesheet PDF Report of Employee

+

..Print timesheets of selected employees..

+

Cybrosys Technologies , www.cybrosys.com

+
+

+ 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. +

+
+
+ +
+
+
+

Generate Timesheet Report Wizard With Dates:

+
+ +
+
+
+
+ +
+
+
+

PDF Report Of Employee Timesheet:

+
+ +
+
+
+
+ +
+

Need Any Help?

+ + +
diff --git a/timesheets_by_employee/wizard/__init__.py b/timesheets_by_employee/wizard/__init__.py new file mode 100644 index 000000000..e2d78765f --- /dev/null +++ b/timesheets_by_employee/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# 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 . +# +############################################################################## +import timesheet_employee diff --git a/timesheets_by_employee/wizard/timesheet_employee.py b/timesheets_by_employee/wizard/timesheet_employee.py new file mode 100644 index 000000000..20f63fd16 --- /dev/null +++ b/timesheets_by_employee/wizard/timesheet_employee.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# 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 . +# +############################################################################## + +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) + diff --git a/timesheets_by_employee/wizard/timesheet_wizard.xml b/timesheets_by_employee/wizard/timesheet_wizard.xml new file mode 100644 index 000000000..404f31e0a --- /dev/null +++ b/timesheets_by_employee/wizard/timesheet_wizard.xml @@ -0,0 +1,51 @@ + + + + + Timesheets Wizard + timesheet.wizard + +
+ + + + + + + + +
+
+
+
+
+
+ + + Generate Timesheet Report + timesheet.wizard + ir.actions.act_window + form + form + + new + + + + + +
+
+ + +