Commit Graph
160669 Commits
Author SHA1 Message Date
Mohit Beniwal aeb199d77f [FIX] web: prevent missing 'data' argument error while uploading empty file
DataURL returns 'data:' in Chrome for empty files which is not valid dataURLas
it expects 'data:<mimetype>;base64' . This DataURL method is used to obtain
base64 representation of the file data,. That's why the 'data' argument is
missing and error is being generated.

Steps to reproduce:
1) Open Notes and create a new Note in Chrome.
2) Add a new attachment using /image command.
3) Add an empty file.

By applying this,it will return proper format for empty file.

sentry - 3749971166

closes odoo/odoo#120060

X-original-commit: fd6b904a97e7dab6e720675d9c805ed45eacef1e
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-04-28 13:33:25 +02:00
Achraf (abz) b303b20e7d [FIX] base_import: prevent traceback of Unsupported file format text/csv
When we try to import bank statement CSV file with all required columns and
set the encoding format as koir8_r we get (ValueError: Unsupported file format
text/csv, import only supports CSV, ODS, XLS and XLSX) this error.

steps to reproduce:
    1. Go to accounting and then import bank statement.
    2. Select a csv file to import with all required columns.
    3. Set Encoding format as koir8_r and then click on 'TEST' or 'IMPORT'.
    4. The error will occur.

see this traceback: https://tinyurl.com/24bxk7bt

Applying this commit will fix this issue.

sentry-4049996747

closes odoo/odoo#120054

X-original-commit: 7270bbf589a9d3d794e399b3cf3ad18acf7a2ed6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 13:33:22 +02:00
Antoine (ande) faefae9e47 [FIX] point_of_sale: loyalty feature no name
Current behaviour:
In point of sale settings, in the Pricing section,
the loyalty feature has no name, only a description.

Steps to reproduce:
1. Head to the settings
2. Navigate to Point of Sale
3. Scroll to the Pricing section
4. One of the feature has no name
5. Only a description: "Manage promotion that will ..."

Cause of the issue:
In the field component, the nolabel attribute was set on 1,
which made sense in 16.0 before the standardization of the settings.

opw-3284475

closes odoo/odoo#120046

X-original-commit: 0331151231b5b86ca852c713a0401b98ce982606
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Demany Antoine (ande) <ande@odoo.com>
2023-04-28 13:33:20 +02:00
Alexandre Kühn e155eda05c [FIX] mail: no crash when mentioning partner after channel mention
Steps to reproduce:
- Open channel general
- type "#" in composer so it prompts "#general"
- delete "#"
- type "@" in composer

This happens because the partner suggestion part relies on raw server
data in model thread, `thread.channel`, which is erased from the
channel suggestion. This was used to detect whether partner is member
or not, in `thread.channel.channelMembers`.

This commit fixes the issue by making partner suggestion relies on
more reliable data in models, `thread.channelMembers`.
`thread.channel` is deprecated, and will eventually be removed.

closes odoo/odoo#119935

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-28 13:33:17 +02:00
Samuel Degueldre d11bf24dea [REF] pos*, web: make pos service start asynchronously
*: point_of_sale, pos_hr, pos_restaurant

Previously, the pos service started synchronously, but doing anything
meaningful with it needed to be done after it was "ready", meaning it
had loaded and processed the data. The reason for this is that we need
to start the services before we mount the chrome, but in the pos we want
to show the loader immediately while the data is loading. This means
that any service that depends on the pos service in a meaningful manner
has to be written in a convoluted way, where it starts as a dummy
service and then overwrites itself in the env when it's actually ready.

This commit allows to write services that depend on the pos service more
naturally, by making the pos service properly asynchronous, meaning its
dependents will only be loaded once it's actually ready. To work around
the loader issue, the loader is mounted as a separate owl appplication
with not services, this application is shown over the chrome and when
the chrome mounts, it hides the loader and destroys the loader
application after the fade-out transition.

closes odoo/odoo#119908

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-04-28 13:33:15 +02:00
Valentin Chevalier f18bdad78a [FIX] payment_stripe: add email for shipping partner
Before this commit, the shipping partner was created without an email
address.

After this commit, the shipping partner will be created with the email
given by the customer on the express checkout form.

closes odoo/odoo#120037

X-original-commit: 527b498811d3e3f83ca64bf58f5c0a882432bf87
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-04-28 12:26:46 +02:00
Sébastien Theys 09ac15e2dd [REF] mail: clean code for message update
As a bonus, add cross-tab update for current user in chatter.

