Skip to content

Commit

Permalink
[MIG] hr_attendance_reason: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTietze committed Dec 2, 2024
1 parent 3047d44 commit 69f4a8b
Show file tree
Hide file tree
Showing 24 changed files with 680 additions and 426 deletions.
31 changes: 17 additions & 14 deletions hr_attendance_reason/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ HR Attendance Reason
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5ea4fe894b4098b9134c10e80ef832306fa6323b8147d81753bf62f7c54061ed
!! source digest: sha256:1efc21ca72875c847f215f0527a36c5bf1bef11334f475fa794486791eea004f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -31,9 +31,9 @@ HR Attendance Reason
This module allows to define reasons why the attendance is not what
expected. Some example reasons are

- Could not access the system: Visit a customer
- Leave soon to pick up children
- The Hr manager amended the attendance and needs to tell
- Could not access the system: Visit a customer
- Leave soon to pick up children
- The Hr manager amended the attendance and needs to tell

**Table of contents**

Expand Down Expand Up @@ -70,18 +70,21 @@ Authors
Contributors
------------

- Odoo S.A.
- Aaron Henriquez <[email protected]>
- Damien Crier <[email protected]>
- Saran Lim. <[email protected]>
- David Alonso <[email protected]>
- Juany Davila <[email protected]>
- `Tecnativa <https://www.tecnativa.com>`__:
- Odoo S.A.
- Aaron Henriquez <[email protected]>
- Damien Crier <[email protected]>
- Saran Lim. <[email protected]>
- David Alonso <[email protected]>
- Juany Davila <[email protected]>
- `Tecnativa <https://www.tecnativa.com>`__:

- Víctor Martínez
- Carlos Lopez
- Víctor Martínez
- Carlos Lopez

- Dhara Solanki <[email protected]>
- Dhara Solanki <[email protected]>
- `manaTec <https://www.manatec.de/>`__:

- Tom Tietze

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion hr_attendance_reason/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "HR Attendance Reason",
"version": "17.0.1.1.0",
"version": "18.0.1.0.0",
"category": "Human Resources",
"website": "https://github.com/OCA/hr-attendance",
"author": "Odoo S.A., Tecnativa, Odoo Community Association (OCA)",
Expand Down
37 changes: 33 additions & 4 deletions hr_attendance_reason/controllers/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2024 Tecnativa - Carlos Lopez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import http
from odoo.http import request, route

from odoo.addons.hr_attendance.controllers.main import HrAttendance
Expand All @@ -11,7 +12,23 @@ class HrAttendance(HrAttendance):
@route("/hr_attendance/attendance_user_data", type="json", auth="user")
def user_attendance_data(self):
response = super().user_attendance_data()

Check warning on line 14 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L14

Added line #L14 was not covered by tests
response.update(self._get_attendance_reason_settings(request.env.company))
# try to get the company of the employee to show the correct reasons from
# the employees company
company = (

Check warning on line 17 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L17

Added line #L17 was not covered by tests
request.env.user.employee_id.company_id
if request.env.user.employee_id
else request.env.company
)
response.update(self._get_attendance_reason_settings(company))

Check warning on line 22 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L22

Added line #L22 was not covered by tests
# get available reasons for employee company
reasons = []

Check warning on line 24 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L24

Added line #L24 was not covered by tests
if response.get("attendance_state", False):
if response.get("attendance_state", False) == "checked_out":
action_type = "sign_in"

Check warning on line 27 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L27

Added line #L27 was not covered by tests
else:
action_type = "sign_out"
reasons = self._get_attendance_reasons(action_type, company)
response.update({"reasons": reasons})
return response

Check warning on line 32 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L29-L32

Added lines #L29 - L32 were not covered by tests

@route("/hr_attendance/systray_check_in_out", type="json", auth="user")
Expand All @@ -22,13 +39,17 @@ def systray_attendance(self, latitude=False, longitude=False):
)
return super().systray_attendance(latitude=latitude, longitude=longitude)

Check warning on line 40 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L40

Added line #L40 was not covered by tests

@route("/hr_attendance/manual_selection", type="json", auth="public")
def manual_selection(self, token, employee_id, pin_code):
@http.route("/hr_attendance/manual_selection", type="json", auth="public")
def manual_selection_with_geolocation(
self, token, employee_id, pin_code, latitude=False, longitude=False
):
if request.params.get("attendance_reason_id"):
request.update_context(

Check warning on line 47 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L47

Added line #L47 was not covered by tests
attendance_reason_id=request.params.get("attendance_reason_id")
)
return super().manual_selection(token, employee_id, pin_code)
return super().manual_selection_with_geolocation(

Check warning on line 50 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L50

Added line #L50 was not covered by tests
token, employee_id, pin_code, latitude, longitude
)

