Commit Graph
160109 Commits
Author SHA1 Message Date
Denis Ledoux a2acf91958 [IMP] core: models __repr__ should show when ids is wrong
As a developer,
when you craft your records set manually,
and wrongly use the API and set something weird in `ids`,
something else than a tuple of integers,
`repr` should help you to understand you did something wrong.

e.g.

before
```py
In [1]: env['res.partner']._browse(self.env, '(1,)', 'bar')
Out[1]: res.partner(1,)
```

after
```py
In [1]: env['res.partner']._browse(self.env, '(1,)', 'bar')
Out[1]: res.partner'(1,)'
```

We could put an assert in `_browse` to make sure `ids`
is a tuple of integers, but this is considered a non-stable
change, as it will suddenly crashes when you will update
Odoo while it wasn't the case before.

closes odoo/odoo#118119

X-original-commit: f689c4f53fc4663b17c57bd1d704b9ffb9f11f8d
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2023-04-08 14:38:46 +02:00
tsm-odoo c0ce422935 [FIX] bus: solve indeterministic error in TestWebsocketCaryall
This PR fixes the `15350`runbot issue that was due to the
websocket subscribe not being properly awaited before logging
out.When the log out occurred before the subscribe was received,
the `odoo_ws` variable was `None`.

closes odoo/odoo#118097

X-original-commit: 59af91840c3ed7253c1c3c9dd80a4919ebdee593
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-07 21:48:48 +02:00
Habib (ayh) 34149617a3 [FIX] account: broken no content helper
doAction does not convert the action help html to markup resulting in the display of an html string.

To replicate:
- Journal Items List view or Analytic Items
- Click a link to the bank recon widget
- In bank recon widget, search for something that returns no records
- The no content helper displays html string

After this PR:
By using the doActionButton instead, noConentHelper is marked up and displays correctly.

closes odoo/odoo#118093

X-original-commit: 8cedb020f2bcd2115fdaf0fb44abbeb936ced3c0
Related: odoo/enterprise#39531
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Ayob Habib (ayh) <ayh@odoo.com>
2023-04-07 20:44:28 +02:00
Rahul Prajapati 10620c0caf [FIX] base: fix validation for co-model field in ir_field view
The co-model field in `IrField` view is accepting Related Model name
even if it is invalid. And replaces the invalid model name with `_unknown`.
This causes KeyError `display_name` when trying to create or read a record.

To fix that we are adding Validations for the Related Model field when it gets
updated from UI side.

sentry-3933471439

closes odoo/odoo#118052

X-original-commit: e4f7798fd5a5cccd5d385f535fbc21264cb6948b
Signed-off-by: Rémy Voet <ryv@odoo.com>
2023-04-07 19:43:33 +02:00
Mathieu (mano) abd5ea645b [FIX] website_sale: fix wrong ribbon text color
Since Bootstrap 5, bg- classes behave differently. On the website
e-commerce shop the ribbon for the states "Sale, Sold out, Out of stock,
New!" still uses bg- classes therefore having the wrong text color by
default, making it difficult to read.

This commit fixes the default text color by using new bootstrap 5 class
text-bg-* instead of bg-*

task-3096035

closes odoo/odoo#118051

X-original-commit: e6ecb4f72e9610bd5e3f81264c8278fbb7a6d5a3
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-04-07 19:43:30 +02:00
Alexandre Kühn d9bb64f1e9 [FIX] mail: show email_from if message has no author
closes odoo/odoo#118038

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-07 19:43:28 +02:00
Alexandre Kühn 804d3786e8 [FIX] mail: do not auto-open chat window with odoobot on login
closes odoo/odoo#117978

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-07 19:43:25 +02:00
Mathieu Duckerts-Antoine d0b9c092bd [IMP] web: new field service
We move the function loadFields from the view service to a newly created
field service. That service can also be used to load model fields for a
given path (loadPath), i.e. load all model fields for the models
traversed by the given path.
We use loadPath in useModelField and DomainSelector.

closes odoo/odoo#117882

Related: odoo/enterprise#39418
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-07 19:43:20 +02:00
Mathieu Duckerts-Antoine 6c5d54e1d9 [IMP] web: cache: new clear and invalidate methods
We introduce two new methods for Cache:
    - a method "clear" that can be used to delete a specific path
    - a method "invalidate" that can be used to delete all paths