Part of task-3265211

closes odoo/odoo#120018

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-28 12:26:43 +02:00
Nasreddin Boulif (bon) df187c4cc2 [FIX] google_calendar: sync the right description
Steps to reproduce:

  - Install 'CRM' module (for test purpose)
  - Configure the google calendar credentials on Odoo
  - Go to CRM -> Configuration -> Activity Types and create a new one
  - Set 'Meeting' as Action
  - As default note, add some bullet points:
    ```
    Hello :
      - First point
      - Second point
      - Third point
    ```
  - Open any Opportunity and create a new Activity (in the chatter)
  - Select 'Meeting' as activity type and open the calendar
  - Add a new event (description should be field with the default note)
  - Open the event (on Odoo and/or Google Calendar)

Issue:

  The description of the event is broken (bullet points missing).

Cause:

  When syncing the event from Odoo to Google Calendar, the description
  is converted to plain text (using `html2plaintext` function).
  Then, when syncing the event from Google Calendar to Odoo,
  the description is also updated locally with the remote one.

Solution:

  Don't convert the description to plain text but use
  `tools.html_sanitize` on the html content instead to sanitize it.

opw-3105194

closes odoo/odoo#119695

X-original-commit: 21f3f9aa31a44840077b80d27aaee8160b391308
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2023-04-28 11:18:26 +02:00
Demesmaeker 4c701ab1fc [FIX] product: only activate pricelists when enabling pricelists
Following 83c52575d0 we activated or created pricelists as soon as a
currency was activated/created/deleted, for every company that might already have another
pricelist setup done, which was quite confusing.

With this fix, we ensure this will only happen:
- at company creation
- when enabling the pricelist feature
- when enabling the multi-currency setting (only the first time, unless the pricelists were
disabled manually afterward)

closes odoo/odoo#120039

X-original-commit: 4c0146d939e40e9433794802388cf06147e716f2
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-04-28 09:53:12 +02:00
Damien Bouvy 4dbab115e2 [FIX] web: less 'in your face' kanban assignation icon
The "quick assign" feature introduced in 66321f7 can be a bit too
visible and distracting - it is after all a shortcut and should probably
not add a primary-colored button on all kanban cards it's used on.

This revision makes the quick assign shortcut only appear on a card
if it's hovered (always visible on mobile though).

ask-3292053

closes odoo/odoo#120035

X-original-commit: 198a498c83e37197a963bdb18a608834808cd096
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2023-04-28 09:53:09 +02:00
Guillaume (gdi) b4ba82dc20 [FIX] web_editor: correct the custom block HTML
Since [this other commit], custom blocks are not displayed correctly in
the editor. The DIV tag is not supposed to be self-closing. However,
older versions of JQuery supported it anyway (they turned `<div/>` into
`<div></div>`) Since the update of JQuery to version 3.6.3, self-closing
DIVs are no longer correctly supported by JQuery.

For example, if you type this in the Chrome console:
```
$(`<div id="divRoot">
    <div id="selfClosing"/>
    <div id="notSelfClosing"></div>
</div>`)[0]
```
JQuery will create the following structure:
```
<div id="divRoot">
    <div id="selfClosing">
        <div id="notSelfClosing"></div>
    </div>
</div>
```
JQuery doesn't parse the HTML correctly and returns a wrong structure
(the `#notSelfClosing` is moved inside the `#selfClosing`).

Note that doing `$('<div/>')[0]` will return a correctly parsed DIV.

This commit corrects the layout structure of custom blocks so that they
are not composed of self-closing DIV.

Steps to reproduce the issue:
- Edit a website page
- Drop a block
- Click on the save icon
- Click on "Save and reload"

=> The custom block is not displayed correctly.

[this other commit]: https://github.com/odoo/odoo/commit/ae1cd3d5bb99b9835501144522b71f152aaf8e34

task-3290172

closes odoo/odoo#120027

X-original-commit: fd76d59bcd08e824c4e46814d0754a225f7a1b72
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Guillaume-gdi <gdi@odoo.com>
2023-04-28 09:53:06 +02:00
Adrien Guilliams (adgu) a38dfaa605 [FIX] point_of_sale: reduce orders to sync in cross-orders
With the cross-orders feature, whenever the PoS have to sync with
the server, it send to the servers the orders that have changed
since the last sync. The problem is that we added to this set all
the orders that we loaded from the server even if they didn't change
between the two sync. We fix this here.

closes odoo/odoo#119929

X-original-commit: 4ba8699b95325480c9ebfc0ca3c8a2433b15b87a
Signed-off-by: Monnom David (moda) <moda@odoo.com>
2023-04-28 09:52:54 +02:00
Rodolpho Lima 0026c8659c [FIX] mass_mailing: add missing tour for new mailing from campaign
This commit adds a basic tour for creating a mailing from a campaign's
"Mailing" tab, via the list view of the `mailing_mail_ids` one2Many field.

closes odoo/odoo#119918

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-04-28 09:52:52 +02:00
Rodolpho Lima 40b10b106e [FIX] mass_mailing: allow create mailing from campaign
The campaign's "Mailing" page displays the one2Many `mailing_mail_ids` field
in a list view. When creating a new mailing from this view, a new record is
created with the fields from the comodel(`mailing.mailing`)'s form view, which
does not have the necessary "body_html" field.

This resulted in a traceback when attempting to save changes to the newly
created record, as `MassMailingHtmlField.commitChanges` calls `Record.update`
for such field.

This commit ensures the `body_html` field is present by adding it as a
dependency of MassMailingHtmlField.

Task-3225211
OPW-3204686

Part-of: odoo/odoo#119918
2023-04-28 09:52:51 +02:00
Jeremy Kersten 855da5757f [IMP] base: widget currency, allow to force decimal_places
This commit allow to add in t-options the decimal_places.
It is useful in case all price are without decimal e.g.

closes odoo/odoo#120036

X-original-commit: 800d18f2e9f94c68ebca281c9956abb23e7e33e6
Signed-off-by: Thibault Francois <tfr@odoo.com>
Signed-off-by: Jérémy Kersten <jke@odoo.com>
2023-04-28 08:57:58 +02:00
Pierre Rousseau a449b05221 [FIX] web: allow to disable autosave on boolean toggle
Since https://github.com/odoo/odoo/commit/28e6b7eb83e4309c4e70974d947194bdca240865, the boolean toggle widget
trigger a save when the user clicks on it. This is a problem when the
widget is used in a form view opened from a o2m list, because the
record updated is saved immediately, even if the user clicks on the
discard button.

This commit adds a new option to disable the autosave on the boolean
toggle widget. To disable the autosave, add `autosave: false` in the
options on the field definition.

Task-id 3235962

closes odoo/odoo#120000

X-original-commit: b56e58dff3258698dbbf173bc6790a35a47131b0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 07:54:26 +02:00
Laurent Smet 10c46e2e76 [FIX] web: Add minimal support to x2many for relational_model
Suppose a RelationalModel instanciating a record.
On this record, trigger an onchange adding a new line on a one2many field.
=> The values of the Command.create command is not parsed correctly.

Indeed, if your one2many contains a Date field, its value will be a string and
not a Datetime object as expected.

closes odoo/odoo#119928

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 07:54:23 +02:00
luvi 5e7bc4ab85 [IMP] web: improve SelectMenu usability
This commit aims to make the SelectMenu easier to use with a better
navigation system, and the ability to select a value with the enter
key.

The bottomArea slot no longer adds a div, which could allow to use
DropdownItems in this slot, and navigate fluently from other options.

Those improvements are required by task-3134491, which will replace
a select2 input with the SelectMenu instead.

Tests have been added for the navigation behavior and the selection
with the enter key.

closes odoo/odoo#119934

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 06:56:53 +02:00
william-andre 0767e690f6 [FIX] account: import misc. operation by giving only foreign amount
Import a file with a content like this (specifying the amount in foreign
currency but not the amount in company currency)
```
Journal,Reference,Journal Items/Account,Journal Items/Label,Journal Items/Analytic Distribution,Journal Items/amount in currency,Journal Items/currency
Miscellaneous Operations,EUR March 2023,101000 Current Assets,label,,-29,EUR
,,201000 Current Liabilities,label,,29,EUR
```

The debit/credit were set to 0, but it would have been expected to compute
the amount from the foreign balance instead.

task-3287331

closes odoo/odoo#120022

X-original-commit: 5f2412ac0ebb7e5868fc6c60789914de2c213d3f
Related: odoo/enterprise#40467
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-04-27 20:37:52 +02:00
Ayushi Gorai c51c66805d [FIX] base_import: prevent the list out of range error
When the user uploads a file the length of the list will return 1, but when
it tries to retrieve a file which is not in the list or wants to upload another
file while the process is ongoing it will throw a IndexError.

After this commit, the race condition is satisfied i.e. now the user will not
able to upload the file while the uploading is still going on.

sentry-3938949468

closes odoo/odoo#120012

X-original-commit: 482e0034e1a5882ea1e0bc4ddb56d8ef5f5a1a92
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-04-27 18:25:40 +02:00
Hubert Van de Walle (huvw) 9fa61411c2 [FIX] sale_stock: allow to tab past an empty QtyAtDateWidget
Steps to reproduce
==================

- In the settings, check the "Reception Report" option
- Create a new quotation
- Add a line
- Do not select a product
- Press tab a few times

The focus doesn't go past the Quantity widget

Cause of the issue
==================

The next item to be focused when pressing tab is selecting with the
following selector

https://github.com/odoo/odoo/blob/13745d597d03b552fe5f73ca81143a49efb8aa9f/addons/web/static/src/core/utils/ui.js#L159-L161

Since there is a tabindex of 0, the focus will try to go to the
QtyAtDateWidget

Solution
========

Set the tabindex to -1 when no value has been set

opw-3266063

closes odoo/odoo#120005

X-original-commit: 30fcb2e60fed17a473353b21bac4916e9ab77b10
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-04-27 18:25:37 +02:00
Sébastien Theys 3d1a21dc18 [REF] mail: move channel of message post controller to discuss
Part of task-3265211

closes odoo/odoo#120002

Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-04-27 18:25:33 +02:00
althaf shaik 77f7cc2eb1 [FIX] delivery: price rule name not formatted if no delivery product
This trace back raises when we try to create delivery price rule,
while delivery product is not selected in the delivery carrier.

Steps to produce:
 * Install delivery,sales modules
 * Open Sales/Configuration/Shipping Methods
 * Create a new shipping method keep provider as 'Based on Rules'
 * Try to add a line for pricing
 * At this moment trace back raises ('Expected singleton: res.currency')

We resolve this issue by not formatting the name if the currency does
not exist yet, as the currency is related to the one of the product.

Sentry :- 4067992652

closes odoo/odoo#119958

X-original-commit: d20431758c0c4943394a63250ad0a83894b795c8
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-04-27 18:25:23 +02:00
abd-msyukyu-odoo 1baeea454f [FIX] web_editor: fontawesome subnodes should make a node non-empty
For each node that the `insert` command inserts, the previous node is evaluated
and tested to be a `shrunk` block. If it is, it is considered "invisible" and
removed.

Prior to this commit, an element containing sub-elements with a fontawesome icon
was considered to be `isEmptyBlock==='true'` even though it is supposedly
visible as it contains that icon.

Therefore in cases where multiple nodes are inserted at once, if one of them has
only fa-icon nodes as children, that node would not have been inserted.

Task-3284580

closes odoo/odoo#119931

X-original-commit: 373c3da609582bd170e1c5924a5c2351eb4706ca
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-27 18:25:15 +02:00
Didier (did) 19abfc1f66 [IMP] mail: update link previews when editing a message
Before this PR, link previews where not updated when a user was editing a
message.
This clear the current link previews and reprocess the updated message.

closes odoo/odoo#119917

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-27 18:25:13 +02:00
Marc Durepos e36f1412f5 [CLA] Bemade Inc. signs CCLA
closes odoo/odoo#119981

X-original-commit: 3757f2ab2ded46358d117a7356ebccf0a189aadf
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-04-27 17:21:58 +02:00
Pulinckx Pierre (PIPU) 4177787698 [IMP] base: Add group filter in actions views
THere is now group filter predefined for Actions list
and for Window Actions list.

TaskId : 3255936

closes odoo/odoo#119953

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-27 17:21:56 +02:00
Sébastien Theys c1a3ad8e01 [REF] mail: move channel specific code of reaction to discuss
The opportunity is taken to clean the methods to make the override
actually possible.

Part of task-3265211

closes odoo/odoo#119942

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-27 17:21:53 +02:00
Rahul Reddiar 3182a05859 [IMP] mrp: display backorder wizard and close MO
Before this commit
==================
MO not closed even when flexible consumption is confirmed from the tablet view.
If in some operations less or more commodity is consumed then when we click on
mark as done and close mo, it only generates consumption warning wizard and the
state of MO is still in to_close and not done, since the backorder wizard is not
generated.

After this commit
=================
MO is closed along with consumption warning wizard and backorder wizard. 

TaskID - 3192078

closes odoo/odoo#119491

X-original-commit: 8bd83439e3b5ae547e4fc2e21677ab8e925cb73a
Related: odoo/enterprise#40181
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-04-27 17:21:50 +02:00
Horacio Tellez 8164ac4e22 [FIX] sale: use billing address whenever possible
In the case of transaction linked to sales orders it is
more appropiated to use the invoice partner related to the
sale order than its main partner.
After this fix the invoice partner of sale orders will be
used for transactions linked to it.

opw - 3212748

closes odoo/odoo#119962

X-original-commit: 6eaf11d1ac0d9fc3cd9d458e6ee1f27159216d40
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Horacio Tellez Perez (hote) <hote@odoo.com>
2023-04-27 16:10:47 +02:00
damr 7b306edd0b [FIX] web: fix the arrow key navigation in the kanban view
Before this commit, when the user selects a kanban card with the arrows
key navigation in the project/task kanban view, the focus will be on the
first `button/a` element found in the kanban card and so it could be
something else then the classic global click (when the user clicks on
kanban card).

This commit changes the focus to first select the element containing
`oe_kanban_global_click` to click on. If no 'oe_kanban_global_click' is
found, the focus fall back on the previous priorities.

task-3254564

closes odoo/odoo#119960

X-original-commit: 53a1061724faf9797e1301f93fdd708640313fc5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-27 16:10:44 +02:00
Mahamadasif Ansari cd4fc2e591 [FIX] sale: prevent the zero division error
When converting a quotation to an invoice with a fixed down payment
amount and the total amount of the quotation is zero, a float division by
zero error occurs. This is because the total amount is zero, and it tries
to divide the fixed amount by the total amount.

This commit solves the above issue by dividing a fixed amount
by one when the total amount is zero and added the test case.

sentry-4079147910

closes odoo/odoo#119957

X-original-commit: 41d3bf23770ef1716e9d34e7930adad58a17c7de
Signed-off-by: Ansari Mahamadasif (maan) <maan@odoo.com>
2023-04-27 16:10:39 +02:00
Victor Piryns (pivi) 1979e2671f [FIX] project: remove "I take it" from task following email header
Current behaviour:
On a brand new task with no assignees, when we add an user to follow
the task with an email, there is a link "I take it" that is supposed
to assign the newly following user as the assignee of the task. This
link is dead, returning a 404.

Expected behaviour:
Either correct the link, or remove it from the email header.

Steps to reproduce:
- Install Project
- Create a task, with no assignees
- Add a new follower to the task with Send Email checked.
- Check the outgoing email, and click on the link "I take it".
- 404 response

Reason for the problem:
The route which we were using for this `/mail/assign` doesn't exist
anymore since version 15. This was an intended design change, to
remove noice. The user can click on "See task" and assign himself on
there.

Fix:
Remove the "I take it" link from the email header.

Affected versions:
- 15.0
- saas-15.2
- 16.0
- saas-16.1
- saas-16.2
- master

opw-3276036

closes odoo/odoo#119920

X-original-commit: 2d3134381c23675199bd8e14fafb1804d54339e6
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
2023-04-27 16:10:32 +02:00
Bruno Boi f22961ad07 [FIX] web,*: repair root class attr
*: web + adaptations in base, fleet, hr, hr_expense, hr_recruitment,
   loyalty, lunch, mail, mass_mailing, note, project, stock, survey,
   web_tour

**Foreword**
Since d19037e141 the rootnode class attribute for form/list views was
copied two times:
- on the o_view_controller div
- and on the root node of the view renderer.

Examples:

<form class="foo">...</form>

    gives

<div class="o_view_controller o_form_view foo">
    <div class="o_control_panel">...</div>
    <div class="o_content">
        <div class="foo o_form_editable ...">...</div>
    </div>
</div>

and

<list class="foo">...</list>

    gives

<div class="o_view_controller o_list_view foo">
    <div class="o_control_panel">...</div>
    <div class="o_content">
        <div class="o_list_renderer foo ...">...</div>
    </div>
</div>

**Issue**
This could lead to confusion and also unexpected styling issues.
See this PR #119815 to read a message JS Framework team has received.
See also another a fix that had to be made for x2m fields: 980244fa8

**Introduced Changes**
- in the form compiler, the root node attributes are no more copied to
  the root div node of the compiled template the form renderer receives
- the root div node generated by the form compiler now has the
  "o_form_renderer" class, which was removed during the recent form view
  refactoring.