# new routes
@route("/hr_attendance_reason/get_reasons", type="json", auth="public")
Expand Down Expand Up @@ -64,9 +85,17 @@ def kiosk_reason_settings(self, token):
def _get_attendance_reason_settings(self, company):
show_reason = company.show_reason_on_attendance_screen
required_reason = company.required_reason_on_attendance_screen
default_sign_in_reason_id = (

Check warning on line 88 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L86-L88

Added lines #L86 - L88 were not covered by tests
company.reason_on_attendance_screen_default_sign_in.id
)
default_sign_out_reason_id = (

Check warning on line 91 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L91

Added line #L91 was not covered by tests
company.reason_on_attendance_screen_default_sign_out.id
)
return {

Check warning on line 94 in hr_attendance_reason/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

hr_attendance_reason/controllers/main.py#L94

Added line #L94 was not covered by tests
"show_reason_on_attendance_screen": show_reason,
"required_reason_on_attendance_screen": required_reason,
"default_sign_in_reason_id": default_sign_in_reason_id,
"default_sign_out_reason_id": default_sign_out_reason_id,
}

def _get_attendance_reasons(self, action_type, company):
Expand Down
117 changes: 69 additions & 48 deletions hr_attendance_reason/i18n/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-11-20 11:36+0000\n"
"Last-Translator: Lubomir Georgiev <[email protected]>\n"
"Language-Team: none\n"
"Language: bg\n"
"POT-Creation-Date: 2024-11-25 08:09+0000\n"
"PO-Revision-Date: 2024-11-25 08:09+0000\n"
"Last-Translator: Tom Tietze <[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"
"Plural-Forms: \n"

#. module: hr_attendance_reason
#: model:ir.model.fields,field_description:hr_attendance_reason.field_hr_attendance_reason__action_type
Expand All @@ -25,9 +24,8 @@ msgstr "Тип на действието"
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/attendance_menu/attendance_menu.esm.js:0
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.esm.js:0
#, python-format
msgid "An attendance reason is required!"
msgstr ""
msgstr "Необходимо е да посочите причина за присъствие!"

#. module: hr_attendance_reason
#: model:ir.model,name:hr_attendance_reason.model_hr_attendance
Expand All @@ -42,6 +40,7 @@ msgstr "Причина за отсъствие"

#. module: hr_attendance_reason
#: model:ir.actions.act_window,name:hr_attendance_reason.hr_attendance_reason_action
#: model_terms:ir.ui.view,arch_db:hr_attendance_reason.res_config_settings_view_form
msgid "Attendance Reasons"
msgstr "Причини за отсъствие"

Expand All @@ -53,17 +52,17 @@ msgstr "Кода трябва да е уникален"
#. module: hr_attendance_reason
#: model:ir.model,name:hr_attendance_reason.model_res_company
msgid "Companies"
msgstr ""
msgstr "Фирми"

#. module: hr_attendance_reason
#: model:ir.model.fields,field_description:hr_attendance_reason.field_hr_attendance_reason__company_id
msgid "Company"
msgstr ""
msgstr "Фирма"

#. module: hr_attendance_reason
#: model:ir.model,name:hr_attendance_reason.model_res_config_settings
msgid "Config Settings"
msgstr ""
msgstr "Конфигурационни настройки"

#. module: hr_attendance_reason
#: model:ir.ui.menu,name:hr_attendance_reason.hr_attendance_settings_redefinition_menu
Expand All @@ -73,9 +72,8 @@ msgstr "Конфигурация"
#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
#, python-format
msgid "Continue"
msgstr ""
msgstr "Продължи"

#. module: hr_attendance_reason
#: model:ir.model.fields,field_description:hr_attendance_reason.field_hr_attendance_reason__create_uid
Expand All @@ -87,6 +85,28 @@ msgstr "Създаден от"
msgid "Created on"
msgstr "Създаден на"

#. module: hr_attendance_reason
#: model:ir.model.fields,field_description:hr_attendance_reason.field_res_company__reason_on_attendance_screen_default_sign_in
#: model:ir.model.fields,field_description:hr_attendance_reason.field_res_config_settings__reason_on_attendance_screen_default_sign_in
msgid "Default sign-in reason for attendance screen"
msgstr "Причина за влизане по подразбиране за екрана за присъствие"

#. module: hr_attendance_reason
#: model:ir.model.fields,field_description:hr_attendance_reason.field_res_company__reason_on_attendance_screen_default_sign_out
#: model:ir.model.fields,field_description:hr_attendance_reason.field_res_config_settings__reason_on_attendance_screen_default_sign_out
msgid "Default sign-out reason for attendance screen"
msgstr "Причина за отписване по подразбиране за екрана за присъствие"

#. module: hr_attendance_reason
#: model_terms:ir.ui.view,arch_db:hr_attendance_reason.res_config_settings_view_form
msgid "Default value for sign-in"
msgstr "Стойност по подразбиране за вписване"

#. module: hr_attendance_reason
#: model_terms:ir.ui.view,arch_db:hr_attendance_reason.res_config_settings_view_form
msgid "Default value for sign-out"
msgstr "Стойност по подразбиране за отписване"