Part-of: odoo/odoo#117882
2023-04-07 19:43:20 +02:00
Mathieu Duckerts-Antoine 57a04c4aa3 [IMP] web: utils: zip and zipWith functions
We introduce in utils/arrays.js, the two classical functions zip and zipWith.

Part-of: odoo/odoo#117882
2023-04-07 19:43:19 +02:00
Louis (loco) abda2bb60a [FIX] website_blog: adjust the width of the border when inside column
Steps to reproduce the bug:
- Go on the blog of the website.
- Edit.
- In the "Customize" section, apply the "List" "Layout" and activate
the "Sidebar".

-> The sidebar appears at the bottom of the page instead of on the
side.

The situation looks like this:
```html
<div class="container">
    <div class="row">
        <div class="col"></div>
        <div class="border-end"></div>
        <div class="col-12"></div>
    </div>
</div>
```
The bug comes from the fact that the `div` with the `border-end` class
is inside a `row` class. Due to that, a bootstrap 5 css rule applies
and puts the `width` of the `div.border-end` element to `100%`. Because
the element tries to fill the entire width of the `div.row`, it is put
at the bottom of the page as well as its following elements (in this
case, the sidebar). This bug is fixed by removing the `div.border-end`
element.

opw-3217775

closes odoo/odoo#117849

X-original-commit: 9d8b895b934e5b0986c932837fd043cf847a8992
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-04-07 19:43:16 +02:00
zel-odoo 21b6ef38cf [IMP] mail: activity visual update
1. always show the name of the assignee.
2. replace the icon with avatar
3. bold the time info.

task-3142628

closes odoo/odoo#116349

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-07 19:43:13 +02:00
Maryam Kia 7248178d19 [IMP] mail: Add message reaction menu
This commit adds a menu to see reaction on a message.
It can be accessed from message options or from long press in mobile.

Task-2641441

closes odoo/odoo#116022

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-07 19:43:10 +02:00
Bastien (bvdn) f50c7c16ab [REF] web: add a hook on Many2XAutocomplete orm promise
closes odoo/odoo#115943

Related: odoo/enterprise#38027
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-07 19:43:02 +02:00
Carlos Carral 0b30d1d266 [CLA] Update Vauxoo's CLA
Incorporate Carlos Carral (carralc) as Vauxoo's contributor.

closes odoo/odoo#118040

X-original-commit: 0472569febd557a9956b196e840dd996309c9f9c
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-04-07 18:44:01 +02:00
Lucas Lefèvre fccbc91cc8 [FIX] spreadsheet_dashboard_account: display unpaid amount absolute value
In the Invoicing dashboard, the upper-left most scorecard displays the total
invoiced amount.
The baseline "X unpaid" is wrong. It was displaying the difference between
the key value (total invoiced amount) and the unpaid amount.
That means if not a single invoice was paid (everything unpaid), it would
display "0 unpaid". That obviously not correct.

opw-3248761

closes odoo/odoo#118030

X-original-commit: 2b795ee59ef063b5b7298382008ebd61c51de36e
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-04-07 17:46:42 +02:00
Touati Djamel (otd) 79f85ab312 [FIX] purchase: add the supplier list of the product in each company
Steps to reproduce the bug:
- Create a storable product “P1”
1:/
- Select the company A
- Create a purchase order:
    - product: “P1”
    - vendor: “V1”
    - confirm the PO
The vendor “V1” is added to the supplier list of “P1”

2:/
- Select the company B
- Create a purchase order:
    - product: “P1”
    - vendor: “V2”
    - confirm the PO

Problem:
The vendor “V2” is added to the list but “V1” is deleted from the list
in company A

The “seller_ids” field is in the “product.template” model, we try to
modify it in the “_add_supplier_to_product” function from the
“product_id”(product.product) field which inherits from the
“product.Template” model:
https://github.com/odoo/odoo/blob/3b88ed5ea458a37ee4d440f83bab45bd0fb13845/addons/purchase/models/purchase.py#L531-L532

So the function “inverse_related” will be called, in which the function
“__set__” will be triggered: In the values, the command for the create
will be added but the command for the set will be added as well while
it shouldn't. So in the `write_real` function a search will be done to
get all `product.supplierinfo` with the same product_tmpl_id:

