Commit Graph
3809 Commits
Author SHA1 Message Date
Pierre Paridans 777eb76755 [REF] web,hr_holidays,website_slides: remove legacy Popover component
Replace usage of legacy Popover component.

Also, small css cleanup in hr_holidays.

task-3439226

closes odoo/odoo#132604

Related: odoo/enterprise#46062
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-08-22 13:38:24 +02:00
Dang Van Loc b8081bdfff [IMP] hr_holidays: split function get employees
closes odoo/odoo#132445

X-original-commit: 5ea9e895860ec2f97bd86a5090df9f96a5fdfbb5
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-08-21 14:15:19 +02:00
Pierre Pulinckx (pipu) c07181b20b [REF] *: Replace env._t() by _t()
In this commit, all usages of env._t() are replaced by _t().
In templates files, env._t() didn't work because terms used
in attributes where not extracted into the translation files.
Only string are exported from .xml files to translation files.
So, to make it works, we set a variable that is then used
in attributes.
For example :

<t t-set="string_to_translate">String to translate</t>
<Dialog title="string_to_translate>...</Dialog>

task-3292454

closes odoo/odoo#131390

Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-18 19:17:16 +02:00
Gorash 774a3fad0e [REF] base,all: Update modifier syntax: view migration
Apply of the migration script to update all view modifiers.

Part-of: odoo/odoo#104741
2023-08-18 09:49:13 +02:00
Gorash 75a105f46a [REF] base/all: Update modifier syntax: remove 'states' from fields
These changes are made as a result of simplifying attrs and 'states' in
views. However, they should have remained in a separate commit. When
applying the script making the xml changes (used later for the migration
script), the script checked the definition of the python fields in order
to convert the information into a python expression. Therefore, this
commit is not applied when the script is applied to xml changes.

During this attribute deletion pre-existing errors were found. Part of
the code was using the boolean values of 'states' and another part of
the code was not. The behavior could therefore be different (in cases
where readonly on the field had the same value as the ballan in
'states').

Following the deletion of 'states' and without the application of the
view migration, the js tests (tower) were no longer functional. Tests
using the Form view suffered the same effect. There are few tests that
had to be adapted, including two tests in business accounting (updated
by the accounting team). A test for column_invisible did not work. Test
checking if the test system triggers an error if we try to write on an
invisible field. It turns out that Form was testing on the value of
invisible but not taking into account if the column was invisible. The
test system fix is applied separately because there were a lot of tests
that were incorrect.

Part-of: odoo/odoo#104741
2023-08-18 09:49:11 +02:00
Gorash 5419d0ef7a [REF] base,all: Update modifier syntax: clean fields keys
Part-of: odoo/odoo#104741
2023-08-18 09:49:10 +02:00
Gorash cdaa761ced [REF] base: Update modifier syntax (invisible, required, readonly)
Goal:
* Simplified modifiers to only have one way to define modifiers;
* Remove states attributes on python field;
* Use python expression in view `required`, `readonly`, `invisible`;
* More accurate validation of xml views.

This commit change the syntax to python expression. The next commit
will update/convert all xml views.

Before this commit:
* the `required`, `readonly` and `invisible` attributes can only have
values of `True`, `False`, 1, 0 or a python expression to use the
context;
* the `attrs` attribute define a dict. The key of this dict was
`required`, `readonly` and `invisible` and the values are the domain or
a string representing a domain to be evaluate as python expression.
This python expressions was evaluate by the javascript with view fields
and other contextual values as: context, uid, parent, active_id,
active_ids, active_model, allowed_company_ids, current_company_id.
* the `states` attribute in the view was a comma separated list of the
state. This list was combined with the `invisible` attribute;
* the `invisible` attribute on python field is used as default value;
* the `states` attribute on python field was dictionnary with state as
key and list of tuple. This structure was combined with `readonly` view
attribute.
* After combining, the resulting domains of the different attributes
`required`, `readonly` and `invisible` are evaluated with the values of
the fields. The `invisible` attributes is splitted into two use:
`invisible` and `column_invisible`.

After this commit:
* The attributes `required`, `readonly`, `invisible` and
`column_invisible` define python expression. This python expressions
are evaluate by the javascript with view fields and other contextual
values as: context, uid, parent, active_id, active_ids, active_model,
allowed_company_ids, current_company_id.

