Commit Graph
157157 Commits
Author SHA1 Message Date
Benjamin Vray e13743ff2e [FIX] web_editor, website: mitigate line between shapes issues
This commit mitigates an issue with shape elements sometimes having tiny
spacing on their top or bottom edge.

This issue is mainly on Chrome when the user has changed the page zoom.
When the page is zoomed the elements can have a width value with a
decimal part. Because of it, the size of the SVG background images are
not correctly rounded compared to their container and therefore leaves a
visible space.

Steps to reproduce the bug:

- On Chrome, add several shapes on a website page.
- Change the zoom of the page and change the window width.
- At some points, the gap will appear.

The least bad solution we found to fix this is to ensure that the width
of the shape elements is always as close to an integer as possible.

Reminder: several commits had attempted to fix this before ([1], [2],
[3], [4]). But that wasn't enough to stop it happening. Some shapes
still need to be fixed although that will likely be done in future
versions.

[1]: https://github.com/odoo/odoo/commit/c0f62593a4da37e8404dddc0a5762879a5ebbf7f
[2]: https://github.com/odoo/odoo/commit/ac82407b259eab929486bf0a333a48bc507efa60
[3]: https://github.com/odoo/odoo/commit/42b3ad10e0b32b7fc72f801e2c67d6baf938c566
[4]: https://github.com/odoo/odoo/commit/e386f318f5cff50901dba3db8a2587911ba02a6e

task-2824607
opw-3069213
opw-3057533

X-original-commit: 623db525e18931a4dd5794da78be840afc34991a
Part-of: odoo/odoo#108228
2022-12-18 23:16:57 +01:00
Romain Derie 8850e98233 [FIX] website: prevent upsert crash if GEOIP country not found in odoo
It was reported the following error:
```
psycopg2.errors.DatatypeMismatch: column "country_id" is of type integer
                                  but expression is of type boolean
LINE 9:                 false, 1, NULL, 4, 4,
```

The root cause is unknown, it's not yet sure how this is happening
exactly.
This commit is then fixing naively the consequence.

Somehow, GEOIP is returning a country code which does not exists in Odoo
for this error to appear. It's normally not possible.

There is multiple possible cases that would lead to this error:
- The user modified the `code` field of a country in his DB (unlikely)
- The user deleted a country in his DB (unlikely)
- The GEOIP database is returning a country which does not exists in
  Odoo. This is the most probably case, even if the latest up to date
  `GeoLite 2 City` seems to have the exact same country code list as in
  Odoo 16.0 (250 exact same ones).

Moving the country_id search directly in the query will prevent the
issue and is better anyway to avoid an useless query everytime when
GEOIP is enabled.
Perf wise, it doesn't seems to alter at all the query speed.

closes odoo/odoo#108232

X-original-commit: 42fe2540620b7529d9a848c4570290cbf64a4f48
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-18 22:27:46 +01:00
Solan Delvenne (sode) 2f384e0172 [FIX] snailmail: Fix a CSS selector
One of the selector didn't work due to a space before the classes and
prevented the fix from working. This fixes it in my tests.

closes odoo/odoo#108244

X-original-commit: 334c79409a02beedb317d132f76005521e407bc7
Signed-off-by: Louis Baudoux (lba) <lba@odoo.com>
Signed-off-by: Solan Delvenne (sode) <sode@odoo.com>
2022-12-17 17:09:10 +01:00
Benjamin Vray c54826be4b [FIX] web_editor: fix resizing columns out of parent
Before this commit, it was possible to resize a column so that it
overflows the right border of the row.

Steps to reproduce the bug:
  1. In website edit mode, drop a `media list` snippet in the page.
  2. Select a column.
  3. Resize the column by dragging its left side to the right to make it
  smaller.
  4. Drag its right side to make it bigger and go until the edge of the
  editor => The column overflows and ends outside of the content zone.

This commit prevents the column from overflowing when it has an offset.

task-2837361

closes odoo/odoo#108218

X-original-commit: 1759079cbb084acac0616abfab84b83b1e62ae61
Signed-off-by: Bojabza Soukéina (sobo) <sobo@odoo.com>
2022-12-16 20:38:26 +01:00
Xavier-Do f842ae07d2 [IMP] tests: make python version accessible without importing sys
closes odoo/odoo#108202