https://github.com/odoo/odoo/blob/36544651f2049bcf18777091dbf02c9631b33243/odoo/fields.py#L4415-L4417

but as we are in sudo, those of company “A” will also be recovered, so
they will be unlinked since they are not in the command.set

opw-3251941

closes odoo/odoo#117985

X-original-commit: 78f803f3c1963711e2a5541f913f030da4f06fb7
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-04-07 17:46:39 +02:00
bosaeed 1d81c2fb8c [CLA] add signature for bosaeed
add signature CLA for bosaeed

closes odoo/odoo#117893

X-original-commit: 07396fd40157c2b020472e05a80acd4a67e9efe8
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-04-07 16:40:53 +02:00
Pratik Awasthi 28b093e6b6 [IMP] project: test onboarding tour for project
This will improve the testing of the onboarding tour
 - earlier when we change the class and don't update the class in the tour it goes unnoticed
 - to prevent failure of the tour we called onboarding tour from python to test the flow
 - Because it helps users to understand the flow so we can let the tour fail

task-3235684

closes odoo/odoo#115672

Related: odoo/enterprise#38333
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-07 16:40:48 +02:00
Bastien (bvdn) 0c2060eab9 [IMP] project, web: sort burndown chart legend
Before this commit:

- The burndown chart displayed the stage in order of the data fetching which wasn't logical especial for a chart that supposed to represent the evolution of the tasks in the project
- When sorting all/my tasks by stage, It was possible to select any project in any quickcreate of the stages which didn't make much sense

After this commit:

The burndown chart legend is now ordered according to the stage sequence (previously was ordered randomly by comming data)
Modified the burndownChartModel, simply makes a RPC to get the stages and sequences then sort the legend elements (one by stage) with it
Display only the projects which uses the stage in the dropdown menu of the task kanban quickcreate (when grouping by stage)

When sorting by all/my tasks by stage, the quickcreate now only display the projects which contains the stage selected
done by adding a domain in the quickcreate form
(shoutout to LTU and AUON who actually found the fix)

Task-3067445

closes odoo/odoo#105694

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-07 15:31:52 +02:00
tsm-odoo d2e5969e3e [FIX] mail: indeterministic guest tour
This PR fixes the `19916` issue on the `test_mail_channel_public_page_as_guest`
test.

The messaging service subscribes to bus notifications before it is fully
initialized. This test is composed of two tours. In the first one, the guest joins
the channel and receives the "guest has joined the channel" message. Then, the second
tour starts and the local storage is cleared. Since the local storage has been cleared,
the guest receives this message again, potentially before messaging has been initialized
which leads to a `channel_pin` rpc. This RPC fails with `SessionExpired` error and the tour
is stuck and eventually, fails.

closes odoo/odoo#118000

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-07 11:37:30 +02:00
Xavier Morel 8932d447aa [FIX] core: table_kind semantics (incorrect classification of toast as temp)
17c4f47b0a updated table_kind to return
`pg_class.relkind`, however the semantics are *not* the same, and that
was ignored: `relkind = t` is for *toast* tables, not *temporary*
tables. In `pg_class` the temporary-ness is instead signaled by
`relpersistence` (which applies to both tables and sequences), temp
(and unlogged) tables have `relkind = r`. `existing_tables` does that
correctly, possibly unwittingly.

While at it, upgrade `table_kind` to return an `enum` (whose value is
the old discriminant).

closes odoo/odoo#117444

Related: odoo/enterprise#39185
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-04-07 11:37:25 +02:00
Joseph Caburnay 762aefc455 [REM] point_of_sale,pos_restaurant: remove marked up headers
Currently, the "receipt_header" and "receipt_footer" text fields of the
'pos.config' model can be used to render html in the receipt using qweb by
putting `<!DOCTYPE QWEB` as the first line of the text. In the previous
versions, it is converted to a markup so it is rendered as html in the
receipt. Rendering it as markup poses security issues therefore we are
removing this feature in this commit.

After this commit, we now only allow regular string to be added in the
receipt and footer headers.

If user wants to introduce custom markup in the headers, they can
properly do so by extending the `OrderReceipt` template from other addons.

closes odoo/odoo#117336