The domains can contains contextual value and will be evaluate by the
javascript.

```xml
    <field name="field_a" readonly="not context.get('show_a')" attrs="{'readonly': [('field_b', '!=', False), ('field_c', '=', parent.c)]}"/>
    <field name="field_b" states="draft"/>
```
will be replaced by
```xml
    <field name="field_a" readonly="not context.get('show_a') or field_b and field_c == parent.c"/>
    <field name="field_b" invisible="state != 'draft'"/>
```

Some inherited views will be modified differently in order to maintain
the previous behavior:

```xml
    <field name="field_a" readonly="not context.get('show_a')" attrs="{'invisible': [('field_b', '!=', False)]}">
```
```xml
    <field name="field_a" position="attributes">
        <attribute name="attrs">{'readonly': [('field_c', '=', False)], 'invisible': [('field_d', '!=', '3')]}<attribute>
    </field>
```
will be replaced by
```xml
    <field name="field_a" readonly="not context.get('show_a')" invisible="field_b">
```
```xml
    <field name="field_a" position="attributes">
        <attribute name="readonly" add="(not field_c)" separator=" or "/>
        <attribute name="invisible">field_d != 3<attribute>
    </field>
```

Validation:
A stricter control is made on the level of the attributes (modifiers)
and the fields necessary for these. The use of the previous attributes
'attr' and 'states' triggers an error (these no longer exist after the
application of the migration script)

task-2495504

Part-of: odoo/odoo#104741
2023-08-18 09:49:08 +02:00
Jorge Pinna Puissant e338487028 [REF] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:30 +02:00
Louis Wicket (wil) f1722c7334 [IMP] *: unify sprintf and gettext
Improve gettext to directly handle value injection within translations,
removing the need for sprintf.

closes odoo/odoo#123932

Related: odoo/enterprise#45370
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-10 18:14:04 +02:00
Pierre Pulinckx (pipu) b1ebe3b6f4 [REF] *: Replace core._t imports
In this commit, _t import from import { _t } from
"@web/legacy/js/services/core" and from
 web/static/src/legacy/js/core/translation.js are replaced by
@web/core/l10n/translation.js.

task-3292454

closes odoo/odoo#130865

Related: odoo/enterprise#45270
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-09 00:13:08 +02:00
hapa-odoo 1b512efdac [IMP] holiday: improve UX holiday timeoff
-Display the state of a time off that you open from the dashboard
-Rename Stress Days into "Mandatory Days"
-My Allocations 
    Remove "Employee" from the Group By
    Replace filter `Current Year` with `Currently Valid`.
-My Time Off
    -Remove Employees from list view and kanban view
-Create an allocation / allocation request form
  - Create an allocation ux : employee side- compute the name of the allocation.
  - Make field `allocation_type` invisible if there is no active accrual plan in the database.
-Accruals
  -Add an "archive" in the action menu of the accrual plan.
  -Show Employee button in the form view of the Accrual Plan. 
-Renamed stress day into the mandatory days.
-Renamed string of the menu Approval into the Management.
-Remove two legends in the time-off Dashboard
  - Public Holiday
  - Mandatory Day

task-3084232

closes odoo/odoo#116472

Related: odoo/enterprise#40576
Related: odoo/upgrade#4472
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-08-08 21:09:51 +02:00
Thomas Lefebvre (thle) ef47fd0d7d [FIX] hr_holidays: calculate the number of days left for the report
Steps to reproduce:
-------------------
- create a time off type;
- create two 5 days allocations for an employee;
- validate them;
- create a leave of 8 days for the same employee;
- be in debug mode;
- go to employee form view;
- in action menu, click on "Time off Analysis by Employee and Time Off Type".

Issue:
------
The number of days remaining ("left") for the employee and leave type is -6 instead of 2.

Cause:
------
The query that generates the report is in two parts

```
Find the number of remaining leaves by subtracting leave taken from allocations
(model: hr_leave_allocation and hr_leave) ==> will generate the "left" column

UNION ALL

Find the number of leaves already taken
(model: hr_leave) ==> will generate the "taken" and "planned" columns
```

