Commit Graph
97 Commits
Author SHA1 Message Date
William Braeckman 48c0a5ac8b [FIX] hr_holidays_attendance: fix deduct extra hours
Since the Time Off B2B, the deduct extra hours didn't work anymore due
to an invalid domain.
This commit fixes the traceback but also the behaviour as the domain did
not make any sense anymore.

Also changes the default order for overtime records.

TaskId-2658077

X-original-commit: 13c57cdb3b797e56a164e5049b9f9d799ad127c9
Part-of: odoo/odoo#79498
2021-11-08 13:24:14 +00:00
William Braeckman 93cd3d295f [IMP] hr_attendance: improve overtime display on attendance closing
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

closes odoo/odoo#77841

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-10-26 14:10:56 +00:00
William Braeckman 10b5a5f819 [FIX] hr_attendance: fix wrong timezone comparison
When computing the overtime hours we use localized datetimes in order as
much as possible but we were localizing UTC datetimes to the wrong
timezones without converting them first which caused issues with company
thresholds.

Task ID: 2607436

closes odoo/odoo#74241

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-08-23 08:09:47 +00:00
William Braeckman 57f9b798af [FIX] hr{,_holidays}_attendance: compute correct default time off type
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
2021-08-23 08:09:47 +00:00
William Braeckman 2e17db2f51 [FIX] hr_attendance: fix necessary fields not present
`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
2021-08-23 08:09:46 +00:00
William Braeckman 06cdd9a92f [FIX] hr_attendance: fix overtime settings checks
Fixes minor problems encountered while doing task : 2607436.
A traceback when disabling the setting and the checks weren't disabled
if the option was completely disabled.

Task ID: 2607436
2021-07-27 08:23:03 +00:00
William Braeckman b429fce0e6 [REF] hr_attendance: change employee.base to employee
Moves the changes to employee from hr_attendance from the hr.employee.base
model to the hr.employee model.

Task ID: 1904850
2021-07-06 11:35:01 +02:00
Kevin Baptiste 9e6d2da504 [IMP] hr_attendance: compute overtime on attendances
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
2021-07-06 11:35:01 +02:00
Raphael Collet 35a9f6c27a [FIX] core: SELF_READABLE_FIELDS and SELF_WRITEABLE_FIELDS on res.users
Avoid setting up those lists with method __init__() on the model, since
the model's class no longer has the expected parent classes.
2021-05-06 07:30:24 +00:00
Swapnesh Shah 394c5f9544 [FIX] hr_attendance: compute worked hours when needed
Steps to reproduce the bug:

- Go to Attendances > Manager > Attendances
- Remove Check in value of an hr.attendance record A
- Set Check out to A

Bug:

A traceback was raised

opw:2513143

closes odoo/odoo#70088

X-original-commit: c462782f66d720266e7e8e7f616fc26c23f009c8
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-04-29 09:45:16 +00:00
Kevin Baptiste 8c5bfd351a [IMP] hr_attendance: show own attendances
Users with the rights 'Manual Attendance' get (read-only) access to their
own attendances.

closes odoo/odoo#66934

Taskid: 2438863
Related: odoo/upgrade#2216
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-01 13:33:35 +00:00
Barad Mahendra 2cb194e1b5 [FIX] hr_attendance: Fix traceback on creation of employee
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
2020-08-21 06:07:59 +00:00
Martin Trigaux 6156f98288 [FIX] *: adapt action content retrieval
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.*
2020-08-17 09:09:02 +00:00
Swapnesh Shah b37e4c97f9 [FIX] hr_attendance: correct datetime format in name_get
closes odoo/odoo#55764

X-original-commit: 88a489ba3e9e9c75bb86638294abe375faefd8b4
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-11 14:58:08 +00:00
Swapnesh Shah 8f8ec48f85 [FIX] hr_attendance: correct datetime format on warning
Before this Commit, Datetime on warning was not formatted based on User's lang.

With this commit, we use `format_datetime` to correctly format Datetime.

X-original-commit: b1bc2ba4a986bf7bce242496f822f9891937c9cf
2020-08-11 14:58:06 +00:00
Kevin Baptiste d24de2554e [IMP] hr,hr_attendance,hr_contract,hr_holidays,hr_presence: update employees presence icons
Make the employee presence icons more descriptive.
Allow to quickly filter the Presence Reports based on the user status.

closes odoo/odoo#54527

Taskid: 2246447
Related: odoo/upgrade#1488
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-05 12:22:29 +00:00
jvm-odoo 28655ac9c3 [FIX] hr_attendance: fix last month worked hours
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

closes odoo/odoo#51919

X-original-commit: 7918cccf0c6e28c25e909b1355eb7fda5373edb2
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-05-26 15:21:35 +00:00
Yannick Tivisse 152097d099 [IMP] hr*: Use correct default employee_id based on company
Followup of https://github.com/odoo/odoo/pull/50982/commits

Courtesy of https://github.com/sswapnesh

In a multi-company environment `self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)` could be wrong while `employee_id`represents correct employee based on company.

https://github.com/odoo/odoo/blob/fb17af76d791488c69eb3829376940b32998d374/addons/hr/models/res_users.py#L13

Making behavior Similar to https://github.com/odoo/odoo/blob/fb17af76d791488c69eb3829376940b32998d374/addons/hr_expense/models/hr_expense.py#L663

closes odoo/odoo#51246

Taskid: 2254687
X-original-commit: d7d1557e7a0f613335a9ca5ca1355d246093f9d1
Related: odoo/enterprise#10599
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-15 07:06:59 +00:00
Swapnesh Shah fb8a69706f [IMP] hr_attendance: use correct label in warning
Lable for the field `barcode` is `Badge ID`.

With this commit, We display the correct field name in the Warning.

closes odoo/odoo#50700

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-05 18:25:08 +00:00
Nicolas Martinelli e42aa1e344 [FIX] hr_attendance: do not allow grouping
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

closes odoo/odoo#38120

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-10-08 08:13:21 +00:00
Denis Ledoux 1ee3ec071e [FIX] base, hr_attendance: missing else in compute field, following odoo/odoo@9920f20e4c
closes odoo/odoo#37258

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2019-09-23 10:09:59 +00:00
Sapan Zaveri dafb128c14 [IMP] hr, hr_attendance: badge creation and few usability improvement
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>
2019-08-09 08:36:52 +00:00
Lucas Lefèvre 9419d171a8 [FIX] hr: Allow to access employee profile
The `private_email`, `last_check_in` and `last_check_in`
fields were added by e9d9898 to the
profile view but not in `SELF_READABLE_FIELDS`.
A simple user was therefore not able to read the field and
access his profile.

To avoid any similar oversight in the future, a test is added
to ensure a simple user is able to read all fields in
the profile view.
2019-08-07 12:37:52 +00:00
Kevin Baptiste e9d9898276 [IMP] hr: Review the UX for 'My Profile' view
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

closes odoo/odoo#34180

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-07-18 10:27:50 +00:00
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
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'`
2019-07-17 14:13:12 +02:00
Lucas Lefèvre f6fdde96bd [IMP] hr_*: Improve employee presence state
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

closes odoo/odoo#34933

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-07-17 09:11:18 +00:00
Raphael Collet b7fd679a6c [FIX] *: sudo() -> with_user() 2019-07-04 11:32:22 +00:00
Lucas Lefèvre ee1776dc5f [IMP] hr_attendance: Display checked in hours today
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.

closes odoo/odoo#33974

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-26 06:52:31 +00:00
Lucas Lefèvre 84517aabf6 [FIX] hr_attendance: Allow to checkin and checkout
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.

closes odoo/odoo#34058

Signed-off-by: Romain Libert (rli) <rli@odoo.com>
2019-06-12 12:24:36 +00:00
RomainLibert 1594f82780 [IMP] hr_attendance: Adapt module with new hr.employee.public model 2019-05-31 10:21:20 +02:00
Lucas Lefèvre d77ce4c2a9 [IMP] hr_*: introduce the employee profile
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
2019-02-14 16:28:54 +01:00
pha-odoo f14092cbfa [IMP] point_of_sale: Connect with Employee on PoS
=========
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

closes odoo/odoo#28567
2018-12-07 14:31:56 +00:00
Christophe Simonis f5c3dafb04 [MERGE] forward port branch saas-11.3 up to c0eef42711 2018-11-29 18:38:55 +01:00
Christophe Simonis efe7ca16b7 [MERGE] forward port branch 11.0 up to bb6f6c57f9 2018-11-28 17:44:46 +01:00
Alexandre Saunier 1d2a4d8459 [IMP] hr_attendance: faster loading of employees kanban view 2018-11-22 12:22:36 +00:00
Christophe Simonis f66a9cdbcf [MERGE] forward port branch 11.0 up to bab5ccfdd7 2018-11-05 17:51:04 +01:00
David Beguin f20cd3db75 [FIX] hr_attendance : kiosk mode multi scanning
- 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

closes odoo/odoo#28150
2018-10-31 14:35:27 +00:00
Christophe Simonis 8cf43f1350 [MERGE] forward port branch 11.0 up to ee0ff262f0 2018-10-29 17:12:53 +01:00
Christophe Simonis ee0ff262f0 [MERGE] forward port branch saas-15 up to 953dfe92c2
closes odoo/odoo#28255
2018-10-29 14:16:45 +00:00
Christophe Simonis d692f3b781 [MERGE] forward port branch saas-14 up to 1916fdc1d0 2018-10-29 13:46:47 +01:00
Martin Trigaux bfbaa09268 [FIX] hr_attendance: allow multiple attendances
If the search returns more than one result, the rendering of the message would
crash (SingletonError when accessing check_in field value).

Use the same order and limit as both search before and after

Courtesy of David Tran

Closes odoo/odoo#28055
2018-10-25 11:49:15 +02:00
Nicolas Martinelli 6604f7aef1 [FIX] hr_attendance: multiple scans
- Open the Attendance kiosk mode
- Scan an incorrect barcode

It's not possible to scan any barcode anymore.

If the barcode is incorrect, we need to add back the event listener.
Moreover, the RPC introduced with bbc7e9586d is not necessary if
we retrieve the barcode thanks to the existing RPC call.

opw-1878632
opw-1888402

closes odoo/odoo#28354
2018-11-02 10:43:38 +00:00
Christophe Simonis 5e055a2afd [MERGE] forward port branch saas-11.4 up to f6ca72b3ce 2018-11-02 10:52:55 +01:00
Christophe Simonis 86ff929ad6 [MERGE] forward port branch saas-11.4 up to 1199451606 2018-09-10 17:06:18 +02:00
Yannick Tivisse 7978d4ba0f Revert "[IMP] *: Define groups on res.users models"
This reverts commit 99f497b390.
2018-09-10 14:23:42 +02:00
Raphael Collet 960360afe4 [REF] *: use native date/datetime for Date/Datetime fields
From this commit onwards, Date fields will return datetime.date objects and Datetime fields will return datetime.datetime objects, this implies a number of things that are clearly explained both in the ORM API for master.

This commit also introduces a number of helper functions for dates and datetimes that are exposed in tools.date_utils and fields.Date[time], explained in the documentation as well.

Task-ID: 47189
2018-08-06 14:37:19 +02:00
Christophe Simonis f36e6917bd [MERGE] forward port branch saas-11.3 up to 37eed7c509 2018-05-29 17:34:43 +02:00
Christophe Simonis 644f0959d0 [MERGE] forward port branch saas-11.2 up to 1655202924 2018-05-17 14:23:37 +02:00
Christophe Simonis 96e5455079 [FIX] hr_attendance: compute attendance state as sudo()
Since `last_attendance_id` is stored, `sudo` is needed as employees
doesn't have access to their collegues attendances.
2018-05-15 13:51:02 +02:00
Yannick Tivisse 99f497b390 [IMP] *: Define groups on res.users models
The reified view on the res users will be dropped in the following commit.

The previous commit adds support to define each group as a computed field on the res users.

This commit defines:
- A boolean field for each 'isolated' res.group, i.e. a group in the hidden category.
- A selection field for each 'Application' res.group, i.e. a group in a application category.

Example:
- The group to manage pricelist in sales becomes a boolean field
- The groups project user/manager become a selection field
2018-04-26 15:13:38 +02:00