Task-id: 3256208
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-04-07 11:37:20 +02:00
Abderraouf Ghrissi (abgh) bd6428515a [IMP] project: Improve UX
Before this commit:
- project tasks view: when we group by company, milestone, customer,
worksheet template or any m2o field, the KanbanColumnQuickCreate is
displayed for that field, we can add a new one or apply examples,
but thoses examples are stages.
That doesn't make any sens to add them in a project or milestone context,
then if you add a new column manually or via the apply examples, it will
disappear once refreshing the page.
To summarize, stage is the only valid group by that can have the
KanbanColumnQuickCreate.

- all tasks view: same problem as the previous point + quick creating
is also not valid for group by stage as we are in all tasks context that
are linked to different project and the examples are mainly applied for a specific
project, if you try to add manually or via the examples and refresh they are going
to disappear as they are not linked to any project.

- my tasks view, same problem for previous point + quick creating when grouping
by personal stage is valid but apply examples  button is displayed to show stages and if
used, it will not add anything, so it should be hidden.

- Project Kanban examples stages are all created as not folded.
Some users don't know that 'folded in kanban' option is available on the stages,
and that tasks in a folded stage are considered as done.

After this commit:
- project tasks: KanbanColumnQuickCreate and applying examples are only available
when grouping by stage.

- all tasks: KanbanColumnQuickCreate is not available.

- my tasks: KanbanColumnQuickCreate is only available when grouping by personal stages.
applying examples is not available.

- some example stages are folded..

task-3092925

closes odoo/odoo#107633

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-07 11:37:03 +02:00
niyasraphy 5eb49e3712 [FIX] web: calendar filter not showing selection values
before this commit, in the calendar view, if there is
a field of selection field, instead of showing the
filter value, currently it is shown as undefined.

after this commit, the filter will show the selection
value instead of undefined.

closes odoo/odoo#118007

X-original-commit: edf838d791ee02f41af2bff32dc20b5657ef0d81
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-04-07 10:32:59 +02:00
flvr-odoo 3c180713fd [FIX] web: blocked pop-up warning always shows
partial revert of https://github.com/odoo/odoo/pull/117205

Since there was no link between the odoo instance and the new tab,
it was impossible to determine if it was really open and the test
afterward would always trigger

closes odoo/odoo#117973

X-original-commit: 5717eeec9eb8d5cc9cd684e6b147919d808f5db1
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
2023-04-07 10:32:57 +02:00
Soukéina Bojabza 1ef31c2822 [FIX] web_editor: fix history of a drag and drop after a resize
Steps to reproduce:
​- In a snippet in grid mode, resize a column.
- Drag and drop this column in a non-grid dropzone. 
​- Undo.
​=> The column is back in the grid but is still a normal column. The same
happens when doing these steps with a normal column to a grid. 

This happens because the class changes are not observed in these cases.
When fixing the drag and drop history in [1], only the style changes
were observed because the class changes are automatically recorded. But
it is not the case after a resize.

This commit fixes that by also observing the class changes.

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

task-3151207

closes odoo/odoo#117854

X-original-commit: 48b3683c4753f1e385ea1692db9c1a15d32cae30
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
2023-04-07 10:32:54 +02:00
Soukéina Bojabza 33dd221b45 [FIX] web_editor: fix some grid layout mistakes/oversights
This commit fixes some mistakes that were found in the code of the grid
layout option. More precisely:

- When a column was dropped near a grid dropzone (so not inside it), and
if its height was bigger than the grid, the `rowCount` attribute of the
row was not updated to the correct number of rows => there was one extra
row.

- When we start dragging a grid item, if we do not go over the starting
grid at all (it happens if the move handle is placed outside of the
row), the `rowCount` of the starting grid was never updated. This is
because the resize is done at the "out" of the dropzone so if there was
no "over", it cannot be done.
=> As a fix, the starting grid is now always resized when we drop the
column.

- When dropping a grid item inside a non-grid dropzone, its `z-index`
CSS property was not removed.

- When a grid item becomes a normal column, when dropping it in a non-
grid dropzone or when toggling the normal mode, the resize classes
(`g-col-lg-*` and `g-height-*`) were not removed from it.

- When a normal column becomes a grid item, the padding and offset
classes were not removed and the `col-` class was not systematically
synchronized with the `g-col-lg-*` class.