In the part that generates the "left" column, we relate leaves to allocations.
As there is no "unique" link between allocations and leaves,
we can only link them via employee and type.

We are therefore obliged to use aggregation methods.

The measure that returns negative numbers is:
```sql
CASE
    WHEN request.number_of_days > 0 THEN allocation.number_of_days - request.number_of_days
    ELSE allocation.number_of_days
END as number_of_days
```

It should be read as follows:
If there are validated or planned leaves, the number of days remaining
for an allocation is the number of days of this allocation minus
the SUM of the days of leaves (validated or planned) for this allocations
(same employee and type).

For example:
2 allocations of 5 days and a leave of 8 days,
we will have (5 - 8) + (5 - 8) = (-3) + (-3) = -6 days remaining ==> this is wrong
In this example, we want: (5 + 5) - 8 = 2 days remaining

Solution:
---------
As it is not possible to link a leave to a specific allocation,
we have to make difference between sums like this:

days left = [SUM(days of allocations) - SUM(days of leaves)]_(for one employee AND one type)

The frontend will sum these days left.
This difference must therefore be calculated only once.
By default, we use allocation with the smallest id.

The result is:
days left frontend = [day left_(for min id) + 0 * (nbr allocation - 1)]_(for one employee AND one type)

opw-3366530

closes odoo/odoo#130781

X-original-commit: a273148cf931f220cc4252c638ae14890f889c9e
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2023-08-04 06:56:33 +02:00
Aaron Bohy 1daa3d0b27 [REF] hr_holidays: convert float_without_trailing_zeros to owl
This field has been introduced as a fix in 15.0 [1] where views
were still legacy, and it hasn't been adapted in the forwardport.
So this commit converts it to owl as the support for legacy fields
is about to be dropped.

Part of task~3439226

[1] odoo/odoo#112520

Part-of: odoo/odoo#130462
2023-08-03 09:23:20 +02:00
Michael (mcm) 9d6b380a24 [REF] *: adapt patches after new patch function
In the commit [1], the patch has been refactored to support the
native keyword `super`. The current commit just adapts the codebase
to that change.

task 3410198

[1]: 19ea1ac08043e22a811630968e44715cc3bfc495

Part-of: odoo/odoo#125716
2023-08-02 17:29:05 +02:00
FrancoisGe 02c8a53bdc [FIX] hr_holidays: use record.resId
Since the relational model was rewritten (PR 114024), the record id
is no longer present in data. We must replace record.data.id with record.resId.

closes odoo/odoo#130466

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-02 16:00:28 +02:00
Sébastien Theys f9aedceb9f [REF] mail, im_livechat, *: move code and remove patches from sidebar
* = hr_holidays

Part of task-3265211

closes odoo/odoo#130003

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-01 22:30:47 +02:00
Aaron Bohy 9d81cff6fd [REF] *: remove always_reload many2one option from archs
This option is no longer necessary since [1] as the value is now
reloaded by default.

[1] odoo/odoo#114024
Part of task~3179751

closes odoo/odoo#130169

Related: odoo/enterprise#44838
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-08-01 09:40:55 +02:00
Bastien PIERRE 65242e31e9 [IMP] *: Remove alias in JS files
Rename all imports with alias old system to the new js module system
Task ID: 3266759

closes odoo/odoo#127414

Related: odoo/design-themes#671
Related: odoo/enterprise#43716
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-07-27 11:58:34 +02:00
Julien Carion (juca) 3af4bffeee [IMP] web, mail, hr: Avatar card preview
This commit adds the possibility to see additional information about a
user with a card that appears when hovering avatar user fields for a
set amount of time. This card contains the following information:
- Avatar
- Chat status
- Name
- Email
- Button to send message
and with HR installed:
- View profile Button
- Job position
- Department
- Phone number
- Advanced chat status (when hr_holidays is installed)

Task-3167110

closes odoo/odoo#121943

Related: odoo/enterprise#44563
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-26 19:18:49 +02:00
Rob Coekaerts ddda8c9408 [IMP] hr_holidays: do not refuse leave allocation if already used
Before this commit it was possible to refuse a leave allocation even if
the employee already took leaves using time from this allocation. If
this allocation is then refused, you get a negative balance for the
allocated days, which should not be possible.