X-original-commit: 27575ed59476238c76d40143d81f6975f1934f7c
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-12-16 19:37:53 +01:00
Xavier-Do e583a1f8f4 [FIX] tests: better test traceback
The motivation of this commit is to get a correct pathname on an
ir_logging when a test fail .

The main issue comes from subtest since an exception inside a subtest
will have only a partial traceback, not containing the line triggering
the error in the test method.

This can also affect debugging since a part of the stack is missing.

See pull request for more informations

X-original-commit: 2b6a8bc79529578ecd21bbb0fd4fe452f28d7cd7
Part-of: odoo/odoo#108202
2022-12-16 19:37:52 +01:00
Touati Djamel (otd) 5c69db2220 [FIX] mrp_subcontracting: convert supplier price into company currency
Steps to reproduce the bug:
- Enable “subcontracting” in the mrp settings
- Create a storable product “P1”:
    - Add a vendor:
        - supplier: “Azure interior”
        - currency: euro
        - price: 20
     - Add a BoM:
        - Type: subcontracting
        - add any product as component
        - Save

- Check that the currency of the company is in dollars
- Click on BoM overview

Problem:
The seller's price is displayed with the dollar symbol, but it is not
converted into dollars

opw-3085392

closes odoo/odoo#108187

X-original-commit: 05a8abde43ef6870d9494e34810632b9b2091e63
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-12-16 19:37:49 +01:00
Antoine Guenet f45db48f6b [FIX] web_editor: ensure correct root for wysiwyg in iframe
Since the migration to Owl, the root of wysiwyg has been wrongly set.
First, in renderElement, wysiwyg creates an editable element, which it
sets as its $root and $el elements. Then in startEdition, wysiwyg_iframe
creates a new editable element that it puts in an iframe appended to the
$el element. It then failed to change the $root element to that new
editable instead. Since we have a new editable element, the old one
should also not be contenteditable=true.

Because the $root element was wrong (and outside the iframe), all
listeners on it failed, with the effect that at least the link tools and
link popover were broken.

closes odoo/odoo#108186

X-original-commit: 86a8b31879b153bb53249fabfab47d254159effa
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-16 19:37:47 +01:00
FrancoisGe 1f0e840238 [IMP] *: converting custom list views adding a doAction button
In this commit, we will convert all the customisations of the list view
consist in adding an always present button in the control panel that
performs an action/calls a model's method.

To do this, we will use the new display="always" parameter applicable
to buttons in the header of list views. This allows us to define a
button that is always visible in a list view.

closes odoo/odoo#106519

Taskid: 3082303
Related: odoo/enterprise#34387
Related: odoo/documentation#3044
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-16 18:39:56 +01:00
FrancoisGe ce30c50e8d [IMP] web: add buttons in control panel without selection in list
This commit adds the possibility to define buttons that are always
present in the arch of a list view.

Purpose:
Several customisations of the list view consist in adding an always
present button in the control panel that performs an action/calls a
model's method.
We want to support this feature directly in the framework to remove
these customisations.

Solution:
Add a "display" option that lets you know when to display a button.
The different values that can be assigned to "display":
- "selection": the button is only displayed if at least one record is selected.
- "always": the button is always displayed.
The default value of "display" is "selection".

Exemple:
<tree>
    <header>
        <button name="to_do" type="object" string="Do" display="always"/>
    </header>
</tree>

Taskid: 3082303
Part-of: odoo/odoo#106519
2022-12-16 18:39:56 +01:00
Prakash Prajapati 875be3bc0c [FIX] hr: fix the detailed reason width in Employee Termination wizard
Currently, the detailed reason appears too large (200%). In this commit I update the width
to 100% instead of 200%.

closes odoo/odoo#108178

X-original-commit: 1c8411ecb7ee6aa67ea8facd43fa579ead4ac5a5
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-12-16 17:20:06 +01:00
Ricardo Gomes Rodrigues (rigr) 987ffe4f69 [FIX] account: aml's partner_id modified after the move has been posted when using the hash
Steps to reproduce:
1. Activate the hash mode on a journal
2. Create an account move
3. Choose a customer who is not a commercial partner (e.g. Brandon Freeman from Azure Interior)
4. Post the move
5. Error saying that we cannot modify the `partner_id` because the move has already been posted

This is because currently we first post the move and then we modify the `partner_id` of the lines whose `partner_id` is different from the account's `commercial_partner_id`. We can easily fix this by posting the move after the lines'`partner_id` have been modified.

closes odoo/odoo#108177