=> The two previous points need to be fixed because after doing multiple
drag and drops, the classes could become inconsistent. This happened
especially with columns whose width changes a lot between snippets (like
with Masonry columns, because of the padding).

- When going back to normal mode, the `--grid-item-padding-*` CSS
variables were not removed from the row.

- In commit [1], a comment that should have been modified has been
forgotten.

[1]: https://github.com/odoo/odoo/commit/67d1b078329600efce414974307d74e9fa9ba9fe

task-3151207

X-original-commit: 4afd418e1a1d4231369aab08dfa5c2d10ca9a310
Part-of: odoo/odoo#117854
2023-04-07 10:32:54 +02:00
Thomas Lefebvre (thle) 421ebc45f1 [FIX] website_sale: check selector before use it
Steps to reproduce:
- install website_sale;
- with web editor add a language selector to the top bar menu;
- go to the page '/shop/cart';
- click on the cart.

Issue:
A traceback appears.

Cause:
We use the property of a HTML element without checking its presence.

opw-3246545

closes odoo/odoo#117966

X-original-commit: e6829c38ff3fc0139583be94bf6f86c9acaab8fa
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-04-07 09:29:57 +02:00
arsi 8d48cb971a [FIX] l10n_in_edi: search rounding line in line_ids
Problem:
Indian edi doesn't take into account the round off.

Cause:
It is looking for rounding lines in `invoice_line_ids`, but since v16,
rounding lines are no more invoice lines.
`invoice_line_ids` is a subset only consisting of move lines
having a `display_type` in `('product', 'line_section', 'line_note')`
and a rounding line is a move line with a `display_type == 'rounding'`.

Fix:
Rounding lines must be searched in `line_ids` and not in
`invoice_line_ids`.

opw-3202845

closes odoo/odoo#117922

X-original-commit: a07d9683eae9c49cb8a36c6b1781c33d48eb03cb
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
Signed-off-by: Arnaud-Sibille <arsi@odoo.com>
2023-04-07 08:24:51 +02:00
FrancoisGe afbdce664f [IMP] web: remove read in kanban grouped with group_by_tooltip
This commit introduces an optimization to reduce the number of read
operations performed in kanban views that are grouped by a field with
a group_by_tooltip. Specifically, we now fetch the required values
from group_by_tooltip only when the tooltip is first opened, instead
of performing a read every time the view is loaded.

Part of Task: 3179751

closes odoo/odoo#117758

Related: odoo/enterprise#39349
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-07 07:28:09 +02:00
Yolann Sabaux b9f0758350 [FIX] account: enable edit taxt total on purchase receipt
Steps to reproduce:
- activate Purchase Receipt
- Create a Purchase Receipt

Issue:
- the edit tax total is not displayed as it is in Bill

opw-3253060

closes odoo/odoo#117980

X-original-commit: a7706ae581bcdb02fd72035ac67208cb4197a009
Signed-off-by: William André (wan) <wan@odoo.com>
2023-04-07 01:16:54 +02:00
Paolo Gatti (pgi) 6c19228fee [FIX] l10n_it: Fixing some account type in ITA CoA
A small part of the accounts type were incorrectly changed in Odoo 15 by odoo/83039
We are bringing the old type back.

Task link: https://www.odoo.com/web#id=3263687&model=project.task
task-3263687

closes odoo/odoo#117972

X-original-commit: 2cf512bc8785a73280b875cef332ac61447b9f3e
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
2023-04-06 20:13:51 +02:00
Alexandre Kühn 260e5de3df [FIX] mail: better border visual of chat window
closes odoo/odoo#117969

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-06 19:16:56 +02:00
Alexandre Kühn 104ad53516 [FIX] mail: correct orientation of self bubble in chat window
closes odoo/odoo#117965

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-06 19:16:53 +02:00
william-andre 76dcc39006 [FIX] account: delay l10n install
Since the `account` module contains a CoA and is installed before any
other `l10n_` module, the condition `and not self.env.company.chart_template`
was always preventing the installation of a foreign CoA.
By delaying until the registry is fully loaded, we will take the last
CoA declared in the installation stack.

task-3256385

closes odoo/odoo#117944

Related: odoo/enterprise#39452
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-04-06 19:16:48 +02:00
william-andre 012d6e8981 [IMP] account: dashboard performances
As the number of `account.move`, `account.move.line`,
`account.bank.statement.line` and `account.journal` is growing, the
accounting dashboard, which is the entry point of the app, gets slower
and slower.

There are multiple issues being addressed in this commit:
* The data for each journal is computed journal by journal. This means
  that the number of queries run increases linearly with the number of
  journals. While the boilerplate around running multiple queries is
  negligible compared to the running time of the queries in this case,
  some queries take as much time to run for one journal or for many.
  To improve this, all the queries are now batched. This has been done
  by refactoring the code; all these functions are now called on as many
  records as needed[^1]:
  - `_get_journal_bank_account_balance`
  - `_get_journal_outstanding_payments_account_balance`
  - `_get_last_bank_statement`
  - `get_line_graph_datas`
  - `get_bar_graph_datas`
  - `get_journal_dashboard_datas`
* The gap detection and the entries' count are computed fields
  (`has_sequence_holes` and `entries_count` respectively). We don't need
  to display/compute these fields for all types of journals, but since
  they were mentioned by using a `<field/>` node in the view, they were
  computed for all journals displayed. Instead of using the `<field/>`
  node, we are now setting the value in the `kanban_dashboard` field.
* Documents in foreign currencies on journals in foreign currencies need
  to get the rate in order to be aggregated in the journal's currency.
  There are 3 cases:
  - Document in journal's currency
  - Company's currency is the same as the journal's
  - Document, company and journal have 3 different currencies
  Before this commit, the second case will still fetch the daily rate
  for the document in order to do the conversion, but we actually
  already know the conversion; it is stored on the document.

Benchmark
=========

On a `populate` database with:
- 4 `res.company` (with accounting enabled)
- 45 `account.journal`
- 19k `account.move`
- 140k `account.move.line`
- 4k `account.bank.statement.line`
- 4 `account.bank.statement`

                            | Query count | Query time | Remaining time
--------------------------- | ----------- | ---------- | --------------
Before fix                  |         279 |     0.333s |         0.375s
After fix (without update)  |          40 |     0.120s |         0.170s
After fix (with update[^2]) |          38 |     0.100s |         0.170s

Note that the currency conversion was disabled because the populate
database doesn't represent a realistic dataset regarding this. Disabling
it only improves the numbers before the fix.

Note
====

A lot of the time remaining comes from the aggregation of
draft/unpaid invoices with the correct rate done in python instead of in
SQL. This commit doesn't change the behavior but this could be rethought
from a function point of view.

________________________________________________________________________

[^1]: the old functions have been kept for compatibility, new ones are
suffixed by `_batched` and made private if it wasn't the case.
[^2]: some optimization require the views and indexes to be updated

closes odoo/odoo#117964

X-original-commit: 0a386932d2cbcb44cf36c1830422e52b285ae990
Related: odoo/enterprise#39461
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-04-06 18:18:06 +02:00
william-andre df47db1310 [IMP] base: add format to res.currency
`res.currency` already has some utilitises like `round` or
`compare_amounts` but until now we always needed to import
`format_amount` from the tools in order to format.

This commit unifies the API.

X-original-commit: 3517a0fece96dd5d0deb02c9fd973444e748986b
Part-of: odoo/odoo#117964
2023-04-06 18:18:06 +02:00
aliya b5981bfd08 [FIX] l10n_lu: add missing translations
Recently the tax report was updated with new tax report lines, but translations weren't added.
This commit adds translations in FR, DE.

task-3264626

closes odoo/odoo#117962

X-original-commit: 35e5de512eb126bd9a4c7989c8e34c910abcd50f
Related: odoo/enterprise#39458
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Aliya Tastemirova (alta) <alta@odoo.com>
2023-04-06 18:17:57 +02:00
Yashkumar Vaishnav e64a458fcc [FIX] project: fix customer rating issue in project
Before this commit, even if customer rating is disabled from setting user can
get subscription of task rating.

This commit ensures that only when the customer rating field is enabled, the user can
get a subscription to task rating.

task-323170

closes odoo/odoo#117577

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-06 18:17:54 +02:00
Yashkumar Vaishnav 7266a546bb [FIX] project: fix broken layout in activity view
In this commit, we fixed the broken layout of task activity view.

task-3231708