With this commit, we raise a UserError when trying to refuse such an
allocation, stating that the user should handle the problematic leaves
first.

task-3330749

closes odoo/odoo#121778

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-07-26 12:00:19 +02:00
Thomas Lefebvre (thle) 24f377b0ee [FIX] hr_holidays: remove time off type if no employee_id
Steps to reproduce:
-------------------
- go to the hr leave form;
- select "By Employee" mode;
- select an employee-based leave type;
(example: Paid Time Off (20 remaining out of 20 days))
- change mode with "By Company";

Issue:
------
A specific leave to one employee can be validated
for all employees of a company.

Cause:
------
The `_compute_from_employee_id` method does not set
the `holiday_status_id` field to `False` in this case.

Solution:
---------
When we detect an `employee_id` change and it is `False`,
we must remove the current `holiday_status_id`.

opw-3386332

closes odoo/odoo#129653

X-original-commit: a7a8e78103962844d7d3752d41f9ca4b22165569
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2023-07-26 08:08:05 +02: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
Louis Wicket (wil) 7da30c7d14 [FIX] mail, *: fix grammar error in field help
This commit fixes a really old grammar error in the help message of the
message_needaction_counter field.

Before this commit: “Number of messages which requires an action”
After: “Number of messages requiring action”

The subject of “require” is “messages”, which is third-person plural, so
it can't take the -s suffix.

closes odoo/odoo#129468

X-original-commit: 0d10cfeaa56d5df23df05f436d353978043f4a71
Related: odoo/enterprise#44509
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-07-25 17:36:08 +02:00
218ad8456a [REF] *: adapt codebase to new RelationalModel
This commit adapts the code in addons w.r.t. the introduction of
the RelationalModel.

Main changes that were requested are:
 - record datapoints no longer always have an "id" key in their
 data (they still do if the id field is in the view), so we use
 record.resId instead
 - the new model is based on fined-grained reactivity, so several
 components that previously relied on onWillUpdateProps to update
 their internal state no longer worked. Typically, using the hook
 "observeRecord" is the way to go now.
 - specialdata are no longer handled in the model, so the components
 needing specialData can use the hook "useSpecialData"
 - more generally, all overrides of models (RelationalModel or
 KanbanModel) needed to be reworked.

Part of task~3179751

Part-of: odoo/odoo#114024
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: FrancoisGe <fge@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: Pierre Rousseau <pro@odoo.com>
2023-07-24 20:17:50 +02:00
Dawn Hwang 7fca358b7f [FIX] hr_holidays: Fix domain in _get_number_of_days
The domain was forced to fix multi-company rules, but now is missing
domain checking whether the resource.calendar.leave is of "leave" type.
This is set if the domain is None but since the domain is overridden, it
needs to be set explicitly

closes odoo/odoo#128993

X-original-commit: 4e91aed5c31114064514f5a9e9c0ab0332580208
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-07-20 10:07:05 +02:00
Julien Carion (juca) 6c412be2ea [IMP] *: coherent hotkey uses
This commit makes hotkey uses more coherent throughout the entire
codebase by setting alt+q as main shortcurt for confirm and default
actions and alt+x for cancel actions.

task-3370463

closes odoo/odoo#127469

Related: odoo/enterprise#43694
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-19 18:24:15 +02:00
Pierre Pulinckx (pipu) 8bfa76a842 [REF] *: Unify _t and _lt
The goal of this commit is to prepare ground to remove
lazytranslate function _lt() and keep only _t()
for a better understanding of the use of the translation function.

In this commit,

the translate function _t() has been updated to return the translation
if they are loaded. If not, it throws an error.
the lazytranslate function _lt() returns _t() function.
Corollaries :
Steps in test tours are now a function that returns an array of steps
to avoid any interpolation of _t in this ones before translations has
been loaded.

Example :

registry.category("web_tour.tours").add("example", {
    test: true,
    steps: () => [
        {...},
        {...},
    ],
});

task-3292454

closes odoo/odoo#124157

Related: odoo/enterprise#43153
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-07-19 13:13:16 +02:00
Jurgen (jugj) dc344613a1 [FIX] hr_holidays: Fix new time off wizard display
task-3424159

closes odoo/odoo#128504