- the list renderer no more adds the root node class attribute to its
  "o_list_renderer" div
- the X2ManyFieldDialog has been adapted too
- since View, X2ManyField & X2ManyFieldDialog both need to compute view
  classnames derivated from the arch root node, an util has been
  introduced to avoid duplicating code
- the whole codebase has been checked and adapted.

Related: odoo/enterprise#40418
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-04-27 16:10:30 +02:00
Leonardo Pavan Rocha 232575f684 [FIX] calendar: fix attendee's status not being shown on tags list
https://github.com/odoo/odoo/pull/110188 introduced a change in the TagsList
component, making the className prop be used in the parent tag rather than the
image tag. This change makes sense as most times you want to add classes to the
root element in the component. However, in calendar, we used className to style
the image tag, to allow showing the calendar attendee status for an event. This
commit introduces the imageClass property that should be passed in the tags
prop. Therefore, tags list will now have both className and imageClass, making
it possible to style both tags.

task-3277079

closes odoo/odoo#118781

Signed-off-by: Arnaud Joset <arj@odoo.com>
2023-04-27 16:10:24 +02:00
William BraeckmanandBertrand Dossogne b23fea1b96 [ADD] l10n_fr_hr_holidays: add french time off for part timers
Adds 2 new modules:
l10n_fr_hr_holidays
l10n_fr_hr_work_entry_holidays

This commit adds modules allowing to compute accurately
the number of days off taken by a french part-timer.

Both modules will automatically install when hr_holidays is installed and
at least one of the companies is located in France

In France, when taking a time off using a different calendar from the
company's calendar you have to count the days as if you were taking time
off in the company calendar.

For example let's say you have an employee working only monday through
wednesday, if that employee were to take a time off ending with
wednesday afternoon, the time off would count up until friday (if the
company calendar if monday->friday), so that a whole week is always 5
days regardless of the employee calendar.

This is also the case for 'holes' in the employee calendar, for example
a calendar where one would work monday, wednesday and friday only.

l10n_fr_work_entry_holidays:
By default time off only generate work entries for intersections between
time off and attendance period, so that when taking a time off for a
whole month you wouldn't get work entries on the weekend if you normally
don't work that day.

But since l10n_fr_hr_holidays computes the number of days it would
normally cost with french rules. We also have to make sure that the work
entries are generated appropriately. Essentially this modules adds the
logic required to fill the holes needed using the company calendar
instead of the employee one.

OTHER:
Fixes a redundant call to super function in hr.leave._get_number_of_days,
improving its performance a bit

task-2602897

closes odoo/odoo#82637

Related: odoo/enterprise#25805
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Bertrand Dossogne <bedo@odoo.com>
2023-04-27 16:10:19 +02:00
Raouf b0421b3aab [IMP] project: improve portal and project sharing UX
Before this commit:
1- project sharing task form: Internal users can't see and edit all fields.
They need to go back to backend interface. Some users don't even know the
difference between project sharing and backend, and the others need to navigate
manually to that interface

2- portal tasks list view: Currently, the name of tasks will be cropped if it is
too long. However, the user has no choice but to open the form view to get the
full name of the task. This can be quite bothersome when each task has to be open
individually in order to differentiate them

3- portal tasks list view: Currently, projects are displayed as tags

After this commit:
1- we added a shortcut to redirect them in one click.

2- display the full name of the task on hover

3- display project as a normal field

task-3186689

closes odoo/odoo#114531

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-27 14:49:38 +02:00
7ed868766e [FIX] base: do not create ir_cron_trigger for inactive crons
As ir_cron_trigger are only processed for active crons, we should
not create them for inactive crons to avoid bloating the table.

Account_edi tests needed to be adapted to make sure the cron
ir_cron_edi_network is set up as active during the tests.

Backport e79b1a7: ([IMP] base: Garbage collect ir.cron.triggers)

closes odoo/odoo#118844

X-original-commit: a62275430e21f9e7e510913ac9afb25943da525b
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Co-authored-by: Julien Castiaux <juc@odoo.com>
Co-authored-by: Yannick Tivisse <yti@odoo.com>
2023-04-27 13:36:19 +02:00
Rodrigo ca62e32aa4 [FIX] account: account_searchpanel.scss add width 0 to firts elemnet with class .o_toggle_fold for align header test to left
closes odoo/odoo#119904