#. module: hr_attendance_reason
#: model_terms:ir.ui.view,arch_db:hr_attendance_reason.hr_attendance_reason_view_form
msgid "Define attendance reason"
Expand All @@ -100,14 +120,19 @@ msgstr "Име за показване"
#. module: hr_attendance_reason
#: model:ir.model,name:hr_attendance_reason.model_hr_employee
msgid "Employee"
msgstr ""
msgstr "Служител"

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
msgid "Error: could not find corresponding employee."
msgstr "Грешка: Не беше открит съответващ служител."

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
#, python-format
msgid "Go back"
msgstr ""
msgstr "Върнете се назад"

#. module: hr_attendance_reason
#: model:ir.model.fields,field_description:hr_attendance_reason.field_hr_attendance_reason__id
Expand All @@ -132,23 +157,26 @@ msgstr "Остави празно ако не е зависимо"
#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
#, python-format
msgid "Please return to the main menu."
msgstr "Моля, върнете се в основното меню."

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
msgid "Please select a reason to"
msgstr ""
msgstr "Моля, изберете причина за"

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/attendance_menu/attendance_menu.esm.js:0
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.esm.js:0
#, python-format
msgid "Please, select a reason!"
msgstr ""
msgstr "Моля, изберете причина!"

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/attendance_menu/attendance_menu.xml:0
#: model:ir.model.fields,field_description:hr_attendance_reason.field_hr_attendance_reason__name
#, python-format
msgid "Reason"
msgstr "Причина"

Expand All @@ -157,6 +185,11 @@ msgstr "Причина"
msgid "Reason Code"
msgstr "Код на причина"

#. module: hr_attendance_reason
#: model_terms:ir.ui.view,arch_db:hr_attendance_reason.res_config_settings_view_form
msgid "Reason is required"
msgstr "Необходима е причина"

#. module: hr_attendance_reason
#: model:ir.ui.menu,name:hr_attendance_reason.hr_attendance_reason_menu
msgid "Reasons"
Expand All @@ -166,30 +199,33 @@ msgstr "Причини"
#: model:ir.model.fields,field_description:hr_attendance_reason.field_res_company__required_reason_on_attendance_screen
#: model:ir.model.fields,field_description:hr_attendance_reason.field_res_config_settings__required_reason_on_attendance_screen
msgid "Required reason on attendance screen"
msgstr ""
msgstr "Задължителна причина на екрана за присъствие"

#. module: hr_attendance_reason
#: model:ir.model.fields,field_description:hr_attendance_reason.field_hr_attendance_reason__sequence
msgid "Sequence"
msgstr ""
msgstr "Последователност"

#. module: hr_attendance_reason
#: model:ir.model.fields,field_description:hr_attendance_reason.field_hr_attendance_reason__show_on_attendance_screen
msgid "Show on attendance screen?"
msgstr ""
msgstr "Показване на екрана за присъствие?"

#. module: hr_attendance_reason
#: model:ir.model.fields,field_description:hr_attendance_reason.field_res_company__show_reason_on_attendance_screen
#: model:ir.model.fields,field_description:hr_attendance_reason.field_res_config_settings__show_reason_on_attendance_screen
#: model_terms:ir.ui.view,arch_db:hr_attendance_reason.res_config_settings_view_form
msgid "Show reasons on attendance screen"
msgstr ""
msgstr "Показване на причините на екрана за присъствие"

#. module: hr_attendance_reason
#: model:ir.model.fields.selection,name:hr_attendance_reason.selection__hr_attendance_reason__action_type__sign_in
msgid "Sign in"
msgstr "Вписване"

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
#: model:ir.model.fields.selection,name:hr_attendance_reason.selection__hr_attendance_reason__action_type__sign_out
msgid "Sign out"
msgstr "Отписване"
Expand All @@ -199,7 +235,8 @@ msgstr "Отписване"
msgid ""
"Specifies the reason for signing In/signing Out in case of less or extra "
"hours."
msgstr "Уточни причината за Вписване/Отписване при по-малко или повече часове."
msgstr ""
"Уточни причината за Вписване/Отписване при по-малко или повече часове."

#. module: hr_attendance_reason
#: model:ir.model.fields,help:hr_attendance_reason.field_hr_attendance_reason__name
Expand All @@ -208,34 +245,18 @@ msgstr "Уточни причината за тръгване по-рано ил

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
#, python-format
msgid "Want to check out?"
msgstr ""
#: code:addons/hr_attendance_reason/static/src/components/public_kiosk/public_kiosk_app.esm.js:0
msgid "Wrong Pin"
msgstr "Грешен пин"

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
#, python-format
msgid "Welcome!"
msgstr ""

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
#, python-format
msgid "check in"
msgstr ""
msgstr "регистрация"

#. module: hr_attendance_reason
#. odoo-javascript
#: code:addons/hr_attendance_reason/static/src/components/kiosk_reason/kiosk_reason.xml:0
#, python-format
msgid "check out"
msgstr ""

#~ msgid "Last Modified on"
#~ msgstr "Последно променено на"

#~ msgid "Attendance reasons"
#~ msgstr "Причини за отсъствие"
msgstr "да се отметнете"
Loading

0 comments on commit 69f4a8b

Please sign in to comment.