diff --git a/odoo_attendance_user_location/README.rst b/odoo_attendance_user_location/README.rst new file mode 100755 index 000000000..23fe39e8d --- /dev/null +++ b/odoo_attendance_user_location/README.rst @@ -0,0 +1,41 @@ +.. 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 + +Geolocation in HR Attendance +======================= +This module helps to the attendance location of the employee where the employee is checkin/out. + +Configuration +============= +User should add the python library "geopy" for using this module. + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer: Sreenath K , Shafna K @cybrosys + +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/odoo_attendance_user_location/__init__.py b/odoo_attendance_user_location/__init__.py new file mode 100644 index 000000000..26501b202 --- /dev/null +++ b/odoo_attendance_user_location/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Sreenath K, Shafna K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import models diff --git a/odoo_attendance_user_location/__manifest__.py b/odoo_attendance_user_location/__manifest__.py new file mode 100644 index 000000000..e63193c7b --- /dev/null +++ b/odoo_attendance_user_location/__manifest__.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Sreenath K, Shafna K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +{ + 'name': 'Geolocation in HR Attendance', + 'version': '16.0.1.0.0', + 'summary': "The attendance location of the employee", + 'description': "This module helps to identify the checkin/out location of the employee", + 'author': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'category': 'Human Resources', + 'depends': ['base', 'hr', 'hr_attendance'], + 'data': [ + 'views/hr_attendance_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'odoo_attendance_user_location/static/src/js/my_attendances.js', + ], + }, + 'images': ['static/description/banner.png'], + 'external_dependencies': {'python': ['geopy']}, + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/odoo_attendance_user_location/doc/RELEASE_NOTES.md b/odoo_attendance_user_location/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..7d86c8082 --- /dev/null +++ b/odoo_attendance_user_location/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 12.07.2023 +#### Version 16.0.1.0.0 +#### ADD + +- Initial commit for Geolocation in HR Attendance \ No newline at end of file diff --git a/odoo_attendance_user_location/models/__init__.py b/odoo_attendance_user_location/models/__init__.py new file mode 100644 index 000000000..664f8c8ef --- /dev/null +++ b/odoo_attendance_user_location/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Sreenath K, Shafna K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import hr_attendance +from . import hr_employee diff --git a/odoo_attendance_user_location/models/hr_attendance.py b/odoo_attendance_user_location/models/hr_attendance.py new file mode 100644 index 000000000..3f9a11845 --- /dev/null +++ b/odoo_attendance_user_location/models/hr_attendance.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Sreenath K, Shafna K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from odoo import fields, models + + +class HrAttendances(models.Model): + """Inherits HR Attendance model""" + _inherit = 'hr.attendance' + + checkin_address = fields.Char(string='Check In Address', store=True, + help="Check in address of the User") + checkout_address = fields.Char(string='Check Out Address', store=True, + help="Check out address of the User") + checkin_latitude = fields.Char(string='Check In Latitude', store=True, + help="Check in latitude of the User") + checkout_latitude = fields.Char(string='Check Out Latitude', store=True, + help="Check out latitude of the User") + checkin_longitude = fields.Char(string='Check In Longitude', store=True, + help="Check in longitude of the User") + checkout_longitude = fields.Char(string='Check Out Longitude', store=True, + help="Check out longitude of the User") + checkin_location = fields.Char(string='Check In Location Link', store=True, + help="Check in location link of the User") + checkout_location = fields.Char(string='Check Out Location Link', store=True, + help="Check out location link of the User") diff --git a/odoo_attendance_user_location/models/hr_employee.py b/odoo_attendance_user_location/models/hr_employee.py new file mode 100644 index 000000000..57a9e71a1 --- /dev/null +++ b/odoo_attendance_user_location/models/hr_employee.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Sreenath K, Shafna K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from geopy.geocoders import Nominatim +from odoo import exceptions, fields, models, _ + + +class HrEmployee(models.AbstractModel): + """Inherits HR Employee model""" + _inherit = 'hr.employee' + + def attendance_manual(self, next_action, entered_pin=None): + """Override this method to add latitude and longitude""" + self.ensure_one() + + latitudes = self.env.context.get('latitude', False) + longitudes = self.env.context.get('longitude', False) + self.ensure_one() + attendance_user_and_no_pin = self.user_has_groups('hr_attendance.group_hr_attendance_user,' + '!hr_attendance.group_hr_attendance_use_pin') + can_check_without_pin = attendance_user_and_no_pin or self.user_id == self.env.user and entered_pin is None + + if can_check_without_pin or entered_pin is not None and entered_pin == self.sudo().pin: + return self._attendance_action(latitudes, longitudes, + next_action) + if not self.user_has_groups('hr_attendance.group_hr_attendance_user'): + return {'warning': _('To activate Kiosk mode without pin code, you ' + 'must have access right as an Officer or above' + 'in the Attendance app. Please contact your ' + 'administrator.')} + return {'warning': _('Wrong PIN')} + + def _attendance_action(self, latitudes, longitudes, next_action): + """ Changes the attendance of the employee. + Returns an action to the check in/out message, + next_action defines which menu the check in/out message should + return to. ("My Attendances" or "Kiosk Mode") + """ + self.ensure_one() + employee = self.sudo() + action_message = self.env['ir.actions.actions']._for_xml_id('hr_attendance.' + 'hr_attendance_action_greeting_message') + + action_message['previous_attendance_change_date'] = employee.last_attendance_id and ( + employee.last_attendance_id.check_out + or employee.last_attendance_id.check_in) or False + action_message['employee_name'] = employee.name + action_message['barcode'] = employee.barcode + action_message['next_action'] = next_action + action_message['hours_today'] = employee.hours_today + action_message['kiosk_delay'] = \ + employee.company_id.attendance_kiosk_delay * 1000 + if employee.user_id: + modified_attendance = employee.with_user(employee.user_id).sudo()._attendance_action_change(longitudes, + latitudes) + else: + modified_attendance = employee._attendance_action_change(longitudes, + latitudes) + action_message['attendance'] = modified_attendance.read()[0] + action_message['total_overtime'] = employee.total_overtime + + # Overtime have a unique constraint on the day, no need for limit=1 + + action_message['overtime_today'] = \ + self.env['hr.attendance.overtime'].sudo().search([('employee_id', '=', employee.id), + ('date', '=', fields.Date.context_today(self)), + ('adjustment', '=', False)]).duration or 0 + return {'action': action_message} + + def _attendance_action_change(self, longitudes, latitudes): + """ Check In/Check Out action + Check In: create a new attendance record + Check Out: modify check_out field of appropriate attendance record + """ + self.ensure_one() + action_date = fields.Datetime.now() + # create a geolocator object + geolocator = Nominatim(user_agent='my-app') + # get the location using the geolocator object + location = geolocator.reverse(str(latitudes) + ', ' + str(longitudes)) + if self.attendance_state != 'checked_in': + vals = { + 'employee_id': self.id, + 'checkin_address': location.address, + 'checkin_latitude': latitudes, + 'checkin_longitude': longitudes, + 'checkin_location': 'https://www.google.com/maps/place/' + location.address, + } + return self.env['hr.attendance'].create(vals) + attendance = self.env['hr.attendance'].search( + [('employee_id', '=', self.id), ('check_out', '=', False)], limit=1) + if attendance: + attendance.write({ + 'checkout_address': location.address, + 'checkout_latitude': latitudes, + 'checkout_longitude': longitudes, + 'checkout_location': 'https://www.google.com/maps/place/' + + location.address, + }) + attendance.check_out = action_date + else: + raise exceptions.UserError(_('Cannot perform check out on ' + '%(empl_name)s, could not find corresponding check in.' + ' Your attendances have probably been modified manually by' + ' human resources.') % { + 'empl_name': self.sudo().name}) + return attendance diff --git a/odoo_attendance_user_location/static/description/assets/.idea/.gitignore b/odoo_attendance_user_location/static/description/assets/.idea/.gitignore new file mode 100644 index 000000000..26d33521a --- /dev/null +++ b/odoo_attendance_user_location/static/description/assets/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/odoo_attendance_user_location/static/description/assets/.idea/assets.iml b/odoo_attendance_user_location/static/description/assets/.idea/assets.iml new file mode 100644 index 000000000..d0876a78d --- /dev/null +++ b/odoo_attendance_user_location/static/description/assets/.idea/assets.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/odoo_attendance_user_location/static/description/assets/.idea/inspectionProfiles/Project_Default.xml b/odoo_attendance_user_location/static/description/assets/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 000000000..ec1774e80 --- /dev/null +++ b/odoo_attendance_user_location/static/description/assets/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,21 @@ + + + + \ No newline at end of file diff --git a/odoo_attendance_user_location/static/description/assets/.idea/inspectionProfiles/profiles_settings.xml b/odoo_attendance_user_location/static/description/assets/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..105ce2da2 --- /dev/null +++ b/odoo_attendance_user_location/static/description/assets/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/odoo_attendance_user_location/static/description/assets/.idea/misc.xml b/odoo_attendance_user_location/static/description/assets/.idea/misc.xml new file mode 100644 index 000000000..d1e22ecb8 --- /dev/null +++ b/odoo_attendance_user_location/static/description/assets/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/odoo_attendance_user_location/static/description/assets/.idea/modules.xml b/odoo_attendance_user_location/static/description/assets/.idea/modules.xml new file mode 100644 index 000000000..e2d63b968 --- /dev/null +++ b/odoo_attendance_user_location/static/description/assets/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/odoo_attendance_user_location/static/description/assets/.idea/vcs.xml b/odoo_attendance_user_location/static/description/assets/.idea/vcs.xml new file mode 100644 index 000000000..4fce1d86b --- /dev/null +++ b/odoo_attendance_user_location/static/description/assets/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/odoo_attendance_user_location/static/description/assets/icons/check.png b/odoo_attendance_user_location/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/check.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/chevron.png b/odoo_attendance_user_location/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/chevron.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/cogs.png b/odoo_attendance_user_location/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/cogs.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/consultation.png b/odoo_attendance_user_location/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/consultation.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/ecom-black.png b/odoo_attendance_user_location/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/ecom-black.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/education-black.png b/odoo_attendance_user_location/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/education-black.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/hotel-black.png b/odoo_attendance_user_location/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/hotel-black.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/license.png b/odoo_attendance_user_location/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/license.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/lifebuoy.png b/odoo_attendance_user_location/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/lifebuoy.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/manufacturing-black.png b/odoo_attendance_user_location/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/manufacturing-black.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/pos-black.png b/odoo_attendance_user_location/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/pos-black.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/puzzle.png b/odoo_attendance_user_location/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/puzzle.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/restaurant-black.png b/odoo_attendance_user_location/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/restaurant-black.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/service-black.png b/odoo_attendance_user_location/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/service-black.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/trading-black.png b/odoo_attendance_user_location/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/trading-black.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/training.png b/odoo_attendance_user_location/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/training.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/update.png b/odoo_attendance_user_location/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/update.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/user.png b/odoo_attendance_user_location/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/user.png differ diff --git a/odoo_attendance_user_location/static/description/assets/icons/wrench.png b/odoo_attendance_user_location/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/icons/wrench.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/categories.png b/odoo_attendance_user_location/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/categories.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/check-box.png b/odoo_attendance_user_location/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/check-box.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/compass.png b/odoo_attendance_user_location/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/compass.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/corporate.png b/odoo_attendance_user_location/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/corporate.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/customer-support.png b/odoo_attendance_user_location/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/customer-support.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/cybrosys-logo.png b/odoo_attendance_user_location/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/cybrosys-logo.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/features.png b/odoo_attendance_user_location/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/features.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/logo.png b/odoo_attendance_user_location/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/logo.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/pictures.png b/odoo_attendance_user_location/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/pictures.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/pie-chart.png b/odoo_attendance_user_location/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/pie-chart.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/right-arrow.png b/odoo_attendance_user_location/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/right-arrow.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/star.png b/odoo_attendance_user_location/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/star.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/support.png b/odoo_attendance_user_location/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/support.png differ diff --git a/odoo_attendance_user_location/static/description/assets/misc/whatsapp.png b/odoo_attendance_user_location/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/misc/whatsapp.png differ diff --git a/odoo_attendance_user_location/static/description/assets/modules/01.png b/odoo_attendance_user_location/static/description/assets/modules/01.png new file mode 100644 index 000000000..489f44e86 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/modules/01.png differ diff --git a/odoo_attendance_user_location/static/description/assets/modules/02.png b/odoo_attendance_user_location/static/description/assets/modules/02.png new file mode 100644 index 000000000..4f9e87f6e Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/modules/02.png differ diff --git a/odoo_attendance_user_location/static/description/assets/modules/03.png b/odoo_attendance_user_location/static/description/assets/modules/03.png new file mode 100644 index 000000000..e571015b1 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/modules/03.png differ diff --git a/odoo_attendance_user_location/static/description/assets/modules/04.png b/odoo_attendance_user_location/static/description/assets/modules/04.png new file mode 100644 index 000000000..624ef69b7 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/modules/04.png differ diff --git a/odoo_attendance_user_location/static/description/assets/modules/05.gif b/odoo_attendance_user_location/static/description/assets/modules/05.gif new file mode 100644 index 000000000..8f40aab85 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/modules/05.gif differ diff --git a/odoo_attendance_user_location/static/description/assets/modules/06.png b/odoo_attendance_user_location/static/description/assets/modules/06.png new file mode 100644 index 000000000..31ed46762 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/modules/06.png differ diff --git a/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_00.png b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_00.png new file mode 100644 index 000000000..fb497bfae Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_00.png differ diff --git a/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_01.png b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_01.png new file mode 100644 index 000000000..de57b182e Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_01.png differ diff --git a/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_02.png b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_02.png new file mode 100644 index 000000000..823a01eb0 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_02.png differ diff --git a/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_03.png b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_03.png new file mode 100644 index 000000000..9289114e6 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_03.png differ diff --git a/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_04.png b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_04.png new file mode 100644 index 000000000..de4b569a8 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_04.png differ diff --git a/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_05.png b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_05.png new file mode 100644 index 000000000..e34659782 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_05.png differ diff --git a/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_06.png b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_06.png new file mode 100644 index 000000000..9cc124c2f Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/screenshots/attendance_user_location_06.png differ diff --git a/odoo_attendance_user_location/static/description/assets/screenshots/hero.gif b/odoo_attendance_user_location/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..ac72e9db1 Binary files /dev/null and b/odoo_attendance_user_location/static/description/assets/screenshots/hero.gif differ diff --git a/odoo_attendance_user_location/static/description/banner.jpg b/odoo_attendance_user_location/static/description/banner.jpg new file mode 100644 index 000000000..7de8b452f Binary files /dev/null and b/odoo_attendance_user_location/static/description/banner.jpg differ diff --git a/odoo_attendance_user_location/static/description/icon.png b/odoo_attendance_user_location/static/description/icon.png new file mode 100644 index 000000000..1712d0d53 Binary files /dev/null and b/odoo_attendance_user_location/static/description/icon.png differ diff --git a/odoo_attendance_user_location/static/description/index.html b/odoo_attendance_user_location/static/description/index.html new file mode 100644 index 000000000..464354ae4 --- /dev/null +++ b/odoo_attendance_user_location/static/description/index.html @@ -0,0 +1,515 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

Geo Location in HR Attendance

+

Get the employees attendance check-in/check-out location details

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

Explore This Module

+
+ + + + +
+
+ Warning! This module will only works when your odoo instance is in https mode.
If you are using chrome you can solve by copy and paste this link + "chrome://flags/#unsafely-treat-insecure-origin-as-secure" and go to Insecure origins treated as secure.
Add your odoo instance URL here and enable this feature. + Then you can use this module without https. But for better accurate result you need to configure https. +
+
+
+ + + +
+
+ +
+

Overview

+
+
+
+ This module helps to find the employees attendance location details with a google map link. +
+
+ + +
+
+ +
+

CONFIGURATION

+
+
+
+ Install python library geopy for using this module. + Geopy helps to locate the coordinates of addresses. +
+
+

Installation

+
+ pip install geopy +
+ + + +
+
+ +
+

Features

+
+
+
+
+ + Available in Odoo 16.0 Community and Enterprise. +
+
+ + Works in both normal and kiosk mode +
+
+ + Find the nearby address of check-in/check-out location. +
+
+ + Save the address in attendance form +
+
+ + Save the latitude and longitude of the location +
+
+
+
+ + Create a Google map link to redirect to the specific location. +
+
+
+ + + +
+
+ +
+

Screenshots

+
+
+
+
+

Check in / Checkout

+

Go to Attendance -> Check in / Checkout

+ +

+ Checkin Successfully

+ +
+ +
+

After checkin you can see the details of employee nearby location details

+ +
+ +
+

After checkout, the checkout location details also will be stored

+ +

Checkout details

+ +
+ +
+

Click the link to redirect to the google map

+ +
+ +
+

After Click on the map you will redirect to the google map

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

Related + Products +

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

Our Services

+
+ +
+
+
+
+ +
+
Odoo Customization
+
+ +
+
+ +
+
Odoo Implementation
+
+ +
+
+ +
+
Odoo Support
+
+ +
+
+ +
+
Hire Odoo Developer
+
+ +
+
+ +
+
Odoo Integration
+
+ +
+
+ +
+
Odoo Migration
+
+ +
+
+ +
+
Odoo Consultancy
+
+ +
+
+ +
+
Odoo Implementation
+
+ +
+
+ +
+
Odoo Licensing Consultancy
+
+
+
+ + + +
+
+ +
+

Our Industries

+
+ +
+
+
+
+ +
Trading
+

Easily procure and sell your products

+
+
+ +
+
+ +
POS
+

Easy configuration and convivial experience

+
+
+ +
+
+ +
Education
+

A platform for educational management

+
+
+ +
+
+ +
Manufacturing
+

Plan, track and schedule your operations

+
+
+ +
+
+ +
E-commerce & Website
+

Mobile friendly, awe-inspiring product pages

+
+
+ +
+
+ +
Service Management
+

Keep track of services and invoice

+
+
+ +
+
+ +
Restaurant
+

Run your bar or restaurant methodically

+
+
+ +
+
+ +
Hotel Management +
+

An all-inclusive hotel management application

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

Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? Get in touch.

+ +

odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/odoo_attendance_user_location/static/src/js/my_attendances.js b/odoo_attendance_user_location/static/src/js/my_attendances.js new file mode 100644 index 000000000..6c71e64e5 --- /dev/null +++ b/odoo_attendance_user_location/static/src/js/my_attendances.js @@ -0,0 +1,213 @@ +odoo.define('odoo_attendance_user_location.my_attendances', function(require) { + /** + * This class is used to get the checkin/out location of employee + */ + "use strict"; + var MyAttendances = require("hr_attendance.my_attendances"); + var KioskConfirm = require("hr_attendance.kiosk_confirm"); + const session = require("web.session"); + var Dialog = require("web.Dialog"); + var core = require("web.core"); + var QWeb = core.qweb; + var latitude; + var longitude; + MyAttendances.include({ + update_attendance: function() { + var self = this; + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(function(position) { + + const ctx = Object.assign(session.user_context, { + latitude: position.coords.latitude, + longitude: position.coords.longitude, + }); + + latitude = position.coords.latitude; + longitude = position.coords.longitude; + self._rpc({ + model: 'hr.employee', + method: 'attendance_manual', + args: [ + [self.employee.id], 'hr_attendance.hr_attendance_action_my_attendances' + ], + context: ctx, + }) + .then(function(result) { + if (result.action) { + self.do_action(result.action); + } else if (result.warning) { + self.displayNotification({ + title: result.warning, + type: 'danger' + }); + } + }); + }, + function(error) { + // Handle any errors + if (error) { + var MyDialog = new Dialog(null, { + title: error.__proto__.constructor.name, + size: "medium", + $content: $('
', { + role: 'alert', + text: error['message'] + ". Also check your site connection is secured!", + }), + buttons: [{ + text: "OK", + classes: "btn-primary", + click: function() { + MyDialog.close(); + } + }] + }); + MyDialog.open(); + } + }); + } else { + this._rpc({ + model: 'hr.employee', + method: 'attendance_manual', + args: [ + [self.employee.id], 'hr_attendance.hr_attendance_action_my_attendances' + ], + context: session.user_context, + }) + .then(function(result) { + if (result.action) { + self.do_action(result.action); + } else if (result.warning) { + self.displayNotification({ + title: result.warning, + type: 'danger' + }); + } + }); + } + }, + }); + KioskConfirm.include({ + events: _.extend(KioskConfirm.prototype.events, { + "click .o_hr_attendance_sign_in_out_icon": _.debounce( + function() { + var self = this; + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(function(position) { + const ctx = Object.assign(session.user_context, { + latitude: position.coords.latitude, + longitude: position.coords.longitude, + }); + latitude = position.coords.latitude; + longitude = position.coords.longitude; + self._rpc({ + model: 'hr.employee', + method: 'attendance_manual', + args: [ + [self.employee_id], self.next_action + ], + context: ctx, + }) + .then(function(result) { + if (result.action) { + self.do_action(result.action); + } else if (result.warning) { + self.displayNotification({ + title: result.warning, + type: 'danger' + }); + } + }); + }, + function(error) { + // Handle any errors + if (error) { + var MyDialog = new Dialog(null, { + title: error.__proto__.constructor.name, + size: "medium", + $content: $('
', { + role: 'alert', + text: error['message'] + ". Also check your site connection is secured!", + }), + buttons: [{ + text: "OK", + classes: "btn-primary", + click: function() { + MyDialog.close(); + } + }] + }); + MyDialog.open(); + } + }); + } + }, + 200, + true + ), + "click .o_hr_attendance_pin_pad_button_ok": _.debounce( + function() { + var self = this; + this.pin_pad = true; + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(function(position) { + const ctx = Object.assign(session.user_context, { + latitude: position.coords.latitude, + longitude: position.coords.longitude, + }); + latitude = position.coords.latitude; + longitude = position.coords.longitude; + self._rpc({ + model: 'hr.employee', + method: 'attendance_manual', + args: [ + [self.employee_id], self.next_action, self.$('.o_hr_attendance_PINbox') + .val() + ], + context: session.user_context, + }) + .then(function(result) { + if (result.action) { + self.do_action(result.action); + } else if (result.warning) { + self.displayNotification({ + title: result.warning, + type: 'danger' + }); + self.$('.o_hr_attendance_PINbox') + .val(''); + setTimeout(function() { + self.$('.o_hr_attendance_pin_pad_button_ok') + .removeAttr("disabled"); + }, 500); + } + }); + }, + function(error) { + // Handle any errors + if (error) { + var MyDialog = new Dialog(null, { + title: error.__proto__.constructor.name, + size: "medium", + $content: $('
', { + role: 'alert', + text: error['message'] + ". Also check your site connection is secured!", + }), + buttons: [{ + text: "OK", + classes: "btn-primary", + click: function() { + MyDialog.close(); + } + }] + }); + MyDialog.open(); + } + }); + } + }, + 200, + true + ), + }), + }); +}); diff --git a/odoo_attendance_user_location/views/hr_attendance_views.xml b/odoo_attendance_user_location/views/hr_attendance_views.xml new file mode 100644 index 000000000..6eae5ff97 --- /dev/null +++ b/odoo_attendance_user_location/views/hr_attendance_views.xml @@ -0,0 +1,43 @@ + + + + + + hr.attendance.inherit.odoo.attendance.user.location + hr.attendance + + + + + + + + + + + + + + + hr.attendance.inherit.odoo.attendance.user.location + hr.attendance + + + + + + + + + + + + + + + + + + + +