X-original-commit: b3b05e6f764229298c9e74abf0dd42c06a5dd73d
Signed-off-by: William André (wan) <wan@odoo.com>
2023-04-27 12:31:41 +02:00
Jan Brodersen (Armitxes) 5d5099a0f5 [FIX] mail: No crash from "enumerateDevices" in discuss calls
Before this commit, when accessing the discuss call settings
in non-localhost without SSL, there was the following crash:

```
"Cannot read 'enumerateDevices' of undefined"
```

Odoo uses zxing-js to detect devices within the discuss app.
zxing-js provides methods such as "hasNavigator",
"isMediaDevicesSuported" or "canEnumerateDevices" to check if
features are available. These are not called by Odoo before using
the related features what can result in a JS traceback.

This commit fixes the issue by showing a warning as a toaster
notification and in the dev tools, instead of a traceback.

The zxing-js methods are not exposed, hence the reliance on
truthy mediaDevices.

See also https://github.com/zxing-js/library/issues/225

Closes https://github.com/odoo/odoo/issues/112255
Closes https://github.com/odoo/odoo/pull/112813

closes odoo/odoo#119903

X-original-commit: 32238dd680396c6ccb519aa8b3fb7487c38395f7
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-27 12:31:39 +02:00
Didier (did) 3a86405a09 [IMP] mail: remove unuse variable
This code was moved to `_bus_notification_target` in https://github.com/odoo/odoo/pull/119413

closes odoo/odoo#119911

Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2023-04-27 11:21:20 +02:00
roen-odoo 5db35ac7c5 [FIX] point_of_sale: correctly show discount on receipt
Current behavior:
When a fiscal position is applied on an order in the PoS, the change of
price was interpreted as a discount. This shouldn't be the case.

Steps to reproduce:
- Create a tax that is included in the price (e.g. 10%)
- Create a fiscal position that match this tax and change it to no tax
- Change the pricelist option to show discount
- Create a product with a price of 100€
- Open the PoS and add the product to the order
- Apply the fiscal position
- Pay the order, and go to the receipt screen
- There is a discount showed on the receipt

opw-3154499

closes odoo/odoo#119902

X-original-commit: c7e1e634f76ef01920f7bcc7ccb43b3f28736499
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2023-04-27 11:21:17 +02:00
Josse Colpaert 04bfbb4e7e [FIX] account_edi: we forgot to add the edi documents in the mail send wizard
The send and mail wizard was replaced by something simpler, but we
forgot to automatically attach the attachments of the edi documents
of the old account_edi in the mail.

Before, the XML of e.g. the Mexican EDI, generated when the invoice gets
sent (and signed) by the government,  would not be included
automatically when the user wants to send the invoice by mail to the
client. Now, it will be.

closes odoo/odoo#119435

X-original-commit: b3cbd7ea2b6cc07efd9a6358bd37f23f1ba4e6ab
Signed-off-by: Laurent Smet <las@odoo.com>
2023-04-27 11:21:12 +02:00
luvi 894090914e [IMP] web, *: add supportedOptions documentation as field metadata
*: mail, mass_mailing, sms, web_editor

This commit adds a new supportedOptions attribute that can be added to any
field widget metadata object. This documentation can be used from other places
(Studio for example) by getting the field from the registry and then read
this key. This attribute can contain an array, detailing the list of available
options for the field widget.

By using an array, it can be ordered easily without having an object with keys
unalphabetically. Ordering the options can make sense, especially when two
options are tied to each other, it is easier to group them one after the other.
(eg: 'start_date' first, then 'end_date')

Each option documented is an object and has the following attributes:
- help: contains more details on the current option and its use
- name: name used in the options object from the node
- label: a label with a more explicit name than the option name
- type: the type of value that must be used as a value (string, boolean, selection, field, domain)
- choices: for options with a 'selection': can be used to know available values
  where multiple values can be chosen as the value. This must be
  an array containing the options.
- availableTypes: for options with a 'field' selection: can be used to filter the
  available fieldNames to choose as a value.
- default: the value that is used by default, when the option is not set
  in the options

task-3259617

closes odoo/odoo#118713

Related: odoo/enterprise#39847
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-27 11:21:09 +02:00
niyasraphy 1e7127c92e [FIX] product: traceback on deleting category
before this commit, when deleting a product
category from a db where expense category
is already deleted before this commit [1]
is raising exception

after this commit, exception wont be shown
in existing db where expense category is
deleted.

1 https://github.com/odoo/odoo/commit/09e4b2fb586ac83adb984672e027ce6dd62affb2

closes odoo/odoo#119754