X-original-commit: 1036134a2f0d921fd6a659b4951e5fa63975b78d
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Ricardo Gomes Rodrigues (rigr) <rigr@odoo.com>
2022-12-16 17:20:03 +01:00
Victor Piryns (pivi) 9ed8db4f6e [FIX] project: account invoices/bills in project update dashboard
Current behaviour:
In the project update dashboard, invoices and bills that are created
directly (without sales order or purchase order) are not taken into account
in the calculations for profits/costs.

Expected behaviour:
They should be taken into account, as long as the line on them has the
analytic account line on it.

Steps to reproduce:
- Install Project, Sales, Purchase, Accounting
- Activate "Analytic Accounting" in Settings
- Create a new Project and create a new analytic account for the project
- Create a Bill with a product (storable/consumable) and the analytic account
on the line
- Post the bill
- Go to your project update dashboard and notice the cost of the bill
is not taken into account, but we do have a smart button that goes to the bills

Reason for the problem:
Profits/Costs calculations are done based on the sales/purchase orders,
missing the "orphaned" invoices and bills. A side effect of this problem,
storable products on sales are also not taken into account, since Sales Orders
don't have an analytic account per line before version 16, unless that product
is a service (all services intrinsically have an analytic account)

Fix:
Get all invoices/bills that have lines with the project's analytic account,
and removing from those the lines that were already accounted for.

Affected versions:
- saas-15.3
- 16.0
- master

opw-3058198

closes odoo/odoo#108176

X-original-commit: 3d3f4109a06445b6ce9606770085c763ea206b35
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
2022-12-16 17:20:00 +01:00
aath-odoo 1aad11b0bf [FIX] web_editor: command prompt not displaying on focus
Before this commit:

command prompt is not displayed when html field has placeholder.

After this commit:

placeholder is replaced with command prompt when focused.

Task-2881079

closes odoo/odoo#108175

X-original-commit: 16cb4af921fec5483e366ea0a1b402631a7e28f3
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-16 17:19:58 +01:00
xO-Tx 641eb6daf6 [I18N] website_sale_comparison: add source terms for view placeholder
The goal of this commit is to add some missing translation source terms
for "Attribute Categories" view placeholder (added in [1]).

[1]: https://github.com/odoo/odoo/commit/82e9afeff8bb4bd64c5f0fb95af4f4b7a66e722d

task-2973149

closes odoo/odoo#108174

X-original-commit: fae1d2c3d0014c310d2fbda033028a9f7fbac1ae
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-16 17:19:55 +01:00
william-andre 1aa35de41a [FIX] account: required default account on journal
The default account was marked as required in the view (bold underline)
but the validation didn't happen. This made it possible to set up
journals without that required field.
Since owl, only the last `required` attribute is remembered, so we need
to define it at least correctly on the last field declaration.

Related:
48ef812a63
bd6b98a65f

opw-3061073

closes odoo/odoo#108173

X-original-commit: 7628888d61843ed9e9b76039884572e923ba382f
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2022-12-16 16:17:51 +01:00
Alexandre Kühn 9e2b2aad7c [FIX] website_livechat:tests: fix chatbot flow step "Hello! I'm a bot"
Before this commit, website_livechat_chatbot_flow_tour failed
frequently and non-deterministically at 1st step "Hello! I'm a bot".

This happens because the tour starts on url `/`, then reload the url
`/`. The livechat button is configured in `auto_popup` mode, which
could let chatbot starts running before the 2nd url that must precede
the steps.

The 2nd url reload is actually useless, and removing it also fixes
the issue.

closes odoo/odoo#108160

X-original-commit: 402b6e98009017e04245d92cabcc35184014b280
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-12-16 16:17:49 +01:00
Louis (loco) 378fe2c350 [FIX] website: enable the use of the save option only on snippets
Steps to reproduce the bug:
- Add a "Table of Content" on the website.
- Try to save a "Block" of the table.
- 14.0: you get an error message.
- 15.0: it keeps loading forever.
- 16.0: you get a white page.

Users should not have the possibility to save part of a snippet. The
goal of this commit is to ensure that the save option applies on a
snippet. If it is the case, the user has the possibility to save it. If
not, the user does not have the opportunity to save it.

opw-3056913

closes odoo/odoo#108002

X-original-commit: 5f28c7d9a04c46d570b13766eaaa90e755008623
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-12-16 16:17:46 +01:00
Victor Feyens 13ccd9cee4 [IMP] test_lint: detect useless manifest content
Keep the manifests as light as possible, to easily see custom behavior/content.
Complete the work of previous commits cleaning the manifests content:

* 42bad1a6d2
* ef7005f524

and make sure this kind of cleanup commit is not necessary in the future
because it is now automatically verified by a dedicated test.

closes odoo/odoo#107735

Related: odoo/enterprise#34903
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-12-16 16:17:41 +01:00
Abdelouahab (abla) 608aa8ca88 [FIX] payment_stripe: use idempotency key only when offline
To Reproduce
============
- on a db with sales, website and Stripe payment aquirer activated
- on the portal of a user add two payment methods, an expired card
and a valid one
- create a SO and generate its payment link
- try to pay with the invalid card first -> and error (card was declined)
- try to pay with the valid card -> error (same idempotency key)

Problem
=======
the generation of the idempotency key is based only on dbuuid, transaction's
reference and the scope. So in this use case it will generate the same key.

Solution
========
The idempotency key prevents issues where the customer is charged twice for
the same thing. In this case, we don't want to prevent anything since the
customer is on the page. It's suggested to use idempotency keys only for offline
payment when the customer is not in front of the payment page (e.g. when the cron
charges the customer for his subscription)

opw-3091354

closes odoo/odoo#108163

X-original-commit: 089387087010ae917494d5072f00d72c572b7d09
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: abla001 <abla@odoo.com>
2022-12-16 14:49:58 +01:00
Sébastien Geelen (sge) 13f31d046c [FIX] web_editor: prevent html in odoo field
Prevent the editor to inserting html during pasting or dropping
in editable zone that will not support the html content received.

task-2990147

closes odoo/odoo#108162

X-original-commit: 107ebb1db00a4f5a0fc6f64b76f00b040310e432
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-16 13:48:39 +01:00
Pierre-Yves Dufays e1082af5be [FIX] note: support link in note created from the systray
The URLs in notes created from the systray were not transformed into links.
This solves the problem.

Task-3052952

closes odoo/odoo#108147

X-original-commit: 00fbfab9b7dedc2b5917e7807d8abd2995253919
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-12-16 13:48:34 +01:00
Walid HANNICHE (waha) 8704ebf5f9 [FIX] auth_signup: fix password reset
Steps to reproduce:
- generate password reset link
- access the link
- the page redirects to login

Bug:
password reset and new account creation share the same path
this commit [1] made it so when you click on the new account link after
it was activated you are redirected to login

Fix:
the distinction between both scenarios is made using the presence of
'signup_email' in the query.
only add signup_email when creating a new account

opw-3068790
[1]:https://github.com/odoo/odoo/commit/97658791306349456761ba4c18d504f861e3bb98

closes odoo/odoo#108093

X-original-commit: 3ba02fbeb54afc0ebd5ab434cdf921159646e9d0
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
2022-12-16 13:48:28 +01:00
niyasraphy 4c43882f30 [FIX] base: prevent uninstalling of web module
closes odoo/odoo#108088

X-original-commit: 688acadeec159d713f75384d35d22e6c88f4b00a
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-12-16 13:48:25 +01:00
Kartik Chavda 7e23c6866e [FIX] account: fix account domain leaf issue
Issue:
- clicking on various account field gives traceback because
of invalid domain.

Cause:
- https://github.com/odoo/odoo/pull/105131 PR remove a leaf
from account domain but forgot to remove '&' operator.

Fix:
- removes '&' operator from account domain.

task-3099758

closes odoo/odoo#107914

Signed-off-by: John Laterre (jol) <jol@odoo.com>
2022-12-16 13:48:23 +01:00
Ivan Yelizariev 4c396b1db2 [FIX] website_sale: show empty cart icon before starting animation
On clicking "add to cart" button, there is a simple animation of product image
moving to the cart icon. However, if the cart icon is hidden because of disabled
option "Show Empty Cart", the animation is broken: the image is moving to left
corner of the navbar.

Fix it by showing cart icon before starting the animation.

opw-3078396

closes odoo/odoo#107760

X-original-commit: 6110b993ce63356e1b5b900f7bacb2afa648f6ad
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
2022-12-16 13:48:20 +01:00
Valentin Chevalier 76425a588d [IMP] sale: add the possibility to mass cancel SOs
For a lot of clients, the number of quotations is big, and canceling
them one by one is time-consuming.

task-2991744

closes odoo/odoo#104531

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-12-16 13:48:17 +01:00
fkramer 0810921fed [CLA] Updating CLA initos.md
closes odoo/odoo#108100

X-original-commit: 6957808a4440bd78b7276a08c30abc8facad7530
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-12-16 12:45:42 +01:00
niyasraphy 1b767908dd [FIX] l10n_ph: moves_to_export field alignment
install l10n_ph module and open any vendor bill, click on action button and click Download BIR 2307 XLS, in the opening wizard, the one2many field moves_to_export is not aligned well in the form due to missing colspan and currently the field is too compact in the form.

closes odoo/odoo#108094

X-original-commit: 53ffdccc0310c32980297d5dcc3f6a24fa852a8c
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2022-12-16 12:45:40 +01:00
Patrick Hoste 0e92916a45 [IMP] event: add avatar widget to responsible
This commit adds the avatar widget to the responsible
field in the event form view.

Task-3100951

closes odoo/odoo#107927

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-12-16 10:28:44 +01:00
Morgane (morm) a25a3847b6 [FIX] mrp: kanban card settings fix
Prior to this commit, the layout of the settings in the kanban card was
broken

closes odoo/odoo#107895

X-original-commit: 922029c2197145d555b65becd7210c4d7a13d439
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-12-16 10:28:42 +01:00
Benjamin Vray 648def9058 [FIX] portal: fix user dropdown in boxed header template
Since this commit [1], the "avatar" image of the logged user is no
longer displayed on the "boxed" header template.

This is due to the "t-nocache" attribute which was forgotten for the
"_avatar" parameter in the "user_dropdown" template.

[1]: https://github.com/odoo/odoo/commit/b0a2a41d78292cb8b9e53788d40c6dc5915a466d

task-3063878

closes odoo/odoo#107861

X-original-commit: 484f0acade527e38e9569fc066b4647a8d70e397
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
2022-12-16 10:28:39 +01:00
Kevin Baptiste 52728a2f90 [FIX] hr_recruitment: show properly message field in Send Email
The field was not taking the full size it was allowed to, hence it was
not possible to write the content.

task-3087717

closes odoo/odoo#108102

X-original-commit: eefdd43b24cc4edc0ea9167f1f017c3297c83d21
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-12-16 08:45:47 +01:00
abd-msyukyu-odoo 11916032c7 [FIX] web_editor: html_field should use newProps as newRecordInfo
Sometimes, there is a crash when uploading a file when loading an article for
the first time.

Impacted versions:
16.0+

How to reproduce:
- open the odoo home page (module menu) and CTRL+f5 (force reload)

- go to the knowledge app

- switch to another article than the first loaded one

- in that article, put the cursor somewhere and type ENTER to create a new line

- type the /file command in that line

- try to upload a file

- traceback (if it does not happen, try again from the first step, it is not
  always consistent)

Explanation:
html_field onWillUpdateProps was using the wrong "new" values to update the
currentEditingValue, which sometimes induced a rerendering of the html_field
during a 'blur' event when it should not have (because it seemed that the value
had changed when it did not), which could cause a crash when it occured after
the editor saved nodes with `preserveCursor` to recover the cursor position.
(i.e. when opening the mediaDialog to upload/select a file for insertion in the
editor).

Task-3086694

closes odoo/odoo#108125

X-original-commit: fc9ac0bec8377a2804892cdfe07629c44283c679
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Abeloos Damien (abd) <abd@odoo.com>
2022-12-15 22:57:27 +01:00
qdp-odoo 997a6d3e27 [FW][FIX] account: sequence mismatch handling
Removed annoying error raised onchange of the date/name if they don't match anymore. This was done during the update, which was dumb since it was popping in case you wanted to change both the date and the name. It now only relies on the constraint that is verified upon posting the invoice. Onchange warning is kept only for the format change.

Ensure the date constraint is always verified no matter if the invoice was already posted before, or if we're in quick edit mode: the date's info located in the name must always match the accounting date. This is ensured when posted.

task-2976499

closes odoo/odoo#108116

Forward-port-of: odoo/odoo#107867
Signed-off-by: William André (wan) <wan@odoo.com>
2022-12-15 21:18:59 +01:00
Walid HANNICHE (waha) e99772d834 [FIX] web_editor: editor overwrites hotkeys
Steps to reproduce:
- edit some text on the website
- select a part of the text then press (alt+s)

