commit a9f12eee1ea454443a3d7cd3c006d0fb5faeabd2 Author: Janik von Rotz Date: Wed Mar 4 11:17:14 2020 +0100 add demo module and update install instructions diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e0e8c990 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +.DS_Store diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..eb56df2f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "spellright.language": [ + "en" + ], + "spellright.documentTypes": [ + "markdown", + "latex", + "plaintext" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..be19b7fd --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +Odoo Development +================ + +Setup Odoo development environment with Docker Compose. + +## Usage + +Clone this repository. + +```bash +git clone https://github.com/Mint-System/Odoo-Development.git odoo-development +cd odoo-development +``` + +Run docker compose. + +```bash +docker-compose up -d +``` + +Create a database and install modules. + +```bash +export MODULES=base,project,hr,hr_timesheet,timesheets_by_employee +docker exec -it odoo-development_web_1 bin/bash -c "odoo -i $MODULES -c /etc/odoo/odoo.conf -d odoo --stop-after-init --db_host \$HOST -r \$USER -w \$PASSWORD --dev all" +docker restart odoo-development_web_1 +``` + +Open browser to [http://localhost:8069](http://localhost:8069) and login with `admin:admin`. + +### Enable developer mode + +Navigate to the [settings page]( +http://localhost:8069/web?debug=1#id=&action=85&model=res.config.settings&view_type=form&cids=&menu_id=4) and click on *Activate the developer mode (with assets)*. + +### Create module + +Scaffold a new module. + +```bash +docker exec -it odoo-development_web_1 bin/bash -c 'odoo scaffold qm_data_system /mnt/extra-addons' +``` + +Restart doo. + +```bash +docker restart odoo-development_web_1 +``` + +### Manage database + +Open database manager [http://localhost:8000/](http://localhost:8000/) and login with `admin@admin.com:admin`. + +Add a new database connection with these credentials: + +``` +Name: odoo +Host: db +Username: odoo +Password: odoo +``` + +### Uninstall + +Kill docker containers. + +```bash +docker-compose down -v +``` diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000..6a3ce908 --- /dev/null +++ b/TODO.md @@ -0,0 +1,5 @@ +# TODO + +## App Integration + +- [ ] Integrate third party app https://apps.odoo.com/apps/modules/13.0/timesheets_by_employee/ \ No newline at end of file diff --git a/addons/timesheets_by_employee/README.rst b/addons/timesheets_by_employee/README.rst new file mode 100644 index 00000000..2942371b --- /dev/null +++ b/addons/timesheets_by_employee/README.rst @@ -0,0 +1,43 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--1-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Timesheets by Employees v13 +=========================== + +This module allows to print the timesheets of selected employee. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: Kavya Raveendran @ cybrosys, Contact: odoo@cybrosys.com + Version 13: Vaishnavi B@cybrosys,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 `__ + +Further information +=================== +HTML Description: ``__ + diff --git a/addons/timesheets_by_employee/__init__.py b/addons/timesheets_by_employee/__init__.py new file mode 100644 index 00000000..cbb15e03 --- /dev/null +++ b/addons/timesheets_by_employee/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Kavya Raveendran (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 . +# +############################################################################## + +from . import report +from . import wizard diff --git a/addons/timesheets_by_employee/__manifest__.py b/addons/timesheets_by_employee/__manifest__.py new file mode 100644 index 00000000..2e6acf5d --- /dev/null +++ b/addons/timesheets_by_employee/__manifest__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Kavya Raveendran (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 . +# +############################################################################## + +{ + 'name': 'Timesheet PDF Report', + 'version': '13.0.1.0.0', + "category": "Generic Modules/Human Resources", + 'sequence': 25, + 'summary': 'Timesheet PDF Report of Employees', + 'description': 'Timesheet PDF Report of Employees', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['hr_timesheet'], + 'data': [ + 'report/report_timesheets.xml', + 'report/timesheet_pdf.xml', + 'wizard/timesheet_wizard.xml', + ], + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/addons/timesheets_by_employee/doc/RELEASE_NOTES.md b/addons/timesheets_by_employee/doc/RELEASE_NOTES.md new file mode 100644 index 00000000..a8c3c5c5 --- /dev/null +++ b/addons/timesheets_by_employee/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 25.11.2019 +#### Version 13.0.1.0.0 +##### ADD +Initial commit for timesheet_by_employee diff --git a/addons/timesheets_by_employee/report/__init__.py b/addons/timesheets_by_employee/report/__init__.py new file mode 100644 index 00000000..3def8d3b --- /dev/null +++ b/addons/timesheets_by_employee/report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Kavya Raveendran (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 . +# +############################################################################## + +from . import report_timesheets diff --git a/addons/timesheets_by_employee/report/report_timesheets.py b/addons/timesheets_by_employee/report/report_timesheets.py new file mode 100644 index 00000000..6c94d83c --- /dev/null +++ b/addons/timesheets_by_employee/report/report_timesheets.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Kavya Raveendran (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 . +# +############################################################################## + +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 _get_report_values(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""" + docs = self.env['timesheet.wizard'].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.id, 'name': i.name}) + timesheets = self.get_timesheets(docs) + company_name = self.env['res.company'].search([('name', '=', docs.employee[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.from_date: + period = " To " + str(docs.to_date) + if len(identification) > 1: + return { + 'doc_ids': self.ids, + # 'doc_model': self.model, + 'docs': docs, + 'timesheets': timesheets[0], + 'total': timesheets[1], + 'company': company_name, + 'identification': identification, + 'period': period, + } + else: + return { + 'doc_ids': self.ids, + # 'doc_model': self.model, + 'docs': docs, + 'timesheets': timesheets[0], + 'total': timesheets[1], + 'identification': identification, + 'company': company_name, + 'period': period, + } diff --git a/addons/timesheets_by_employee/report/report_timesheets.xml b/addons/timesheets_by_employee/report/report_timesheets.xml new file mode 100644 index 00000000..69bd1e98 --- /dev/null +++ b/addons/timesheets_by_employee/report/report_timesheets.xml @@ -0,0 +1,42 @@ + + + + \ No newline at end of file diff --git a/addons/timesheets_by_employee/report/timesheet_pdf.xml b/addons/timesheets_by_employee/report/timesheet_pdf.xml new file mode 100644 index 00000000..9474b86c --- /dev/null +++ b/addons/timesheets_by_employee/report/timesheet_pdf.xml @@ -0,0 +1,12 @@ + + + + diff --git a/addons/timesheets_by_employee/static/description/banner.png b/addons/timesheets_by_employee/static/description/banner.png new file mode 100644 index 00000000..2c4c891a Binary files /dev/null and b/addons/timesheets_by_employee/static/description/banner.png differ diff --git a/addons/timesheets_by_employee/static/description/cybro_logo.png b/addons/timesheets_by_employee/static/description/cybro_logo.png new file mode 100644 index 00000000..bb309114 Binary files /dev/null and b/addons/timesheets_by_employee/static/description/cybro_logo.png differ diff --git a/addons/timesheets_by_employee/static/description/icon.png b/addons/timesheets_by_employee/static/description/icon.png new file mode 100644 index 00000000..94223935 Binary files /dev/null and b/addons/timesheets_by_employee/static/description/icon.png differ diff --git a/addons/timesheets_by_employee/static/description/icosadan.png b/addons/timesheets_by_employee/static/description/icosadan.png new file mode 100644 index 00000000..ee52f55b Binary files /dev/null and b/addons/timesheets_by_employee/static/description/icosadan.png differ diff --git a/addons/timesheets_by_employee/static/description/index.html b/addons/timesheets_by_employee/static/description/index.html new file mode 100644 index 00000000..393594f6 --- /dev/null +++ b/addons/timesheets_by_employee/static/description/index.html @@ -0,0 +1,346 @@ +
+
+

+ Timesheet PDF Report of Employee +

+

+ Print timesheets of selected employees +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies
+
+
+
+ +
+
+

+ Overview +

+

+ This module crafted by Cybrosys Technologies, allows the end user to print the timesheets of selected employee. The module will further group all timesheet lines of selected employee in wizard based on its period. +

+

+ Configuration +

+

+ No additional configuration required. +

+
+
+ +
+
+

+ Features +

+

+ + Print the timesheets of selected employees. +

+

+ + Perform period wise grouping of timesheet lines. +

+
+
+ +
+
+

+ Screenshots +

+

+ + Timesheets -> Reporting -> Print Timesheets +

+
+ +
+

+ + Generate Timesheet Report Wizard with Dates. +

+
+ +
+

+ + PDF Report of Employee Timesheet. +

+
+ +
+
+
+ + +
+
+ cybrosys technologies +
+
+
+
+

+ Our Services +

+
+ + + +
+ +
+ + + +
+

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ Our Industries +

+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
diff --git a/addons/timesheets_by_employee/static/description/timesheet-by-employee-cybrosys-1.png b/addons/timesheets_by_employee/static/description/timesheet-by-employee-cybrosys-1.png new file mode 100644 index 00000000..34189544 Binary files /dev/null and b/addons/timesheets_by_employee/static/description/timesheet-by-employee-cybrosys-1.png differ diff --git a/addons/timesheets_by_employee/static/description/timesheet-by-employee-cybrosys-2.png b/addons/timesheets_by_employee/static/description/timesheet-by-employee-cybrosys-2.png new file mode 100644 index 00000000..34fa9412 Binary files /dev/null and b/addons/timesheets_by_employee/static/description/timesheet-by-employee-cybrosys-2.png differ diff --git a/addons/timesheets_by_employee/static/description/timesheet-by-employee-cybrosys-3.png b/addons/timesheets_by_employee/static/description/timesheet-by-employee-cybrosys-3.png new file mode 100644 index 00000000..c1789a89 Binary files /dev/null and b/addons/timesheets_by_employee/static/description/timesheet-by-employee-cybrosys-3.png differ diff --git a/addons/timesheets_by_employee/wizard/__init__.py b/addons/timesheets_by_employee/wizard/__init__.py new file mode 100644 index 00000000..6c2d5431 --- /dev/null +++ b/addons/timesheets_by_employee/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Kavya Raveendran (odoo@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 . +# +############################################################################## +from . import timesheet_employee diff --git a/addons/timesheets_by_employee/wizard/timesheet_employee.py b/addons/timesheets_by_employee/wizard/timesheet_employee.py new file mode 100644 index 00000000..b581b2a5 --- /dev/null +++ b/addons/timesheets_by_employee/wizard/timesheet_employee.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Kavya Raveendran (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 . +# +############################################################################## + +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): + """Redirects to the report with the values obtained from the wizard + 'data['form']': name of employee and the date duration""" + data = { + 'start_date': self.from_date, + 'end_date': self.to_date, + 'employee': self.employee.id + } + return self.env.ref('timesheets_by_employee.action_report_print_timesheets').report_action(self, data=data) + diff --git a/addons/timesheets_by_employee/wizard/timesheet_wizard.xml b/addons/timesheets_by_employee/wizard/timesheet_wizard.xml new file mode 100644 index 00000000..e0d7d77a --- /dev/null +++ b/addons/timesheets_by_employee/wizard/timesheet_wizard.xml @@ -0,0 +1,39 @@ + + + + + timesheet.wizard + timesheet.wizard + +
+ + + + + + + + +
+
+
+
+
+
+ + + timesheet.wizard + timesheet.wizard + ir.actions.act_window + form + + new + + +
+
+ + + diff --git a/config/odoo.conf b/config/odoo.conf new file mode 100644 index 00000000..8e60fef7 --- /dev/null +++ b/config/odoo.conf @@ -0,0 +1,37 @@ +[options] +addons_path = /mnt/extra-addons +data_dir = /var/lib/odoo +; admin_passwd = admin +; csv_internal_sep = , +; db_maxconn = 64 +; db_name = False +; db_template = template1 +; dbfilter = .* +; debug_mode = False +; email_from = False +; limit_memory_hard = 2684354560 +; limit_memory_soft = 2147483648 +; limit_request = 8192 +; limit_time_cpu = 60 +; limit_time_real = 120 +; list_db = True +; log_db = False +; log_handler = [':INFO'] +; log_level = info +; logfile = None +; longpolling_port = 8072 +; max_cron_threads = 2 +; osv_memory_age_limit = 1.0 +; osv_memory_count_limit = False +; smtp_password = False +; smtp_port = 25 +; smtp_server = localhost +; smtp_ssl = False +; smtp_user = False +; workers = 0 +; xmlrpc = True +; xmlrpc_interface = +; xmlrpc_port = 8069 +; xmlrpcs = True +; xmlrpcs_interface = +; xmlrpcs_port = 8071 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..dfcaa0fb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,40 @@ +version: "3" +services: + web: + image: odoo:13 + depends_on: + - db + environment: + - HOST=db + - USER=odoo + - PASSWORD=odoo + ports: + - "8069:8069" + volumes: + - odoo-web-data:/var/lib/odoo + - ./config:/etc/odoo + - ./addons:/mnt/extra-addons + admin: + image: dpage/pgadmin4 + depends_on: + - db + ports: + - "8000:80" + environment: + PGADMIN_DEFAULT_EMAIL: admin@admin.com + PGADMIN_DEFAULT_PASSWORD: admin + volumes: + - odoo-admin-data:/var/lib/pgadmin + db: + image: postgres:10 + environment: + - POSTGRES_DB=postgres + - POSTGRES_PASSWORD=odoo + - POSTGRES_USER=odoo + - PGDATA=/var/lib/postgresql/data/pgdata + volumes: + - odoo-db-data:/var/lib/postgresql/data/pgdata +volumes: + odoo-web-data: + odoo-db-data: + odoo-admin-data: