Commit Graph
124 Commits
Author SHA1 Message Date
Xavier Morel 9ebbfdac73 [FIX] *: incorrect translations markings
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.

closes odoo/odoo#139314

Related: odoo/enterprise#49311
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-23 16:45:09 +00:00
Jurgen (jugj) bf67f1e20e [IMP] hr_(holidays)_attendance : Revamp Attendance V17
Part-of: odoo/odoo#135439
2023-10-19 14:47:18 +00:00
Melanie Peyrat (MEPE)anddasz b3be3af61c [ADD] hr_homeworking: add homeworking
Users and employees can now define their usual worklocation
for a day of the week aswell as define unusual ones from the
calendar app. The worklocation is then displayed in the calendar
in two different ways: when only one person is selected, there
is a circle with an icon in it, and a ray that extends to the right
if the person is at the same location for multiple days. If there
are multiple persons selected there is no ray, instead the circles
are grouped by location type and colored accordingly to the filters
in the left panel.

closes odoo/odoo#129585

Task: 3060685
X-original-commit: c74ac3f698d4ea4c9b7a5e060fba4cf77cc9a6d7
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Co-authored-by: dasz <dasz@odoo.com>
2023-07-25 21:22:46 +02:00
Rémy Voet (ryv) c5cb357d90 [IMP] *: add dependencies to display_name field
The previous commit introduced an optimization to reduce the number of
queries and fields fetched when we call `name_search`. But it works much
better when the dependencies of `display_name` contain field names used
in the calculation (on the same record/model).

Then, to improve the performance and the cache coherency, add `depends`
and `depends_context` depending on the custom `_compute_display_name`.
Add only the first level of dependencies (never traverse relational
field) because only these have a positive impact on the previous
optimization and the cost is very low (see `modified`).
About `depends_context`, we don't include `lang` because (when `_` is
used by example) it is unlikely to get the same display_name in the same
request with two different lang.

closes odoo/odoo#122085

Related: odoo/documentation#4639
Related: odoo/enterprise#42599
Related: odoo/upgrade#4780
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-06-28 17:41:19 +02:00
Rémy Voet (ryv) 3c62ca1eb9 [REM] core: remove name_get API
Rationale
=========

Since v8, the `display_name` field is present on all models. By default,
`display_name` uses `name_get` which has pretty much the same purpose
(return record name used by the web client). Gradually, many (backend)
developers (and the ORM: https://github.com/odoo/odoo/commit/6da1c3ac4c036eac289597602976538e243cb939)
started using `display_name` (more convenient than
`record.name_get()[0][1]`) but it still had the `name_get` override.
It becomes more complex than necessary and poeple start to misunderstand
the two (and sometimes override both, leading to inconstiencies between
`display_name`/`name_get`).

To simplify the ORM and the API, we decided to keep only one of them,
the `display_name` field:
- It is much more convenient from a backend point of view
(`record.name_get()[0][1]` vs `record.display_name`)
- It is cached during the same transaction (and invalidated if
its dependencies change)
- It can be overridden like any other compute field (override
`_compute_display_name` with any extra dependencies)
- `name_get` is replaced by `read(['display_name'])`
(API perceptive), which can actually be more efficient
(if `display_name`'s depends are correct, the ORM will only fetch the
fields it needs instead of every prefetchable field)

Changes
=======

- Deprecates `name_get` for the v17 and based the method on
`display_name` (the opposite of before)
- Converts all usage of `name_get`
- Overrides of `name_get` are now overrides of `_compute_display_name`
- For `res.partner`, rename the field store `display_name` into
`complete_name` because `display_name` context-dependent and it makes
no sense to have a compute store that is context-dependent.
- Previously, it was possible to return multiple names for the same
record with `name_get`, but it was tricky and most of the usage of
this `name_get` didn't take this into account. The only example of
this is the `name_get` of `product.product`
(now use `", ".join(<names>)`).

Part-of: odoo/odoo#122085
2023-06-28 17:41:19 +02:00
althaf shaik 2fdefd0f21 [FIX] hr_attendance: restrict to compute worked hours without employee
This traceback raises when user not selected 'Employee' and only selecting
'Check In' and 'Check Out', while creating a new attendance.

To reproduce the issue:

1) Install hr_attendance
2) Open Attendance and create a new record
3) Give values to only 'Check In' and 'Check Out'

Error:  "AttributeError: 'bool' object has no attribute 'upper'" appears.

On '_compute_worked_hours' method calendar variable is getting value from
employee_id and that calendar timezone is used to get timezone.

https://github.com/odoo/odoo/blob/937d207028ab9bc1d3d332dc6dfe25f0de045026/addons/hr_attendance/models/hr_attendance.py#L50-L60

Therefore in the above use case, when triggering the compute method,
because of 'calendar' is depending on 'employee_id' and when
employee is not selected, it will leads to the above traceback.

Sentry-4274226351

closes odoo/odoo#126465

X-original-commit: 31491e40d2505c03d76e6c802435ad1dafa71c52
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-27 09:29:30 +02:00
Wolfgang Taferner 080c2fc574 [IMP] hr_*_attendance: leave in terms of working time not respected
As the leave is deducted from the needed time to work
in case for example Home Office which is configured as
working time (other) is handled like a real leave (absence)
which will lead to an extensive overtime instead the difference
to the work entry defining the work time.

A domain clearing out this missing link and variation
cleans up this misalignment and therefore overtime will
be computed correctly.

closes odoo/odoo#126373

X-original-commit: 02a679d6ab7db49c8338471e5fc85c1141f8e877
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Wolfgang Taferner <w.taferner@wtioit.at>
2023-06-26 21:10:37 +02:00
dasz c68e4606f8 [IMP] hr,hr_presence,hr_attendance,hr_holidays: move presence computation to employee_base
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

closes odoo/odoo#118437

Task: 3267790
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-05-31 15:53:54 +02:00
Thomas Lefebvre (thle) bc2d796dbc [FIX] hr_attendance: prevent the edition of employee_id
Issue:
A user has write access rights to modify his own attendances.
However, he can modify the `employee_id` field.
This can cause attendances to be moved to other employees.

opw-3280850

closes odoo/odoo#120632

X-original-commit: 1c25a9b964e9e2acf9d431897e83cf72ecdca1cb
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-05-05 14:55:00 +02:00
dasz 1b8b35e216 [FIX] hr_attendance: account for lunch break in overtime calculation
Remove lunch hours from work intervals so that overtime is not calculated when it's not due
tests adapted to take into account lunch period

task 3217799

closes odoo/odoo#120455

X-original-commit: 97c052432a25a1461de23fd8ab0c73ffe9b084ff
Related: odoo/enterprise#40677
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-05-04 08:56:12 +02:00
Marc Durepos c999f1ec14 [FIX] hr_attendance: prevent error caused by pre-fetching non-public employee fields
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.

closes odoo/odoo#120324

X-original-commit: ff4e7d6a414097d000e62825cf43425ea14bd77e
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-05-03 08:38:13 +02:00
Victor Feyens f4ea6d3226 [FIX] *: strict api for main orm methods
Enforce strict types for returned values for
* create
* write
* unlink
* default_get

to make those methods more consistent and reliable.
Also make sure they can be called with empty self/values,
i.e. that they follow the same behavior as the base methods
defined in the main orm Model.

closes odoo/odoo#116809

Related: odoo/enterprise#38880
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-04-25 15:20:43 +02:00
Rémy Voet (ryv) 234db70d86 [IMP] *: Use the new API of _read_group for backend use
Part-of: odoo/odoo#110737
2023-04-19 21:58:27 +02:00
Xavier BOL (xbo)andYannick Tivisse 1648c25cc9 [IMP] resource: make working schedule optional in resource model
closes odoo/odoo#110548

Related: odoo/upgrade#4248
Related: odoo/enterprise#36101
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Yannick Tivisse <yti@odoo.com>
2023-02-22 20:25:16 +01:00
Yannick Tivisse 3bdfbe31c0 [IMP] hr_attendance: Take lunch time into account on work hours count 2023-02-03 10:25:00 +01:00
Goffin Simon f864ac9d23 [FIX] hr_attendance: Function write must return True
The function write must return True when it ends.

opw:3121809

closes odoo/odoo#109713

X-original-commit: 6adeabf6445c72e7ddfd540ceaea8c01473e062d
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Simon Goffin <sig@odoo.com>
2023-01-12 11:09:40 +01:00
Julien Castiaux ad9bd90d7b [FIX] core, *: BaseModel overrides signatures
*: base, account, crm, hr, hr_attendance, test_access_rights

The various public methods of the ORM can be override in other models,
those overrides sometime don't implement the exact same signature as the
original method in the ORM. In this work we sanitize all the overrides
to ensure a better compatibility. The background objective is to make it
possible to call any public method using kwarg: `search(domain=[...])`.

* `search`, the first parameter was renamed from `args` to `domain` in
  0e9adf7 but the overrides were not updated.
* `invalidate_models` and `invalidate_recordset`, a new `flush=True`
  parameter was introduced in 9c3b9a4 but the overrides were not
  updated.
* `update`, there is a clash between the `update` method responsible for
  writing on a record and `update` in bus responsible to update the user
  presence. The bus method has been renamed so it doesn't clash with the
  ORM.

This sanitization comes with a new linter that verifies that all
overrides of BaseModel public methods share a compatible signature. The
linter has been disabled for `create`, `write` and `default_get` as too
many overrides don't respect the signature of BaseModel.

closes odoo/odoo#106999

Related: odoo/enterprise#34991
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-12-15 12:36:56 +01:00
Kevin Baptiste 80576925e9 [FIX] hr_(holidays_)attendance: recompute overtime on leaves > 1 day
1/ When approving / refusing a leave spanning multiple days, the
   overtimes were only recomputed for the starting date and not the
   whole period.

2/ Overtimes should be computed whatever the kind of time off that's
   been taken (Absence or Other).

task-3073155

closes odoo/odoo#106751

X-original-commit: 116d7cb46132404354e00e67a2364b8239fcdce5
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-11-29 09:32:48 +01:00
Kevin Baptiste 6610e7e183 [IMP] hr_attendance: add camera choice for barcode scanner
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

closes odoo/odoo#99622

Related: odoo/enterprise#31082
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-09-07 09:23:47 +02:00
Rob Coekaerts 351bcdbb41 [REF] hr: Split hr_icon_display into two separate fields.
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.
2022-09-02 13:18:33 +02:00
Denis Ledoux 56a087284f [IMP] hr_attendance: do not allow employees to edit their attendances
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
2022-08-29 22:42:52 +02:00
Abdelouahab (abla) 124ae0f340 [FIX] hr_attendance: take into account employee's leaves
To Reporduce
=============
1.  Create  employee with Standard Working Schedule (100% presence / 40 hours / 08:00 - 12:00 & 13:00 - 17:00)
2. Create Time off type: Paid time off with following settings:
- Take time off in: Hours
- Deduct Extra Hours: No
3. Create a time off request for half a day for this employee (8/17/2022; morning)
4. Approve Time Off Request
5. Create an attendance record for this employee for the afternoon on this day (13:00 - 17:00)

Problem
=======
On the attendance report, this employee has -4:00 Extra Hours, which means that the leave wasn't taken into
account when computing Extra Hours

Solution
=========
to solve the issue we take into account the Employee's leaves when computing Extra Hours

opw-2956895

closes odoo/odoo#98969

X-original-commit: 3da24993f5ad6d7b56ee332589ff822eac8ada5c
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-08-27 03:33:43 +02:00
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
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

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00
Jinjiu Liu 38f65669de [FIX] hr_attendance: change the user group check for Kiosk
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/2975c0539d8c2781ff56a9f8be8e302d45b7d80b

closes odoo/odoo#96230

X-original-commit: 82f2966ed5b3afd30ac5b18c32af7993746fc681
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-07-18 19:56:00 +02:00
Géry Debongnie 8313a66a52 [REF] *: remove some kanbanrecord .includes
The kanban view was recently improved to add the support of 'action' and
'type' attributes on the kanban arch.  This commit takes advantage of
that change to simplify a few views in various addons.

Part-of: odoo/odoo#92071
2022-05-25 20:31:41 +02:00
Yannick Tivisse 72682c22d8 [FIX] hr_attendance: Use orm cached method to improve perf
closes odoo/odoo#85557

X-original-commit: 2975c0539d8c2781ff56a9f8be8e302d45b7d80b
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-03-01 10:53:48 +00:00
Yannick Tivisse f448b3314e [IMP] all: Improve res.config perf on method execute
Purpose
=======

Several actions are done even if nothing has changed on the configuration.

Example:
Writing on a cron the same value makes a dummy write-lock on the table
...

Part-of: odoo/odoo#82999
2022-02-08 14:53:36 +00:00
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