Bug:
the selected text is deleted before the save

Fix:
if "alt" key is pressed don't execute the editor listener
(except for Mac OS)

opw-2996264

closes odoo/odoo#108103

X-original-commit: 1cd0b4396699513c80bafc2f052d373f9ef9f55e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
2022-12-15 21:18:54 +01:00
Paolo Gatti 9000c01f82 [FIX] account: Currency field if no accounting is set on the user
The currency field shows as a badly aligned "in USD".
This PR adds a proper handling of the combinations
of accounting and multi_currency groups.

Original PR in v15: https://github.com/odoo/odoo/pull/104013

closes odoo/odoo#108101

X-original-commit: d2363794411bbc9147b8ff0d519d588a3814e582
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
2022-12-15 21:18:51 +01:00
Jorge Pinna Puissant 016864ce6b [FIX] base: standardize modifiers received by the JS Framework
Before this commit, the JS Framework receives different types of modifiers:

- List: used for domains.
- String: used for the dynamic domains and boolean values ('1' or '0');
- Integer: used for boolean values (1 or 0);
- Boolean: used for boolean values (True or False);

The issue with this, is that the JS Framework needed to manage the 3
different possibles ways to have a boolean modifier (1, '1', True).

Now, only three types are sent to the JS Framework:

- List: used for domains.
- String: used for the dynamic domains and boolean values ('1' or '0');
- Boolean: used for boolean values (True or False).

The boolean usually sent in a Number (1 or 0) will be transformed into
proper Boolean types (True or False).\

Note that, the 'falsy' modifiers are not sent to the JS Framework.

closes odoo/odoo#108095

X-original-commit: faddb53f30b94ac47ffd7b3b1af36f094f3a60f6
Signed-off-by: Julien Castiaux <juc@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2022-12-15 21:18:49 +01:00
FrancoisGe 8e3de77042 [IMP] tools: adds the dependencies in the odoo.define
After this commit, the transpiler will add the dependencies of a file
to the second argument of the odoo.define(...).