X-original-commit: f6f6437acc923e81166d9eb786ec03bb76c5a98e
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-07-15 12:00:17 +02:00
Rob Coekaerts 2de114a37f [FIX] hr_holidays: make holiday tests (demo) data independent
Before this commit, the hr_holiday tests used base_company to setup the
tests. This resulted in the tests interacting with the demo data that
were linked to this company, eg stress days.

With this commit, the tests are now independent of this data, and will
therefore not be affected by any changes it.

closes odoo/odoo#127415

Related: odoo/enterprise#43717
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-07-12 16:52:49 +02:00
Yannick Tivisse e8c48f824e [IMP] hr: Remove address_home_id field
Improve usability of employee form. It is confusing for end users
to create another record to encode the employee address.

Move all the private information on the hr.employee record itself.

Remove the M2O address_home_id.

TaskID: 3101400
2023-07-05 14:21:28 +02:00
Louis Wicket (wil) ce07b37111 [IMP] mail: make channel_info private
Make `channel_info` private so that it is no longer exposed to RPCs.

closes odoo/odoo#127078

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-07-04 00:51:54 +02:00
Thomas Lefebvre (thle) bfbf92d4f5 [FIX] hr_holidays: correct iso format sent to the frontend
Steps to reproduce:
-------------------
- go to Time Off / Configuration / Public Holidays;
- create a public holiday (for one day):
	start = 00:00:00
	end = 23:59:59
- go to Time Off dashboard.

Issue:
------
The description of this public holiday is not correct.
The display shows that the public holiday is two days instead of one.

Cause:
------
When recording a public holiday, dates are saved in UTC.
Depending on the offset (UTC offset), this can change the day.

When we send the date in iso format to the frontend,
we modify the hours, but not the day.

Solution:
---------
Apply the employee's timezone to the datetime object
before sending it to the frontend.

Note:
-----
The correction is on the server side,
as we use the `combine` method of the datetime object
before sending the result to the frontend.
Indeed, we modify the times and lose the information
needed to apply the timezone afterwards.

opw-3381894

closes odoo/odoo#126983

X-original-commit: 1268502b813d9b9173edb3851faef965df6be6fe
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2023-06-30 20:13:40 +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
Wolfgang Taferner 6a8562f3d1 [FIX] hr_*: unusual days + public holidays independent of employee
In case we use multi company and a user does not have an employee
in every company which is quite normal (mostly you are employed with
exactly one company), the calendar is skipping the provision of the
unusual days like public holidays or the working schedule.

To be able to access and see the calendar in such a case we fallback
to the company calendar and fixed a domain for the public holiday
retrieval whereas the public holidays are not assigned to an employee
but the company or the companies chosen to be displayed.

closes odoo/odoo#126420

X-original-commit: d80a3965b7356f9d6b1294cf428667a1057a272b
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-26 22:15:34 +02:00
Kevin Baptiste 29ad9e881e [REM] hr,hr_holidays: remove deprecated code
Remove deprecated code from odoo/odoo#96545

closes odoo/odoo#125894

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-21 19:04:14 +02:00
Dossogne Bertrand d9b1b470b8 [IMP] hr_holidays: improve stress days display
Before this commit stress days were displayed as colored rectangles
on the calendar which made it ambiguous compared to leaves.
After this commit the stress day have the number colored and in bold
instead and the signification has been added to the legend on the side.
Moreover, clicking the event displays a popover giving a short
description of the stress day instead of opening a time off creation
modal.
This commit also adds `web/static/src/views/calendar/util.js` which
exports a method generating a datespan expression given two dates.

task-3226525

closes odoo/odoo#125749

X-original-commit: eb2b6068a998812890c8d37330c986fd3fc30d4f
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-20 20:32:48 +02:00
Jurgen (jugj) d7ec92f349 [FIX] hr_holidays : Remove automatic notification if no responsible_ids is set
Currently in hr_leaves_type, if no responsible_ids are set, all members of group_hr_holidays_user would get notified, the new behavior changes that to :
If no responsible_ids are set, no one is notified.
Some unit tests had to be adapted to this new flow, since they were sometimes getting created with no responsible_id assigned, leading to no one being notified.
task-3284318

closes odoo/odoo#125738

X-original-commit: fb1a6a8f0072398c57508b59724fcbde9a34b124
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-20 15:58:38 +02:00
Samuel Degueldre 81be42d8f9 [FIX] *: ensure tour tips are correctly translated
*: account, crm, crm_iap_mine, event, hr_expense, hr_holidays,
hr_recruitment, lunch, mail, mass_mailing, point_of_sale, project,
purchase, purchase_stock, sale, survey, web, website, website_blog,
website_event, website_forum, website_sale, website_slides,
test_main_flows

In odoo/odoo#111103 the tour system was rewritten. The previous tour
system used to depend on the `root.widget` js module, and this module
was an async module that indirectly depended on `session_bind` which
would load the translations, meaning that the js module definition code
of the tours would only run after the translations were loaded. This is
no longer the case with the new tour system, this means that the module
definition code is executed as soon as the dependencies of that module
are fulfilled, which is generally befoe the translations are loaded,
causing most tour tips to not be translated.

This commit adds a hacky workaround for this problem: it creates a new
module that has a default export which is a promise, and has a legacy
alias, this creates an async module that waits for the translations to
be loaded. This module is then imported for its side-effect in all
onboarding tours, causing them to be translated correctly once again.

This commit also needs to convert the steps key in the tours internal
registry to a getter. In previous versions, the steps were directly
added as is to the internal state of the tour service, but since
odoo/odoo#122834 the steps are now mapped, and without a getter, any
edits to the steps occurring after registration will not be taken into
account. This causes issues in some modules that change original
behaviour of other modules (eg accounting makes invoices into a menu in
the accounting app instead of a top-level app in the home menu) as they
need to edit the steps of existing tours to make them work.

In a separate PR, we will implement a more proper fix by changing the
API of the tour manager so that we no longer need this workaround.

closes odoo/odoo#125284

X-original-commit: d130699ba82dc9919c9116f4b64a5e461ebb6319
Related: odoo/enterprise#42655
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-06-19 13:35:28 +02:00
Kevin Baptiste c435c2ee6f [FIX] hr_holidays: fix test failing on weekends
The test would fail when running on a weekend, as the employee would be
considered not working.

Runbot error-21971.

closes odoo/odoo#125097

X-original-commit: c6d95961fa8d6bce2f7c290d2d45eb2195950d74
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-15 09:05:10 +02:00
Tom De Caluwé 34f1bc96a2 [FIX] hr_holidays: ignore unconfirmed leaves in current leave status
As of this commit, only confirmed leaves will be considered when computing the
current leave or absence of an employee. Additionally, a bug in the is_absent
search implementation was fixed: before this commit, the same results were
returned for absent and non-absent searches.

opw-2877328

closes odoo/odoo#124968

X-original-commit: 28ccbbab07a0c25570ca9b940428b8e541d262d7
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-14 13:10:49 +02:00
Dossogne Bertrand dc37979e7b [IMP] hr_holidays: display correct calendar attendances
Before this commit, the attendance and non-working days were
always based to the current calendar of the user's employee.
This is not accurate since we can see other's calendars and
contract changes can lead to calendar changes (from full-time to
part-time,...).
This commit base that view on the viewed employee contracts so that
even a contract change is correctly viewed.

task-3060722

closes odoo/odoo#121153

Related: odoo/enterprise#42125
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-12 10:02:15 +02:00
Chrysanthe (chgo) 7aab866654 [FIX] hr_holidays: display option layout
=== ISSUE ===

If you navigate to Time Off > Configuration > Time Off Types and open a
type, the layout of the display option is not consistent.

The option should be displayed under the title and not next to it.

=== AFTER ===

We remove the empty `group` tag and add the `string` attribute to the
second one, in order to fix he layout.

task-3332666
part of task-3326263

closes odoo/odoo#124403

X-original-commit: cdd41cef07cb82b37e7c09b8f4a622ac7dde81a3
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-09 10:55:05 +02:00
dasz 4a711f24a0 [FIX] hr_holidays: accrual plan in hours, leave and accrue again
An accrual plan configured to give hours will give to many hours after reaching the maximum for the level,
creating a leave and then accruing again, it will consider the maximum of time to add as days instead of hours,
so if the limit is 80 hours, then 8 are spent on 1 day of free time, the next time the plan accrues,
it will consider that the maximum it can give is 8 days instead of 8 hours.