closes odoo/odoo#116317

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-06 18:17:51 +02:00
Jordan D. (Joda) 0b6d88d6db [FIX] l10n_*: fix translation on accounting report
How to reproduce
================

1. Load the accounting & any of the modified l10n modules
2. Take any of the languages supported by the selected l10n module

You'll see that all the terms remain in english

opw-3114100

closes odoo/odoo#113572

X-original-commit: 13b619477977254d5cb070d716e0c07f87cb7407
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2023-04-06 18:17:49 +02:00
Christophe Simonis 924487a72d [FIX] core: correctly handle major-less upgrade scripts during major version change
closes odoo/odoo#117948

X-original-commit: c38b5baaeac28a7952601878a5b5efadf7f52984
Signed-off-by: Christophe Simonis <chs@odoo.com>
2023-04-06 17:21:00 +02:00
Bruno Boi dd9973d4df [FIX] point_of_sale: fix traceback with packagings
Happen since 29d55e44

To reproduce the error:
- Settings > Inventory > Enable "Product Packagings"
- Inventory > Configuration > Products > Product Packagings
- Create a new packaging having a barcode
- Start a Point of Sale session
- The session is not loaded and a traceback is raised

Reason:
we try to apply the find() method on an object instead of an array

After this commit, the session is loaded and the packaging is correctly
displayed

closes odoo/odoo#117947

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-04-06 17:20:57 +02:00
damr 5ad0aa5c2a [IMP] project,web_form_project : add the handling of AAL for
project_profitability + change the name displayed in portal

This commit's purpose is to
- add the computation of the AAL for the project profitabity. If a the
analytic account of a project contains AAL that were manually added (
and thus not linked to any sol/purchase/etc ) those lines are not
computed in the 'other costs/other revenues section.

- to display the title of the ticket/task/project in the name of the page My ticket/My task/My project of the portal

task-2960753

closes odoo/odoo#106438

Related: odoo/enterprise#34344
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-06 17:20:44 +02:00
smna-odoo 5f5487d266 [FIX] website: prevent traceback while deleting menu
the error will occur because when you first add the menu that's menu can not
store in the database without clicking on the save button and that id is
temporary store in string format now you delete that menu and click on save they
try to browse that menu but it is not available in the database and also it has
a string.

steps to produce this error:
1) go to the website and click on 'menu editor'
2) click on 'Add Menu Item' button
3) Add name and URL and click on the ok button.
4) now delete the newly added menu and save it.

So here we can check the id type.

sentry-3931666290

closes odoo/odoo#117937

X-original-commit: 334e13a21dee6cba44aaa4ee79827278a89ab275
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-04-06 16:12:37 +02:00
Bruno Boi 4e396aeeb3 [FIX] web: remove a window global assignation
Since 5da90dfc4 a test has been added in which
a global readonly variable from `window`
is reassigned.
Furthermore, it is the global "parent" which is
read-only and should nerver be modified.

closes odoo/odoo#117927

X-original-commit: 169a471c7d48891d3295e2b597300425fb145abc
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-04-06 16:12:26 +02:00
Joseph Caburnay e93f0f3911 [FIX] pos_mercury: error when adding vantiv payment
Since 8fb53c53c3, Order model is no longer
a backbone model therefore, we can no longer call the "trigger" method
on it. Normally, the old "trigger" call means we want to rerender the
screen and persist the new order information in the local storage.
The order object is already setup to do those mentioned (rerendering
and saving to local storage) when it's mutated. Therefore, we can just
simply remove the "order.trigger" and "this.render" calls as proposed
in this commit.

closes odoo/odoo#117915

X-original-commit: 603d73ad8f181a4e5154153cad2cbb18a493b536
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-04-06 16:12:24 +02:00
Didier (did) e208b56280 [FIX] mail: fix traceback when deleting a link preview
closes odoo/odoo#117908

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-06 16:12:21 +02:00
Aaron Bohy 5de54e14c4 [REF] web: remove unnecessary params from useModel
This commit removes the onCreate param in Kanban, as it is no
longer useful since [1]. It also removes the beforeLoadProm param
and replaces it by an onWillStart option, which is slightly cleaner
(there was no reason for this to be a model param as it is only
used by the useModel hook).

[1] 067bcac533

Part of task 3179751

closes odoo/odoo#117889

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-06 16:12:18 +02:00