X-original-commit: 20b5518110b233ba3b59158a8362db04b9a89aad
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-04-27 10:13:10 +02:00
Géry Debongnie a7cd003173 [FIX] web: do not reload webclient in some cases with errors
Whenever an user updates a company or a currency, the webclient has to
reload, to properly apply these changes. It is done automatically,
immediately after the rpc has completed.

However, before this commit, it would do that always, even if the rpc
has failed (for example, if the user tried updating an invalid field),
so the user would briefly see an error window, then the browser is
immediately reloaded.

With this commit, we only reload the webclient when the rpc succeeded.

closes odoo/odoo#119730

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-27 10:13:05 +02:00
Ricardo Gomes Rodrigues (rigr) ef9c74f698 [FIX] stock_account: prevent stock account update on product change when using manual stock valuation
If the category of a product is using manual stock valuation, when changing the product on an invoice line,
the account should not be set to the `property_stock_account_input_categ_id`. It should be the case only if
we use automatic/real-time stock valuation.

opw-3226536

closes odoo/odoo#119717

Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Signed-off-by: Ricardo Gomes Rodrigues (rigr) <rigr@odoo.com>
2023-04-27 10:13:02 +02:00
Loukas Wets (lowe) cd65f8bdb2 [IMP] point_of_sale,pos_loyalty: gift card info notification empty cart
When a valid gift card is added in a empty cart, the pos will display a
notification of the resume of the gift card.

We also made the notification component to preserve white space.

Task-3265311

closes odoo/odoo#118609

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-04-27 10:13:00 +02:00
Julien Castiaux 1bbdd77f0e [IMP] core: prettify_domain function
This commit add a new `odoo.osv.expression.prettify_domain` function
that can be used to format a domain as a string with the correct
indentation.

Example:

    ['&', '|', ('name', 'like', 'Jack'), ('name', 'like', "O'Neill"),
     ('function', '=', 'Colonel')]

Becomes:

    ['&',
        '|',
            ('name', 'like', 'Jack'),
            ('name', 'like', "O'Neill"),
        ('function', '=', 'Colonel')]

closes odoo/odoo#118067

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-04-27 10:12:57 +02:00
Julien CastiauxandRaphaël Collet 5a998694a6 [IMP] core: merge subqueries WHERE clauses
Rationale
---------

Given the following domain:

    ['|',
        ('company_id.name', 'like', 'BE'),
        ('company_id.city', 'like', 'Brussels')]

The ORM would generate the following SQL query:

    SELECT "res_partner"."id"
    FROM "res_partner"
    WHERE "res_partner"."company_id" IN (
        SELECT "res_company"."id"
        FROM "res_company"
        WHERE "res_company"."name" like 'BE'
    ) OR "res_partner"."company_id" IN (
        SELECT "res_company"."id"
        FROM "res_company"
        WHERE "res_company"."email" like 'help@odoo.com'
    );

Which is sub-optiomal as the WHERE clause of the two subqueries could be
regrouped inside of a single query like so:

    SELECT "res_partner"."id"
    FROM "res_partner"
    WHERE "res_partner"."company_id" IN (
        SELECT "res_company"."id"
        FROM "res_company" WHERE (
            "res_company"."name" like 'BE'
            OR "res_company"."email" like 'help@odoo.com'
        )
    );

Postgres-wise, it is faster to execute the latter query than the former
one. This commit is about optimizing the ORM so that it generates
queries where the WHERE clause of compatible subqueries are grouped
together.

Technical solution
------------------

The solution explored by this work is to replace the regular relational
field accesses (over a dotted path) by a new `any` operator that look as
follow:

    (relational_field, 'any', domain)

For instance, the above `('company_id.name', 'like', 'BE')` leaf becomes
`('company_id', 'any', [('name', 'like', 'BE')]` using `any`.

Having a domain as right-hand-side allow for the combination of the
domains of same compatible relations:

    [('company_id', 'any', ['|',
        ('name', 'like', 'BE'),
        ('city', 'like', 'Brussels')])

Having combined domains allows for generating better SQL queries with
minimal changes to the expression parsing algorithm, which can only
translate a single leaf at a time to SQL. With the new `any` operator,
it is still a single leaf but the right-hand-side contains the merged
domain, thus the combined SQL WHERE clause is immediately generated.

task-id-3234671

Part-of: odoo/odoo#118067
Co-authored-by: Raphaël Collet <rco@odoo.com>
2023-04-27 10:12:57 +02:00