Currently, an error occurs when the user tries to open an employees
who checks in but does not check out.
Steps to produce:
1. Install 'hr_attendance'
2. Open Attendence > Attendences > create new
3. Set check In date previous month and no add Check out
4. Open employees > try to open current user
Error: `'<=' not supported between instances of 'bool' and 'datetime.datetime'`
This is because https://github.com/odoo/odoo/pull/140629 added [1] in the
filter, but in certain cases, the `att.check_out` may not be present.
This commit fixes the above issue by filtering attendees who have
a check-out date.
[1]-https://github.com/odoo/odoo/blob/46f2a019bd141389233257f24f0ddae05b0fa008/addons/hr_attendance/models/hr_employee.py#L82
sentry-4616207347
closesodoo/odoo#141771
X-original-commit: b0cb1ad7b43a296b91377df80b30cbd3976553b4
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Steps to reproduce:
-------------------
- add lunchtime in an employee's calendar;
- in Attendance app, add attendance for
this employee for the current month;
(The hours calculated in the attendances
take into account the lunchtime.)
- go to the form view of this employee;
Issue:
------
The statistics button, which displays the hours worked this month,
does not take into account lunchtimes.
Cause:
------
To find the hours worked, we calculate the difference
between the `check_in` and the `check_out`.
Solution:
---------
Use the `worked_hours` field of attendance, which takes into
account the employee's calendar and therefore lunchtimes.
opw-3547521
closesodoo/odoo#141282
X-original-commit: 94bd34af19d14da5deafd8f34f93ff71e35c8782
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
Fixes a large number of cases where strings are translated then
formatted, instead of letting `_()` do the formatting internally,
which allows it to recover from incorrect translations (missing,
broken, or extra placeholders).
Also
- removes translation markers entirely when there's nothing to
translate e.g. `_("%s - %s")` is not useful
- fixes a few messes which lead to only partial translatability
(DRY is generally a bad idea when translations are involved, even
more so when you don't make the variable part translatable)
- fixes a few nearby issues noticed at the same time
- replaces a few `"%s"` by `%r`, which should automatically quote
strings relatively appropriately
- fixes translated strings which use `\` to escape a newline (in order
to fill-paragraph): `\` escapes only the newline, if the
continuation string is indented this results in a bunch of spaces
ending in the string to translate, which is pretty garbage for the
translator, using implicit concatenation works much better
Note: some of the updates revert f-string parameters to %, because
babel (2.9) apparently has trouble with f-strings and blows up trying
to extract them.
Not in scope:
Helping translators fix translatable strings e.g. any translation
string with more than one placeholder probably should use keyword
placeholders
- Provides more context / data to the translator to make sense of the
sentence.
- Allows reordering the translated terms, which can be necessary
depending on the sentence and language.
closesodoo/odoo#139314
Related: odoo/enterprise#49311
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Employee presence is not a sensitive data and should be available for all db users
this commit moves the computations from attendance, holidays and hr_presence to the
employee_base model, which is how it was originaly made in the hr module. This way
the presence marker does not depend on the user's hr rights
closesodoo/odoo#118437
Task: 3267790
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Fixes a situation where users who are part of the Attendances Officer (or Manager) group but
without access to private employee data would see the following error when trying to book time
off.
`ValueError: Invalid field 'last_check_in' on model 'hr.employee.public'`
Other instances of the same ValueError were observed by managers trying to approve employee leave
and employee expenses.
As per hr/models/hr_employee.py:22-26 fields not available on hr.employee.public should have
groups='hr.group_hr_user' and this was not the case in hr_attendance.
closesodoo/odoo#120324
X-original-commit: ff4e7d6a414097d000e62825cf43425ea14bd77e
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Add new settings to allow the user to select which camera to use for the
barcode scanner and to allow/disallow the manual identification of
employees.
task-2973809
closesodoo/odoo#99622
Related: odoo/enterprise#31082
Signed-off-by: Kevin Baptiste <kba@odoo.com>
The icon that is displayed in the employee kanban view is determined by the
field hr_icon_display, computed in the method _compute_hr_icon_display. This
method is overridden in multiple modules such as hr_holidays, hr_attendance
and hr_homeworking.
Currently this field has a state to show no icon (presence_undetermined). In
this change this state is extracted into the a separate field
show_hr_icon_display with the default state of hr_icon_display being
presence_to_define. In this way a module such as hr_attendance, which only
overrides _compute_hr_icon_display to show the default icon for everyone as a
default, now only needs to change this separate field and does not need any
knowledge of what other states exist. This reduces coupling between modules.
Revision 7fd7422647
takes care to prevent employees to modify manually their attendances,
by removing the edit button from the attendance list.
This is only visual, this doesn't actually
prevent users to change their attendances,
for instance through XMLRPC.
Besides, with the group comment:
```xml
<record id="group_hr_attendance" model="res.groups">
<field name="name">User</field>
<field name="category_id" ref="base.module_category_human_resources_attendances"/>
<field name="comment">The user will gain access to the human resources attendance menu, enabling him to manage his own attendance.</field>
</record>
```
To me:
- Employees should be able to sign in and sign out only
- Attendance users should be able to modify their own attendances only
- Attendance managers can modify attendances of anybody.
Hence, instead of removing the edit button on the view,
change the ACLs so employees do not have the rights to modify their
attendances at all.
Part-of: odoo/odoo#98551
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
fields having a tooltip in the future UI.
4/ some cleanup of existing messages too
The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX
closesodoo/odoo#97279
Signed-off-by: Fabien Pinckaers <fp@odoo.com>
Reproduction:
1. Install Attendance app
2. Create a new internal user “kiosk”, with only access right “Kiosk
Attendance” for app “Employee”, other places as blank
3. Make sure the Settings for Attendance app, Employee PIN is unchecked
4. In an incognito tab, log in as kiosk, go to Attendance, click “kiosk
mode”, then “identify manually”
5. Choose an employee, with a warning message “Wrong pin”
Reason: A recent update refined the user group check for the
attendance_manual function. Checking if the user is an officer in the
Attendance app can be over strict. However, after discussing with yti,
we decided to pop up a warning message for security reasons when the
user would like to use Kiosk mode without pin code.
Fix: Add a warning message for higher access right requirement
opw-2898452
Related fix in V15: https://github.com/odoo-dev/odoo/commit/2975c0539d8c2781ff56a9f8be8e302d45b7d80bclosesodoo/odoo#96230
X-original-commit: 82f2966ed5b3afd30ac5b18c32af7993746fc681
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Improves on the display when closing an attendance to display today's
overtime aswell as the total overtime the employee has.
Also small cleanup, remove unused variable.
TaskId-2655689
closesodoo/odoo#77841
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Previously the default time off type computed when pressing the deduct
extra hours button would not always be valid, this commits aims to
change that behaviour.
The form would also not recognize the fact that we are in a overtime
deductible context when the time off type was not bound to a company.
Task ID: 2607436
`attendance_state`, `hours_today` and `last_attendnace_id` are required
to open up the attendance app, but were not available to the public user
since commit b429fce0e6
Task ID: 2607436
This commit adds a new model `hr.attendance.overtime`.
When an employee checks out, an overtime entry will be created when:
- the option is enabled on the company;
- the employee worked more or less than the number of hours they
were supposed to work that day.
TaskID: 1904850
Currently, when you create a employee when hr_aattance is installed
then it will create traceback due to falder timiezone
so in this commit, Fix the issue and if timezone is not set on
employee then pass the 'UTC'
TaskID: 2283753
Use _for_xml_id to replace all the self.env.ref().read()[0]
This has the advantage of having a single point of control and to add
the fields filtering and model verification.
Add sudo for other operations on ir.actions.*
Make the employee presence icons more descriptive.
Allow to quickly filter the Presence Reports based on the user status.
closesodoo/odoo#54527
Taskid: 2246447
Related: odoo/upgrade#1488
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Issue
- Attendances > Manager > Attendances
- Create a line for any employee
check-in 30/04/2020 12PM
check out 01/05/2020 12PM
- Go to Employees > the employee
Last month worked hours = 0
but it should be 12
Cause
We only take into account records
checked_out the previous month
Solution
Rethink the whole method to
take into account records
checked_in last month and
checked_out this month
And adding timezone handling
OPW-2259533
closesodoo/odoo#51919
X-original-commit: 7918cccf0c6e28c25e909b1355eb7fda5373edb2
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Lable for the field `barcode` is `Badge ID`.
With this commit, We display the correct field name in the Warning.
closesodoo/odoo#50700
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
The user for the kiosk mode must have access to personal information of
the employees. To avoid easily leaking information, prevent grouping.
Fixes#34231
opw-2079330
closesodoo/odoo#38120
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
hr:
-rename btn 'generate badge ID' to 'generate'
-When the badge ID is set, replace the button Generate by "Print Badge"
hr_attendance:
-Rename menu 'Manage Attendances' to "Manager"
-Add a column "Work Hours" to attendee tree view
-Add a <br> after "Welcome to"
-add class text-muted on "or"
-remove class "text-muted" on "scan your badge
-Rename the primary btn into "Identify Manually"
Task-2040884
Closes: #35473
Signed-off-by: Romain Libert (rli) <rli@odoo.com>
1/ web: adapt formatDate to handle NaN values
DashboardRenderer might return NaN for `Date` or `DateTime` fields if
their original value is null or incorrect.
2/ hr: add job_title in demo data
3/ hr_recruitment: link employee in the chatter for new recruits
4/ hr: remove employee documents in the model
5/ hr_attendance: improve resiliency of relative_time
6/ hr: display manager on res_users
7/ hr: change Address Book to Employee Directory
TaskID: 2009111
closesodoo/odoo#34180
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.
Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
Purpose
=======
There are currently multiple ways to determine if an employee is presence
or absent:
- login state (user status on chat)
- checkin/checkout from the Attendance app
- leave
- hr_presence (email, ip)
Those states are displayed in several different places and can be inconsitent.
e.g. Logged in -> green in the chat
Not checked in -> red on the employee kanban view.
The multiple ways to determine employee presence described above
should be aggregated together to have a better consistency.
Specification
=============
There are 3 presence states (previously defined in module `hr_presence`),
namely `present`, `absent`, `to_define`. They are now defined as soon as
`hr` module is installed.
The state computation can have several behaviors according to which apps
are installed:
1. `hr` is installed
Check employee presence based on login by default (only for employees with
a user).
Kanban state (private and public): should be green when logged in, red when logged out and
orange when the user is away.
Private employee form: Display a stat button "Connected" on the form view
when the user is logged in or "Last Activity xx/xx/xxx" otherwise.
2. `hr_attendance` is installed:
when the user is logged out, the state
is determined from the checked in/out state. But when the user is logged in,
consider the user as present (even if he checked out).
Kanban state: green for checked in, red for checked out
Private form view: attendance stat button.
3. `hr_holidays` is installed:
Has the highest priority if the employee is on leave.
Kanban state: red if employee is on leave.
Private form view: stat button "Absent Until xx/xx/xxxx" if employee
is on leave.
4. `hr_presence` is installed:
Two additionnal presence checking option: emails sent and IP address connected.
Once a user sent an email or the IP address was connected, he is considered
present for the entire day.
There should be at most one stat button on the employee form view, with the
relevent information.
Task id: 2024482
closesodoo/odoo#34933
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Purpose
======
When an empoyee wants to check out, he does not know the number of hours he worked today.
Specification
==========
In the check out view, display how many hours the employee was checked in today.
closesodoo/odoo#33974
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Since 1594f82 a user can no longer checkin/checkout if not
in kiosk mode (warning "Wrong Pin").
The mentionned commit revealed a previous mistake: the pin was
never checked if `None` was provided because superuser does not have
group `hr_attendance.group_hr_attendance_use_pin`.
Pin checking should work as follows:
- For the logged in user: he should be able to checkin/checkout
without his pin through the "My attendances" action and with his pin
in kiosk mode
- For other employees: they should only be able to checkin/checkout with
their pin through kiosk mode.
The opportunity is taken to make method `attendance_action_change` private.
closesodoo/odoo#34058
Signed-off-by: Romain Libert (rli) <rli@odoo.com>
General Purpose
===============
We want an 'Employee profile' gathering every data about an employee.
The main form view is modified to become this employee profile.
A user can also see his own profile through the Preferences menu.
The new profile replaces the current Preferences view if the hr module is installed
and the current user is linked to an employee.
A user should be able to see and edit his own profile.
*Problem*:
Many fields on hr.employee are protected by groups="hr.group_hr_user".
Therefore, a regular user cannot see or edit those fields.
This protection must be bypassed to allow read/write access
to the regular user's own data.
A similar mechanism already exists for res.users (for Preferences)
The better (least worst) solution found is to reuse this mechanism by adding related fields on res.users.
Pros:
- Don't change security access on hr.employee
- Don't implement yet another custom security layer, risking to add new security breaches
- A lot of fields are added by other modules on hr.employee.
It would have required to integrate them with the custom security layer.
- Fields added by other modules on the user's preferences view (normal view, not the profile)
are automatically included in the employee's profile view.
- Allow the hr.employee form view to be different than the user profile accessible
through the Preferences menu.
E.g. add custom buttons only relevant to the logged in user such as "Request a leave".
Cons:
- Each field from hr.employee that you want to appear on its profile
must be added as a related field on res.users
- Those related fields must be added to user's preferences view (duplicate views)
- They also must be added to SELF_[READABLE | WRITABLE]_FIELDS
Note:
When the front-end loads the views it gets the list of available fields
for the user (according to its access rights). Later, when the front-end wants to
populate the view with data, it only asks to read those available fields.
However, in this case, we want the user to be able to read/write its own data,
even if they are protected by groups (groups are kept on the related fields on res.users).
The front-end need to be made aware of those fields by sending all field definitions.
hr_attendance
=============
This commit integrate attendance in the new employee profile.
It also adds a stat button to this employee profile showing
the number of hours worked last month.
Remove the boolean computed field 'manual_attendance'.
This field is just a shortcut to add/remove the employee's user
in the "Manual Attendance" group.
The checkbox is confusing on the employee's form and this should
be done through the normal group management screens.
hr_presence
===========
Display the presence status on the employee kanban template.
The status is a colored chip which can be green (present),
orange (to define) or red (absent).
Currently, the presence status is only computed when accessing
the report view. As this commits displays it on the employee kanban,
it should be updated more frequently.
The state should not be updated every time the kanban view is loaded
since the computation is a bit heavy. Instead: add a cron to update
status every 15 minutes.
-> The status is accurate on the report view (status is still updated
when loading the view)
-> The status in accurate at 15 minutes on the kanban view
[ADD] hr_attendance_presence
============================
Bridge module between hr_attendance and hr_presence.
This commit integrates hr_presence module in the employee
profile and adds the presence status on the employee kanban view.
But hr_attendance adds at the same place a similar status icon for
checkin/checkout.
This bridge module makes the status from hr_presence invisible as
hr_attendance should be the main presence control mechanism.
Also, this commit adds the ability (through a new setting option)
for hr_presence to take into account checkin/checkout to determine
the presence status.
l10n_be_hr_payroll
==================
integration with employee profile
=========
PURPOSE
=========
{Any employee can work on a PoS session, even if he has no user. This decreases the cost of PoS App.}
We are not competitive enough on the PoS Market because customers have to pay one user per cashier while they expect to pay one user per cash station.
===============
SPECIFICATIONS
===============
pos.config
- Add a checkbox : "Login with Employees"
- If set to TRUE, an "Allowed Employees" many2many appear
- If employees many2many is empty, all employees can log on this PoS
- If set to FALSE, can only log in with the currently logged user
hr.employee
- The barcode and pin fields were be moved to the hr.employee
- Set a barcode (not pin) by default at the creation of any employee
- No Employees module with PoS > dependency to hr
Open the PoS if "Log in with Employees" = FALSE
- Same behaviour than now, when I open the PoS, I'm logged in with the current user and can start working at once. The only difference is that it is not possible to switch users anymore.
- The button to close the session is visible
Open he PoS if "Log in with Employees" = TRUE
- When I open the PoS, the first screen I see is the login screen.
(a) I choose my employee and enter my pin code (if there is pin code on my employee, otherwise not required) (I can only see employees that have access to that PoS)
(b) I scan my barcode
(c) I scan my rfid card (future development)
- When I click on the employee name, I can log in with another employee
- If the employee is linked to a user that has the pos user/manager access right, I can see the button the close the session. Otherwise I cannot close the session (and thus cannot access backend).
- Add field employee on all records created by PoS (and replace the field user by that one) (on pos.orders)
Lock Screen
- Improve the PoS Interface
- Add a new feature to allow to "lock" the session. When a session has been locked, the user/employee has to re-log-in to access the PoS
- When I try to re-log-in, by default suggest the last employee logged in in the login screen
Migration
Plan a migration strategy > barcode and pin is now on the employee and not on the user anymore
closesodoo/odoo#28567
- Scan a barcode for employee 1 in kiosk mode
- At greetings message, scan a barcode for employee 2
2 attendance entries are created for employee 2 instead of 1.
When scanning the barcode for employee 2, the event listener
`_onBarcodeScanned` is still active on `KioskMode`. Therefore, the RPC
call to `attendance_scan` is performed twice.
We deactivate the event listener after scanning, and reactivate on
`KioskMode` only if there is an issue. This is sufficient since the call
to `do_action` in `GreetingMessage` will create another instance of the
client action. In `GreetingMessage`, we add back the redirection to
`KioskMode`.
Co-authored-by: Nicolas Martinelli <nim@odoo.com>
Linked to Task ID 1878251
opw-1878632
opw-1888402
closesodoo/odoo#28150
The timezones are already managed in the JS.
So on the attendance check in/out screen when a user clocked out
after 8 hrs he got a message saying that he has been in for more than 12 hrs.
opw:710161