For example:
odoo.define("@test/test", ['@test/dep1', '@test/dep2'], async function (require)

With this change, the code for the module system in the browser will get
directly the dependencies instead of having to stringify the function
defining a module, and grep inside for the "require" words.

closes odoo/odoo#105651

Taskid: 3062390
Related: odoo/enterprise#34895
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-12-15 16:47:05 +01:00
Julien Van Roy e34712d7b5 [FIX] l10n_au: fix traceback when printing a pdf
When installing l10n_au, printing a PDF from any invoice will raise a UserError
(this one: https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/models/ir_actions_report.py#L699).

Indeed, the content of the PDF is empty. Because no qweb report is called since on line
https://github.com/odoo/odoo/blob/16.0/addons/account/views/report_invoice.xml#L335, the t-if is falsy.
Indeed, the `o._get_name_invoice_report()` returns `l10n_au.report_invoice_document` since the l10n_au
was made primary in https://github.com/odoo/odoo/commit/5079ace74958d4acd54d24a95579289a2eda92f1.

To solve that, we need to inherit the `report_invoice_with_payments` template in l10n_au, change the name
in the `t-if` and call the `l10n_au` report.

closes odoo/odoo#108081

X-original-commit: ab221bccc8cc7484efb56d3b1f620031b120f193
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Julien Van Roy <juvr@odoo.com>
2022-12-15 15:45:21 +01:00
Bruno Boi ff619c4761 [FIX] web: repair keynav in dropdowns
- Before this commit
Keyboard navigation in dropdowns lead to a traceback

- Explanation
The traceback happens in the bootstrap library.
When upgrading to bootstrap v5.1.3 (see c48f57e), a fix done in the
previous bootstrap version was lost (see 78f85f2).
This previous fix also added a test but it was not enough to
detect the issue when the bootstrap lib was upgraded.

- After this commit
This commit reintroduce the same previous fix and adapts the test,
hoping it would be enough for future changes to not break further
the expected behavior.

closes odoo/odoo#108080

X-original-commit: daca8fe4e3da4a5ad5fabf3730496a3919af8abc
Signed-off-by: Georis François (fge) <fge@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-12-15 15:45:18 +01:00
Rodopho Cammarosano de Lima (rcdl) 701c29ed35 [FIX] web_editor: allow text node at editable root
An option to disable the automatic wrapping of inline nodes into p at
editable root is needed by Studio's report editor.

task #2995601

closes odoo/odoo#108068

X-original-commit: 9cae999d413a71f3591fcbbadeefea1509778c76
Related: odoo/enterprise#35013
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-12-15 15:45:13 +01:00
Julien Castiaux 5502313853 [FIX] web, *: multi-db /web/session/authenticate
*: base_setup, hr_timesheet, mail, partner_autocomplete, web_tour

Start odoo without -d and with a --dbfilter that allows multiple
databases. Via JSON-RPC access the /web/session/authenticate route
providing a non-filtered database and valid credentials. Traceback,
`request.env` is None.

Since httpocalypse the initialization of the ORM (cursor, registry,
environment) is greedy. It means that the connection to the database is
established very early during the request routing or skip altogether in
case no dbname was known at that time. This contrast with prepocalypse
where the various ORM thingies were lazily setup the first time they
were accessed.

This changement has an important implication regarding authentication.

In prepocalypse, thanks to the lazy approache, a cursor/registry/env
would be setup on the database you just login upon using the
`request.env` for the first time. This was very nice in this regard but
had other problems.

Since httpocalypse such operation is no more possible. Devs must
initialize and use their own cursor/registry/env in case they
authenticate on another database than the one `request.cr` is (maybe)
connected to.

The `/web/session/authenticate` controller is an example of such case.
It crates its own cr/registry/environment after authentication. The
problem the controller uses `ir.http.session_info` and that not all
overrides were updated to use `self.env` (=the env created in the web
controller) instead of `request.env` (=the missing env of the request).

closes odoo/odoo#108063

X-original-commit: 7b9bd9d37731fae724dc5d91da656dab70aa9ad4
Related: odoo/enterprise#35012
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-12-15 15:45:07 +01:00
Denis Ledoux 8d3940eab9 [IMP] base: view validation performance, batch action and group exist
The main goal is to reduce the processing time
it takes for views to be validated during installation.

In order to mimic the behavior of the view creations
during installation, and to analyze the performance,
I used the below code in the shell:

```py
env.cr.rollback()
domain = [('model', '=', 'res.config.settings')]
views = self.env['ir.ui.view'].search_read(domain, [
    'id', 'active', 'arch', 'inherit_id', 'key', 'mode', 'model', 'priority', 'type', 'xml_id'
], order="id ASC")
for view in views:
    if view['inherit_id']:
        view['inherit_id'] = self.env['ir.ui.view'].browse(view['inherit_id'][0]).xml_id

self.env['ir.ui.view'].browse(reversed([view['id'] for view in views])).unlink()
with odoo.tools.profiler.Profiler():
    for view in views:
        new_view = self.env['ir.ui.view'].create({
            key: self.env.ref(value).id if key in ['inherit_id'] and value else value
            for key, value in view.items()
            if key not in ['id', 'xml_id']
        })
        if view['xml_id']:
            module, name = view['xml_id'].split('.')
            self.env['ir.model.data'].create({
                'module': module,
                'name': name,
                'model': 'ir.ui.view',
                'res_id': new_view.id,
            })
env.cr.rollback()
```

Using the above, and analyzing the speedscope profile,
we can see the lines

```py
action = self.env['ir.actions.actions'].browse(action_id).exists()
```
from `_validate_tag_button`, and

```py
if not self.env['ir.model.data']._xmlid_to_res_id(group.strip(), raise_if_not_found=False):
```
from `_validate_attrs`

take a significant time.

Batching them the actions and groups existence
(as recommended as further improvement in the comment which is deleted by this revision),
as well as a more efficient algorithm for `_get_node_groups`,
reduce the processing time of the views validation.

On my computer, the above code creating all the views for `res.config.settings`,
which is an extreme case because the view has 100 inherited views,
allows to reduce the validation procesing time from 9.42s to 8.18s.

I include in the pull request the speedscope profiles screenshots.

Regarding the algorithm for `_get_node_groups` itself:
```py
In [0]: %timeit tuple(tuple(n.get('groups').split(',')) for n in node.xpath('ancestor-or-self::*[@groups]'))
10.1 µs ± 91 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

In [1]: %timeit groups = [tuple(n.get('groups').split(',')) for n in chain([node], node.iterancestors()) if n.get('groups')];groups.reverse();tuple(groups)
3.46 µs ± 29.2 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
```

closes odoo/odoo#107742

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-12-15 15:45:04 +01:00
Rémy Voet (ryv) c6c79473dd [FIX] core: unexpected MissingError when prefetching record
This is a rare case where method _read() raises a MissingError instead
of just ignoring it.

The issue is triggered by several conditions on a model M:
 - at least one ir.rule on M with a domain using a column field on M;
 - one deleted record Y which is in the prefetch set of a record X;
 - one reads a non-column field on record X.

Fix method _read() to manage that case.  It adds an extra call to
exists() in that case, but adds no overhead in the general case.

closes odoo/odoo#108050

X-original-commit: 1876dc87e5c88c711c9b3882c39be704ffc46532
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Rémy Voet <ryv@odoo.com>
2022-12-15 14:43:57 +01:00
sofiagvaladze 58b7d309ce [FIX] hr_expense: correctly update tax_ids after splitting the expense
The - Split Expense - feature was introduced in odoo/odoo#90770

In this commit we fix the following bug, related to it:

Steps to reproduce:
	- Create expense with tax_ids.
	- Click on - Split expense on the expense form. From the first
      hr.expense.split line remove the tax_ids. Rename it as '1',
      so that it is easier to find it back for checking later on.
 	- Click on - Expense split on the wizard.

Check the resulting expenses. Specifically, the one with the name '1'.

Current behavior - The tax_ids field for the first expense
(with the name '1') is still populated.
Expected - The tax_ids field for the first expense should be empty.

On top of that, we introduce the tests that check Split Expense flow.

task - 2831024

closes odoo/odoo#108049

X-original-commit: 3aaf4f1ee2967793c9a4c29766cec63d2c6e3cf4
Related: odoo/enterprise#35005
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-12-15 14:43:54 +01:00
Tom De Caluwé 9d9404469c [FIX] hr: avoid duplication of user associated partners
When creating an employee with an associated user, the work email of the
employee is copied from the user (or actually the partner associated with the
user).

However since this [commit], both the mobile_phone and work_email fields on the
employee are computed fields based on a linked partner in the work_contact_id
field. This partner is created on the fly if it did not previously exist.

Both of these behaviors interact in such a way, that the linked partner of the
employee is created automatically using the email from the linked partner of
the user. This is a bug, since both linked partners of the employee and the
user should be the same.

The bug is easily resolved by adding the work_contact_id field directly to the
values dict for the creation of the employee (instead of the work_email).

Reproduction steps: the bug can be easily triggered by repeatedly installing
and uninstalling the employees app. An extra partner gets created for each
employee in the master or demo data, after each install/uninstall cycle.

[commit]: https://github.com/odoo/odoo/commit/3c6060b7bbe9c67aca8073ef43c1e89fb7e820ca

opw-3031187

closes odoo/odoo#108045

X-original-commit: 35b7e0e128f1cfd72c11ebb16d68bc48fdcbdb57
Related: odoo/enterprise#35004
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-12-15 14:43:49 +01:00
Nicolas Martinelli aa8de3d4d2 [IMP] config: increase limit request
A typical Odoo worker is able to handle ~20 requests per second. With a
default limit to 8192, it means that the worker is recycled after
8192 / 20 = 409s ~ 7 minutes.

There is no reason to recycle a worker that often, since there are
other means of limiting the resources allocated to a worker such as the
memory limit.

We increase the default limit request to 65536, therefore the lifetime
of a worker should be extended to ~1 hour in peak times.

closes odoo/odoo#107970

X-original-commit: a24d32003af334d63f04d6892dbc2e4383a65301
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2022-12-15 14:43:44 +01:00
Joanna ab9fa742c0 [IMP] res_lang: remove deprecated function
closes odoo/odoo#105186

Signed-off-by: Rémy Voet <ryv@odoo.com>
2022-12-15 14:43:41 +01:00
Pierre Paridans fea6aee7a1 [FIX] web: MobileCompanyMenu's checkbox rendering
This commit replaces the .h2 with the .fs-2 class on the
MobileCompanyMenu checkboxes' icons to keep the same visual size but
without the other styling changes made for the header-like tags/classes.
This avoids an override of the .fa font-family which breaks the Font
Awesome's icon font.

Note: this is a "symptomatic fix" ; the proper fix should be to look for
the override's cause (cf. o-bg-color mixin).

closes odoo/odoo#108051

X-original-commit: 2aa76227296767701b1ea4b2e78e0701a061cf6f
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-12-15 13:41:02 +01:00