Skip to content

Commit

Permalink
[12.0][IMP] hr_attendance_modification_tracking: add manual column pr…
Browse files Browse the repository at this point in the history
…e-install
  • Loading branch information
Jaime Arroyo committed Jul 8, 2020
1 parent 7466252 commit 5d85630
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hr_attendance_modification_tracking/__init__.py
@@ -1,2 +1,2 @@
from . import models
from . import tests
from .hooks import pre_init_hook
2 changes: 1 addition & 1 deletion hr_attendance_modification_tracking/__manifest__.py
Expand Up @@ -12,10 +12,10 @@
'website': 'https://github.com/OCA/hr',
'depends': [
'hr_attendance',
'mail',
],
'data': [
'views/hr_attendance_view.xml',
],
"pre_init_hook": "pre_init_hook",
'installable': True,
}
11 changes: 11 additions & 0 deletions hr_attendance_modification_tracking/hooks.py
@@ -0,0 +1,11 @@
# Copyright 2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


def pre_init_hook(cr):
cr.execute(
"""
ALTER TABLE hr_attendance
ADD COLUMN IF NOT EXISTS time_changed_manually BOOLEAN
"""
)
@@ -0,0 +1,11 @@
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(
env.cr, """
ALTER TABLE hr_attendance
ADD COLUMN IF NOT EXISTS time_changed_manually BOOLEAN
"""
)
13 changes: 8 additions & 5 deletions hr_attendance_modification_tracking/readme/DESCRIPTION.rst
@@ -1,9 +1,12 @@
Attendance changes will now be registered in the chatter.
This will help prevent cheating in check-in or check-out time.
List and form views also include this change information.

Use cases:
1) Attendances created from kiosk or check-in/check-out screens, are created as automatic.
If their check-in or check-out dates are modified by any user, attendances are checked as
'Manually changed'.
2) Attendances created from form view will apply a 60 seconds tolerance between entered and real times.
If this tolerance is surpassed, attendances are checked as 'Manually changed'.

- Attendances created from kiosk or check-in/check-out screens, are created as automatic. If their check-in or check-out dates are modified by any user, attendances are checked as 'Manually changed'.
- Attendances created from form view will apply a 60 seconds tolerance between entered and real times. If this tolerance is surpassed, attendances are checked as 'Manually changed'.

Note:

- Attendances already created won't be checked automatically on installation since it could take a large amount of time. If this is wanted it will be necessary to do it manually later.

0 comments on commit 5d85630

Please sign in to comment.