Commit Graph
3839 Commits
Author SHA1 Message Date
rupa-odoo a1949ca541 [IMP] hr_holidays: improve reports ux
Before this commit if we go to the Time off and go to reporting in that select
the to employee  there are graph , calendar, pivot views and there are two
default filter active employee , Employee > Type .

And After that when we go to  to type there are list, pivot view  and by default
there are 4 filter to the list view of the to type and in list view there is
button.

Improvements :

To Employee :
Add the List view and make it default.
And make Current year by  default.

To Type :
Add the graph view and make it default.
Made changes in the filter add Time off, Allocations in that filter.
Remove that button and use action method to the record.

task-3389174

closes odoo/odoo#127034

Related: odoo/upgrade#4907
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-10-05 11:42:43 +00:00
Jorge Pinna Puissant ef424a9dc2 [REF] *: remove owl from linter's accepted global variables
Before this commit, owl was in the linter's accepted global variables.
This allowed  direct access to owl global object.

For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`

Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:

`import { xml } from "@odoo/owl";`

task-id 3498859

closes odoo/odoo#137517

Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-05 10:21:53 +00:00
Alexandre Kühn b1edee9a84 [REF] mail: simplify discuss model insert code
1. simplify message reaction formatter (personas)

Data was formatted to have "partners" and "guests" entries, both
of which contribute to personas.

To avoid some post-processing of data in JS, it's best to format
data to immediately include type of persona.

2. include "guestAuthor" in "author" data of message

Discuss models in JS group partners and guests into a single model
Persona, to make feature works regardless on whether user is
authenticated or not.

This commit simplifies code by removing data guestAuthor in message
formatted data, and instead author contains author data in all cases,
whether the author is a partner or guest.

3. simplify insert (remove id, redundant with preinsert)

Also rename Follower.isActive to Follower.is_active, for
even simpler Follower.insert()

closes odoo/odoo#137276

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-04 19:40:19 +00:00
Mahamadasif Ansari 3389bbafad [REM] *: 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.

Ref-https://github.com/odoo/odoo/pull/130467

task-3508331

closes odoo/odoo#136920

Related: odoo/enterprise#48065
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-28 16:57:55 +00:00
Yannick Tivisse 9de40b92ee [IMP] hr_holidays: Add hourly frequency on accruals
closes odoo/odoo#133441

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-09-27 14:57:01 +00:00
Yannick Tivisse 60c596fe0a [FIX] hr_holidays: Fix label visibily on accrual levels
Part-of: odoo/odoo#133441
2023-09-27 14:57:01 +00:00
Alexandre Kühn 22ed4ec268 [REF] mail: rename commands in discuss model data
Relational data in server formatter are:
- for one relation: None/false or object
- for many relations: list of objects or list of commands

The commands were:
- 'insert': to add a new item in a relational field
- 'unlink': to remove an item from a relational field
- 'insert-and-unlink': to remove an item from a relational field
- 'clear': to remove all items from relational field

There was a slight nuance between 'unlink' and 'insert-and-unlink'
at some point, but it becomes irrelevant with current code of model.
The name of the commands were hard to grasp what they actually mean
for the many relations.

This commit improves it by renaming 'insert' by 'ADD' and the 2
'unlink' commands by 'DELETE'. This makes it more apparent that
the data in 'ADD' refers to data of record to add in the relation,
while 'DELETE' refers to data of record to delete from the relation.
The 'clear' has been replaced by `False` value instead of a command.

Part-of: odoo/odoo#136308
2023-09-27 13:11:58 +00:00
Rob Coekaerts 6be25e7565 [FIX] hr_holidays: remove repeated import
closes odoo/odoo#119317

Related: odoo/enterprise#40676
Related: odoo/upgrade#5039
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-09-26 09:32:28 +00:00
Rob Coekaerts 6074d86b20 [IMP] hr_holidays: refactor leave duration
The idea of current date_{from,to} computations is as follows:

The user selects the request_date_{from,end} (and optionally
request_hour_{from,to} and these inputs are then processed into a
date_{to,from}, taking into account the type of leave, the work schedule
(resource_calendar) and time zone (since date_{to,from} are saved in UTC
while the request_dates are stored in the user's timezone.

However, in practice this computation is very messy, resulting in
date_{to,from} needing to be specified in all demo data and test cases,
even though it should be derived from the request dates. Various
superfluous or poorly named methods also exist in this flow
(eg _get_start_or_end_from_attendance which really performs a timezone
conversion, the logic of which resource calendar to use is scattered
across the whole model etc).

date_{to,from} are used many times as inputs throughout the code, with
code being present te inverse compute request_date_{from,to} from these
values. However in reality this is not possible to do consistently.

Therefore with this commit, we restore request_date_{from,to} as the
sole possible inputs, with date_{from,to} being derived from them. In
addition, the timezone and resource calendar are consolidated into their
own fields, with a single computation method computing them.

task-3081565

Part-of: odoo/odoo#119317
2023-09-26 09:32:27 +00:00
Rob Coekaerts 7359c6de08 [IMP] hr_holidays: Remove leave splitting
Currently when a global leave is removed or modified in such a way that
the duration of an existing leave increases, the leave is instead split
into multiple leaves with a gap in between such that it no longer
includes the period that was previously covered by the global leave.

However, this splitting is very error-prone and from a user perspective
is not even always the behaviour that is expected, especially because
editing global leaves is a very low-threshold operation during which it
is in no way indicated that existing leaves might be impacted.

Also note that this is very specific edge case, that in normal operation
should almost never occur. It is therefore best to simply use an
approach that has a minimal impact on the codebase complexity and
produces no unexpected results for the end user.

Therefore in this commit, we handle this case in the following way:
  - If a global leave is created or extended in duration, we simply
    recompute the impacted leave durations (as was the case before).
  - If a global leave is shortened in duration or deleted, the durations
    of the affected leaves are also recomputed, but:
    - In the case that existing allocations can cover this increase in
      leave duration, the leave is left 'as is', but the user is
      notified that additional allocation time has been taken.
    - In the case that existing allocations cannot cover this increase,
      the user is again notified, but the leave is additionally reset to
      the 'draft' state (to prevent the allocation from going negative,
      which is impossible).

With this approach, it now up to the user to handle this specific edge
case, while no information is changed or lost, which was possible to
happen with the previous approach.

Part-of: odoo/odoo#119317
2023-09-26 09:32:27 +00:00
Rob Coekaerts 56d8b2a770 [IMP] hr_holidays: add company access rule to hr_leave
Before this commit, a company access rule existed for hr_leave but it
checked the company of the associated leave type, instead of the
company associated with the specific employee (or company in case of a
company leave) the leave applied to. This is especially problematic as
leave type are often reused across companies.

This was partially worked around by forcing the company domain using
employee_company_id on the specific actions that showed overviews of
leaves.

With this commit, this is rectified.

task-3383478

Part-of: odoo/odoo#119317
2023-09-26 09:32:27 +00:00
Thomas Lefebvre (thle) b365ea4e1f [FIX] hr_holidays: manage refused leave in the report
Steps to reproduce:
-------------------
- add an allocation for an employee;
- add a leave with this allocation;
- validate the leave;
- refuse the leave;
- in action menu, click on "Time off Analysis by Employee and Time Off Type".

Issue:
------
The report does not take into account refused allocations and leaves.

Solution:
---------
Add a condition to take a number of days equal to zero
if the allocation or leave is in a refused state.

Handled the case where no record is found for leave
(with `COALESCE` because `value - NULL = NULL`).

opw-3503617

closes odoo/odoo#136217

X-original-commit: 4c73d4a7d5cec388177e2703ac9b0a42de8c12c8
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2023-09-22 04:10:06 +00:00
sofiagvaladze 3b3eb8f4db [IMP] hr_holidays: UX changes to increase usability
In this commit, next to UX changes, we make some changes in order to
increase time off dashboard usability.
In particular, - New Allocation Request - was moved to Time Off Card.
Now user can also ask for specific time off type allocation from
the time-off-card-popover.

Moreover, we fix the following issue:
Previously allocation name was not computed on create. We also fix the
computation of the name, in case time of type is not filled in yet.

With the later change, test_allocation_request test was failing as
first the name field was assigned, then holiday_status_id;
Which caused for the name field to be recomputed and assigned to False.
As the field is required, leave_form.save() was raising an error.

task - 3389144

closes odoo/odoo#132187

Related: odoo/enterprise#47651
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-09-21 16:52:07 +00:00
duongnguyen b69200ac46 [IMP] hr_holiday: archived employees not display in time off
closes odoo/odoo#135581

X-original-commit: ba4d3de6673bcc149a813cc40c4e088d8f0367fc
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-09-15 10:48:30 +00:00
Sébastien Theys 7ea370fce7 [REF] mail, *: tests: refactor contains to further remove jQuery
* = account, base_iban, bus, calendar, crm_livechat, hr, hr_holidays,
    im_livechat, mrp, project, sms, snailmail, test_mail,
    test_mail_full, web, website_livechat, website_slides

Add support in `contains` for most operations that we use in tests.
Remove return value from `contains`.
Move into `web` module.
Remove import/export chains, directly import from correct module.

closes odoo/odoo#134652

Related: odoo/enterprise#47064
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-14 11:22:47 +00:00
Chong Wang (cwg) 13957b6281 [FIX] core: support cr.execute_values
psycopg2.extras.execute_values was introduced in PR #101237
however it pypasses the override logic for cr.execute. As a result
1. --log-sql cannot log these queries
2. assertQueryCount cannot notice these queries
...

This commit create a new api cr.execute_values to support the same SQL feature
without losing the override logic for cr.execute

closes odoo/odoo#131190

Related: odoo/enterprise#47374
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-09-14 11:22:42 +00:00
Thomas Lefebvre (thle) 497e2296c7 [FIX] hr_holidays: create activity if leave has to be validated
Issue:
------
When a leave is created, a notification is only sent
if a "Time Off Officer" is defined (`responsible_ids`).

However, if we choose the approval option with
the value: "By Employee's Approver",
the leave manager must be notified even if
there is no "Time Off Officer".

Solution:
---------
Give the option of creating notifications in all cases where validation
is required for the leave type.

opw-3412841

closes odoo/odoo#135310

X-original-commit: 1428505b0aaf6a1d3cf778bdb6137bea9ec6283e
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2023-09-14 05:38:52 +00:00
Aaron Bohy 93938cfdf3 [IMP] web,*: remove assets_backend_prod_only
This commit reworks a little bit the backend assets to remove a
bundle and thus save a call at webclient startup. The bundle
"assets_backend_prod_only" existed only to allow to add files in
production, but not in the tests (typically, the file that spawns
the webclient).

This commit introduces a new bundle "web.assets_web" that contains
"assets_backend" and the few files that we only want in production.
In the /web page, we now load "assets_web" instead of
"assets_backend" and "assets_backend_prod_only". In the /web/tests
page, we keep loading "assets_backend", which is now directly
included into "web.tests_assets".

For the sake of consistency, this commit also renames the dark
mode bundle "dark_mode_assets_backend" into "assets_web_dark".

closes odoo/odoo#135204

Related: odoo/enterprise#47316
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-09-13 08:20:40 +00:00
FrancoisGe 19fe730b3b [FIX] hr_holidays: delete holiday from calendar view
Reason:
Since the change to RelationalModel, the id is no longer present in the
record data by default.

Steps to reproduce the bug:
1. Create a new leave and save it (and keep it unapproved)
2. Click on your newly created leave, click delete and confirm
> Odoo Client Error
(unlinkRecord is called with an undefined value for recordId)

closes odoo/odoo#134885

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-11 07:59:54 +00:00
Jurgen (jugj) 0b88ea0c4c [FIX] hr_holidays: Fix smart-button display of remaining time off
This PR fixes the display of remaining days that wasn't correctly displayed when an allocation
had no time limit.
task-3414291

closes odoo/odoo#134584

X-original-commit: 5fc84bd71fca69862ef4eb3fbb956a18c951d8d0
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Jurgen Gjini (jugj) <jugj@odoo.com>
2023-09-07 09:00:32 +00:00
Sina Chaichi Maleki (cmsi) a340f1d00b [FIX] hr_holidays: Ensure the name is mandatory in public holidays
The name field was previously optional when adding a new instance
from the tree view, which in the absence of a name, 'false' is indicated
in the calendar view. The field is now set as mandatory.

closes odoo/odoo#134433

Task: #3469914
X-original-commit: 732f27c4398ae661ecfc1afb80e656e7c86d8d55
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-09-06 16:19:52 +00:00
Dossogne Bertrand 5f976e0ef4 [FIX] hr_holidays: fix accrual allocation lastcall
Before this commit, creating a new allocation based on accruals
and setting a start date prior to the creation date would compute
the amount of days that should already have been accrued during that time.
However, the lastcall field is not updated and running the accrual cron
leads to a wrong duration.

How to recreate the issue:
- create an accrual plan
- create an allocation set on that accrual
- set a start date in the past for that allocation
- the duration should be automatically set to a value above 0
- save and validate
- run the accrual cron
- the allocation now has its duration doubled

After this commit, the lastcall should be set to the allocation creation
date. This way, running the cron will correctly keep the value of the amount
of days.

closes odoo/odoo#134251

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-09-06 11:50:57 +00:00
Prakash Prajapati efd5a01417 [FIX] hr, hr_contract, *_: fix the traceback when open the search dialog
*_ = hr_holidays

Step:
  - Install contract app
  - Create user with payroll manger access and None Employees
  - Login with new user and create contract
  - Click on employee field and click on Search More
Issue:
    When the user does not have access to the employee app and the search dialog accesses the
 employee during search more, so the traceback come.

Fix:
    If the user does not have access to the Employee application, public employee will be
  used in the search more dialog.

Why needed string insead of props.string:
   When we pass related modal in option then undefined appears in m2m search dialog instead
   of field label.

task-3366443

closes odoo/odoo#134022

X-original-commit: 635a2435fe742064dcd68290a4fdcd484ba67ba9
Related: odoo/enterprise#46737
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-09-04 17:10:07 +00:00
Mélanie Peyrat (mepe) d4f1fb9f10 [IMP] hr_holidays: a time off (duration >= 1day) is displayed as full day
If the duration time off is greater than or equal to 1 day, then it
should be displayed as a whole day event.
Now it's not a case and can be misleading.

Moreover, this change increases querycount for the following reason:
When we create allday calendar event, on top of usual queries -
"calendar_event"."stop_date" and "calendar_event"."start_date" are read.

Note, start_date and end_date are only set for allday events.

task-3103848

closes odoo/odoo#113865

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-09-04 17:10:02 +00:00
divy-odoo cea1cab535 [FIX] *: resolve the last tour step warnings
When we haven't provided a custom action, the tour step runs the default
action. In the final step of the tour, when there is no `run` or
`isCheck` provided, It shows warnings of 'ignoring action (auto) of last
step' as it can lead to a race condition.

This commit resolves the warnings: `ignoring action (auto) of last step`

task-3429500

closes odoo/odoo#129239

Related: odoo/enterprise#46683
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-09-04 15:02:47 +00:00
rajh-odoo ac0b6d30b4 [IMP] hr_holidays: remove duplicate carry over field from milestone
Before this commit:
carry over field was two times one in radio and another in dropdown

After this commit:
dropdown carry over field is deleted from view

task-3481879

closes odoo/odoo#133327

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-09-01 13:20:54 +00:00
Raphael Collet 132e9f72ed [REF] *: rename onchange2 to onchange
closes odoo/odoo#133049

Related: odoo/enterprise#46240
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-08-31 05:11:44 +00:00
Raphael Collet 109935dbc1 [REM] *: discard old implementation of onchange
Part-of: odoo/odoo#133049
2023-08-31 05:11:44 +00:00
Elisabeth Dickinson bd755e6ac6 [FIX] fleet, hr_*: fix many2one_avatar_user occurrences
*: attendance, expense, holidays

In commit d832fcf, the
`many2one_avatar_user` widget has been added in various places,
sometimes repeating the avatar where it isn't needed.

Some occurrences come next to the avatar's name which is called via a
`t-esc`, but the option `display_avatar_name` is available and has been
used instead.

task-3470340
part of task-3326263

closes odoo/odoo#133150

X-original-commit: 0b268a9e3c31d5b57bb9f60ea93153289d02ddf9
Related: odoo/enterprise#46286
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-08-30 09:25:10 +00:00
dasz cf33b80aca [IMP] hr_holiday: accrual refactoring.
Refactoring of the accrual computation methods and views. There are also
2 new features: custom carry-over date and allocation time:

Custom carry-over date:
Previously, an accrual plan was always evaluated on the 1st of january
to decide if days were lost or postponed to next year. Now the user can
choose any recurring date in the year for that evaluation

Allocation time:
Previously the days were given at the end of the accrual period, meaning
an employee had to work the whole period to get his days. Now there is a
choice between accruing at the start or at the end of a given period.

Simulation:
On an allocation of type accrual, changing date_from or
accrual_plan launches the calculation of the days to allocate. This lets
the user know how many days the allocation would give to an employee and
lets him eventually change that number. After saving the record the flow
resumes like before. There is no more need to create fake allocations.

Additional tests written and some existing tests have corrected values /
parameters to still test same feature but be correct with the new
functioning.

task 3060724

closes odoo/odoo#112383

Related: odoo/upgrade#4597
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-08-25 10:59:13 +02:00
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