task 3354892

closes odoo/odoo#124293

X-original-commit: 45f23d28a2136e87f1e55040371aff0ed8c4e305
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-09 09:34:59 +02:00
Sébastien Theys 9dba4e0d77 [REF] mail, *: reorganize JS files
Remove "fake" feature sub-folders that make files harder to find.

Note: If there are too many files in the main folder now, a new split
that actually makes sense can be done at a later time: this would not
just be code move, but removing coupling between said feature and the
rest of the code.

Apply consistent structure, where the top level folder is a feature (or
core), and sub-folders are subdivision of the feature depending on
context (closely related to assets bundles).

```
- core
    - common
    - public
    - web
- feature
    - common
    - public
    - web
```

The opportunity is taken to reorganize the top of the files and imports:
- Always use absolute path in imports to be able to find all usages of a
  file with a single search.
- Reorganize imports to group them by module, and to sort them
  alphabetically by path/feature.
- Always use single asterisk (*) for `odoo-module`: less characters yay!
  And double asterisk should be used for JSDoc comments, not for custom
  instructions.

Part of task-3265211

closes odoo/odoo#124168

Related: odoo/enterprise#42121
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-06-08 21:52:44 +02:00
Julien Mougenot b445c80c7d [FIX] hr_holidays: Fix tour daterange race condition
Before this commit, the `hr_holidays_tour` tour failed randomly because
a many2one was set just before a daterange, without any kind of safety
check to ensure that all values are input sequentially.

When an update occurs on a record in a form view, a daterange will force
its inputs to be set to the record values. This is done to keep track of
onchanges and to ensure that the field is displaying the proper values.

The issue arises when the tour inputs the daterange values JUST BEFORE
the many2one value is actually committed and updates the daterange
field, in which case the tour values are lost before the daterange could
send an update to the record.

This fix adds proper safety checks in that tour to properly await for
the many2one value to be set before setting the daterange values.

closes odoo/odoo#123852

X-original-commit: 4abb28fb29a9bda6727fb3d04d5b0a017b99e123
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-06-07 12:02:03 +02:00
Alexandre Kühn f85a4366b0 [FIX] mail: away im status should be yellow in discuss sidebar
Follow-up of https://github.com/odoo/odoo/pull/123143

This is the same fix applied to discus sidebar, which used another
component that had the exact same issue.

This omission comes from code duplication as a consequence of
added technical debt during a recent refactoring of Discuss code.

We will avoid making this mistake again in master, by cleaning and
properly sharing code for all showing of im status in Discuss.

closes odoo/odoo#123526

X-original-commit: 576e3caa50f6e23525b49fc3790ab29647903ed1
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-06-05 14:49:57 +02:00
Elisabeth Dickinson c84d388fac [FIX] *: switch image's .rounded-circle to `.rounded
*: gamification, hr, hr_contract, hr_expense, hr_holidays, hr_org_chart,
lunch, mail, web

Since the Milk refactoring, the backend uses only `.rounded` avatar
images. The `.rounded-circle` classes on images have been replaced by
`.rounded`.

task-3336569
part of task-3326263

closes odoo/odoo#123286

X-original-commit: b492049788353274fb32bb6fbe4d40e97a184a87
Related: odoo/enterprise#41798
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-06-01 17:55:25 +02:00
Alexandre Kühn 41a414de1b [FIX] mail: im status away should be yellow
Before this commit, im status icon for "away" was brown
in white mode.

This comes from MILK redesign change changes the color of
`text-warning`, from yellow to brown in white mode.

This commit fixes the issue by explicitly using yellow color,
regardless of theme. Dark mode kept the yellow color, so this
is unchanged.

closes odoo/odoo#123188

X-original-commit: d500608c01370ffb712ea45ce3f6b58e706ed760
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-06-01 11:44:10 +02:00
Martin Trigaux 2afdda2576 [I18N] *: export saas-16.3 source terms
closes odoo/odoo#123046

X-original-commit: 137f5ca0cb703ee953cb01db525362f7a778e6bd
Related: odoo/enterprise#41703
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-06-01 11:43:51 +02:00