Commit Graph
146958 Commits
Author SHA1 Message Date
FrancoisGe 5801ff87cf [FIX] web: MockServer search
The mockSearch function should not return the list of records for a
domain and a model but the list of ids.

The path "/web/dataset/search" does not exist.

closes odoo/odoo#80835

X-original-commit: 5f6d72e43eaec803eea76927433706dfd5e2be73
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-12-03 12:05:59 +00:00
alt-odoo fd96a99eef [FIX] google_calendar: don't delete several times the same attendee
Small side effect of commit https://github.com/odoo/odoo/commit/b19dc634684aab239575b9a9e784c7420d110b7d

When deleting old attendees, we are removing the partner id associated with the email
from the partner_ids set on the event.

As the same partner can be set on more than one event, we need to loop only once
on each attendee email, otherwise we will face the error "Record does not exist
or has been deleted."

Also, when deleting partner_ids on an event, the attendee is already automatically
removed as well in _attendees_values method, there is no need to do it manually, as
it will raise the error a second time.

opw-2694428
opw-2695915

closes odoo/odoo#80828

X-original-commit: 766a1ad50a9dbc85ed2f9083f881781b7d5ec96c
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Alex Thuyls (alt) <alt@odoo.com>
2021-12-03 11:18:53 +00:00
Samuel Degueldre 7b3b421c4d [FIX] web: rerender MainComponentsContainer on main component error
Previously, when a main component errored during rendering, we would
remove it from the list of main components that should be rendered by
the MainComponentsContainer to avoid it erroring again on a subsequent
rendering (which can cause infinite error loops).

Unfortunately, since we did not rerender the MainComponentsContainer
after this removal, the erroring main component would remain, and could
cause such error loops anyway. This commit fixes that.

closes odoo/odoo#80822

X-original-commit: 0a2fa98086dfdaa36b01ca8ef3e22b8b8ffef60c
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-12-03 09:44:04 +00:00
Merlin (megu) 711780944a [FIX] hr_expense: use contact bank account for employee expense
Steps to reproduce:
1. Install the Expenses and Contacts Apps
2. Go to the Contacts App
3. Add a bank account to the private address linked to a specific employee
4. Go to the Expenses App
5. Create an expense for the employee and try to register the payment
6. The bank account will not show up

Solution:
If the employee doesn't have a bank account selected in the Employee form, we select the first bank account of his private address

OPW-2655450

closes odoo/odoo#80774

X-original-commit: cb998c804a0e7b14393637f372f1f32051fd548d
Signed-off-by: Olivier Colson <oco@odoo.com>
2021-12-03 09:43:54 +00:00
Laurent Smet 9f8b70aa68 [FIX] account: Fix wrong filter on partner banks
closes odoo/odoo#80811

Forward-port-of: https://github.com/odoo/odoo/pull/80771
X-original-commit: bd24fbbe1d16280b014caadc5c65fddb5f10112c
Signed-off-by: Olivier Colson <oco@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2021-12-03 08:55:50 +00:00
Christophe Monniez 9e41603743 [FIX] tests: fix race condition when spawning chrome
When Chrome is spawned, the `DevToolsActivePort`file is awaited to read
the port. Sometimes the file is read but is still empty, resulting in a
ValueError when trying to cast into integer. This happens when Chrome
did not have time yet to write into file.

With this commit, we expect the file to contain at least 5 bytes which
is enough to contain the max port number.

closes odoo/odoo#80791

X-original-commit: aab53fbb4e02461e0f23cf202d393e30a73fbc92
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-12-03 08:55:46 +00:00
sofiagvaladze 3018a91eaa [FIX] hr_recruitment: correct smart button display info
It is more intuitive that application_count smartbutton has
the label 'x Other applications'.

task - 2695252

closes odoo/odoo#80551

X-original-commit: f1a2f51fec0a31b80a20c78a5b3d11561dce7164
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-12-03 08:55:43 +00:00
Florent de Labarre b88e1ee3a3 [FIX] l10n_fr: add missing line 20 for TVA EU
According to https://www.impots.gouv.fr/portail/files/formulaires/3310-ca3-sd/2018/3310-ca3-sd_2076.pdf, for TVA EU you should also add the value of the tax in the line 20.

closes odoo/odoo#80818

X-original-commit: 8406e25ff20224f9d169233d39d2cdf6f85c5507
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Olivier Colson <oco@odoo.com>
2021-12-03 08:11:50 +00:00
Martin Trigaux b50a705d04 [FIX] base: ensure all attachments are in sudo
>>> u1 = self.sudo(False).browse(1)
>>> u2 = self.sudo().browse(2)
>>> (u1 + u2).env.su
False
>>> (u2 + u1).env.su
True

Ensure all attachments are always in sudo

Before this commit, a portal user could not go in debug asset

Introduced at 3a98996eed

closes odoo/odoo#80807

X-original-commit: 9f0ce611b2acf5927a7703a7811081c4adbc3f41
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-03 07:27:40 +00:00
Martin Trigaux 8519df849e [FIX] website_sale: allow public user to print cart
When the public user is connected, allow him to print the report of
the open cart.
Since 61b4b6777d64 the sudo is not enough but with_user(1) is
required.

closes odoo/odoo#80803

X-original-commit: a4021965f1f049c69186e1f2acbc55ae59ee8730
Signed-off-by: Olivier Dony <odo@odoo.com>
2021-12-02 18:40:13 +00:00
Younn Olivier cfdb6d04a0 [FIX] web_editor: focus url input on double click on link
This commit focuses the url input from the link tools when double
clicking on the link.
It introduces a focusUrl public method on the Link widget, triggered
from the SnippetsMenu after activating a snippet, if the link tools are
shown.

task-2680461

closes odoo/odoo#80796

X-original-commit: add3e05840869d4a885ca18a2bbabfcb61c7a83d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-12-02 17:44:22 +00:00
Laurent Stukkens (LTU) e89eff40bb [FIX] project: prevent archived assignees from not being visible
Prior to this fix:

    - Archived users are no more shown in the assignees

After this commit:

    - All users, including archived ones will be shown in the assignees.

task-2703358

closes odoo/odoo#80783

X-original-commit: d6092e318e04619313851276865b333afd264aad
Related: odoo/enterprise#22689
Signed-off-by: Xavier <xbo@odoo.com>
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-12-02 16:49:51 +00:00
Adrien Widart 896e40fa62 [FIX] web: report action: define trusted_host thanks to current URL
To reproduce the issue:
(Need stock. Use demo data)
1. Login as admin
2. Go again on the DB, but using another URL
3. Login as demo
4. Consult the Forecasted Report of [FURN_7800] Desk Combination
5. Try to open "WH/OUT/00009"

Error: Nothing happens although the page should be redirected to the
order. In the browser console, an error message is displayed: "Failed to
execute 'postMessage' on 'DOMWindow': The target origin provided
('http://localhost:8069') does not match the recipient window's origin
('http://yourcompany.com:8069')."

When logging in as admin, the config parameter `web.base.url` is defined
with the URL used (URL01):
https://github.com/odoo/odoo/blob/4736344a57e176ed38f4b22cd100b3957d122818/odoo/addons/base/models/res_users.py#L717-L724

Then, when logging in as demo with another URL (URL02), since he's not
an administrator, the config parameter is not overwritten.
So, when clicking on the delivery order (step 5), an action is executed:
https://github.com/odoo/odoo/blob/b492bde6a121be1c15ed90ce0827fcfd72a12f5c/addons/web/static/src/js/report/report.js#L37-L41
where `trusted_origin` is based on `web.base.url`:
https://github.com/odoo/odoo/blob/2dbe39aed5361341cdc87607e671ef19234e0196/odoo/addons/base/models/ir_actions_report.py#L580
This explains why `trusted_origin` is URL01 and thus why the error is
raised.

Also, suppose `trusted_origin` has a correct value (URL02), there is
another issue: when the client action receives the message, a condition
will ensure that the message origin and the origin of the action are the
same:
https://github.com/odoo/odoo/blob/d3854dbf7a6e0c0f9ac00c11716908bc175808d7/addons/web/static/src/js/report/client_action.js#L73-L76
Here, `this.trusted_origin` is also URL01 because of
https://github.com/odoo/odoo/blob/62f2a62b7265645dee91c276c5171b402c0a44fa/addons/web/models/ir_http.py#L48
So this variable definition needs to be updated too.

OPW-2615024

closes odoo/odoo#80777

X-original-commit: f8ac33bcbc472d55917a1597afdd444f815d4778
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-12-02 16:04:02 +00:00
Joseph Caburnay ce6df4145a [FIX] l10n_fr_pos_cert: should prevent order from being deleted
A bug was introduced in FR localization after the implementation of
refund feature in point_of_sale module, that is, any order can now
be deleted. However, we don't want this in the localization.

This fix restores the error message that prevents the deletion of
of any order made under the FR localization. However, this time,
instead of only preventing the current order to be deleted, we
keep every order with orderlines from being deleted.

closes odoo/odoo#80773

X-original-commit: 30b48094fb59f564b923e34a3df379f8ff0610de
Signed-off-by: Masereel Pierre <pim@odoo.com>
2021-12-02 15:16:42 +00:00
Younn Olivier 5a5f3da58b [FIX] web_editor, website: fix existing links edition via link tools
Before this commit, there was an issue with the edition of links that
were already in the page, via the link tools.
1/ In edit mode, drag and drop the s_image_text snippet and save,
2/ Click on edit, click on the "learn more" button,
3/ From the link tools, change the style to secondary,
4/ Click on save again, the button is still styled with as primary.

[1] added a history step to the link creation via the link tools. As the
editor observer is set to unactive at the start of the link tools, the
changes made to the link with the link tools were not processed by the
EditPageMenu observer, and the block was not set as .o_dirty (the
changes were therefore not saved).

This bug was hidden by our use of bootstrap popovers. The
aria-describedby attribute, managed by bootstrap when showing/hiding a
popover, would be recorded as a change from the EditPageMenu observer,
which would set the view as dirty.
Also, changing any other element of the page would set the page as dirty
and hide the bug.

It only became visible when [2] changed the popover initialization from
'focus' to 'manual'. With that, the aria-describedby attribute was
modified inbetween the LinkTools.start and LinkTools.destroy (and was
therefore not recorded at the EditPageMenu level).

To record correctly the changes made from the link tools to the link, we
activate the editor observer when applying the changes to the DOM.

This commit also introduces some tests for the link tools.
The listener on customizable links from the wysiwyg was changed from
mousedown to click for simpler tests.

task-2680461

[1]: 6db6134f97
[2]: 161c5fc8e742294e8d85c889b4bf8d3d8cd484f5

closes odoo/odoo#80763

X-original-commit: c29fe9fa8fc8ff4a5e6f042607ef9b3070d1d339
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-12-02 15:16:34 +00:00
Nicolas Bayet 7a0e58f8d7 [FIX] web_editor: prevent setting modified link label
When editing the link label from a website page, and then changing its
url from the link tools, the label was reset to what it was before the
edition. This commit fixes it by keeping the label consistent when
changing the link options from the link tools.

task-2680461

X-original-commit: 5f5b9dfa1bdfb6c814e68e355503a8820bb8b452
Part-of: odoo/odoo#80763
2021-12-02 15:16:34 +00:00
Younn Olivier 2a70b21af3 [FIX] web_editor: display drop zones only on dropdowns when shown
It was painful to add an inline snippets, or move elements inside mega
menus. The dropdowns are now behaving as modals: if they are shown, the
user can only add or move snippets inside them, but not outside.

task-2668908

closes odoo/odoo#80757

X-original-commit: edc5c8d69fb5fc6da0b0012abc6539c21ffc421e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-12-02 13:43:26 +00:00
Nicolas (vin) a4061afe0d [FIX] account_fleet: Improve performances
Performances issues have been noticed in account_fleet when computing
the move_ids of vehicles.
This change has been made in order to fix this issue.

Task id #2700407

closes odoo/odoo#80755

X-original-commit: 2860051b3cbfa7bcd7df76d05b4e5770e9a4c2d0
Signed-off-by: William André (wan) <wan@odoo.com>
2021-12-02 13:43:19 +00:00
Vincent Larcin d832a04c68 [FIX] rating: fix chatter rating image alt description
When a rating is posted in the chatter, the alt text for the image is displayed as a score out of 10.
However, the maximum score a rating can have is 5.

This commit changes the alt text to display a score out of 5 instead.

closes odoo/odoo#80753

X-original-commit: 42848c6c3d17de59adb85bf6622f629809cb37c4
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-12-02 13:43:14 +00:00
Odoo's MergebotandVictor Feyens vfe@odoo.com 210c9daebc [MERGE] sale: Convert onchanges into compute + improve perfs
Purpose
=======

This is the first step of a technical cleaning of the sales
application. The final goal is to reduce the technical debt
and improve the performances / readability of the related
applications.

Some complex onchange methods containing purely business code
are defined, and called manually wherever the modifications
should be applied. This is a bad practice as there could be
a different business logic when making the same flow in the
interface or with python code.

Since #80449, it is now possible to add the precompute attribute on
stored computed fields to compute them before the insertion into the
database.

The idea is to convert this business code into compute methods to
apply it every time this is needed.

This is quite useful in our case in the sales application, as some of
the computed fields are required, and request some hacky overrides:
- in the create method, to simulate the onchange on new records, and
  to update the values dictionary
- in the default_get method, to set a default value, which has to
  side effect to prevent the field to be recomputed afterwards, which
  could also lead to inconsistencies.

This made impossible to convert the onchange methods into compute
methods.

Now, that is possible to precompute the fields before the database
insertion, it is now possible to remove all this crappy overhead,
to benefit from the batch method definitions, and to avoid creating
fake records to simulate the values that we should have computed
before.

On the other hand, this is the occasion to write some methods
(create, ...) in batch, to remove some dead code, to simplify
the api, to reorganize the code using our coding guidelines.

Results
======

The benefit of calling the computes in batch doesn't only bring
functional consistencies, it also allow to improve the performances
without changing any existing features.

For example, let's have a look at the execution time and queries to
generate 1000 sales orders with 10 products lines each + 1 section
line, for 1000 different customers and shared between 2 salesmen.

We consider the "batch" time, aka the time to call the "create" method,
the flush time and the number of SQL queries.

In master:
    BATCH: 121.97 seconds
    FLUSH: 24.05 seconds
    # queries: 53103

Now:
    BATCH: 113.07 seconds
    FLUSH: 1.22 seconds
    # queries 22057

This means a reduction of:
- 7.2% for the batch time
- 95% of the flush time
- 21.7% for the total time
- 58.5% for the number of SQL queries

Note that the effect of the precompute, the onchange methods
conversions, and the optimizations on this PR are emphasized
when the sales orders are related to the same partners.

If we take a look at the flamegraphs when creating 100 sales orders
of 3 lines each, we directly spot that the methods are now called once,
which also justify the large decrease of execution time and SQL queries.

Master:
![Screenshot from 2021-12-01 10-23-27](https://user-images.githubusercontent.com/8435879/144207460-5af36354-5ab6-4f83-846b-be71ab38ccc0.png)

Now:
![precompute](https://user-images.githubusercontent.com/8435879/144198634-1c32d9c9-0cf1-4011-a32f-b1edd7034d37.png)

closes odoo/odoo#79093

Taskid: 2679099
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Victor Feyens vfe@odoo.com
2021-12-02 14:43:07 +01:00
Denis Ledoux 89df4b5faa [FIX] payment_ogone: better error reason when payment is declined
Before this revision, when a payment was declined,
for instance because the authorization is declined by the bank,
or the credit card amount limit is exceeded,
the error was marked as
"Received data with invalid payment status: 2"
which is not very meaningful for the users.

This revision aims to set the reason why the payment
was declined with the meaningful error from ogone.

closes odoo/odoo#80742

X-original-commit: 758f94a173379ba7bd22813b2050e3a6f98210a9
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2021-12-02 12:55:38 +00:00
Yannick Tivisse 45eb2f869f [IMP] sale_stock: Update SO batch creation query counter 2021-12-02 12:12:04 +01:00
Victor Feyens 6e122d8ccb [IMP] sale: currency rate computation performance
* should not be triggered when pricelist is changed, only if currency is
modified
* cache results to reduce sql queries
2021-12-02 12:12:04 +01:00
Victor Feyens 31c3894b80 [REV] sale: do not precompute fields depending on x2m
and do not force precomputation on side models, it would reduce their performance.
2021-12-02 12:12:04 +01:00
Victor Feyens f36334d97a [IMP] sale: onchange tests can now be triggered post_install 2021-12-02 12:12:04 +01:00
Victor Feyens 69dc4bba42 [IMP] core,sale: enforce batch creation support for sale order (lines) 2021-12-02 12:12:04 +01:00
Victor Feyens b8a0fe79f4 [IMP] sale: remove fpos fallback in SOL compute 2021-12-02 12:12:04 +01:00
Victor Feyens c574c76bc1 [FIX] sale: sale.order.line population
product template model is not a populate dependency of sale, do not try 
to fetch the ids of templates if the model wasn't populated.
2021-12-02 12:12:04 +01:00
Yannick Tivisse 2541fe2067 [IMP] sale: Use a cache to avoid computing several time the same sales team 2021-12-02 12:12:04 +01:00
Yannick Tivisse 79dedf5024 [IMP] sale: Don't fetch fiscal position if nothing to map 2021-12-02 12:12:04 +01:00
Yannick Tivisse 0f2edc94bf [IMP] sale: Use a cache to compute fiscal positions 2021-12-02 12:12:03 +01:00
Yannick Tivisse 9d8b88e86d [FIX] sale_timesheet: Avoid pricelist side effect with other modules 2021-12-02 12:12:03 +01:00
Yannick Tivisse 232d66069a [IMP] sale: Make some field precomputed 2021-12-02 12:12:03 +01:00
Yannick Tivisse 48401aa9a0 [IMP] sale: Convert _onchange_partner_shipping_id into computed field 2021-12-02 12:12:03 +01:00
Yannick Tivisse 5863070066 [IMP] sale: Remove useless SO line values on creation
Purpose
=======

Those are now the default values that are computed from the field
definition.
2021-12-02 12:12:03 +01:00
Yannick Tivisse 5914f5fe24 [FIX] sale_stock: Retrieve default warehouse according to SO company 2021-12-02 12:12:03 +01:00
Yannick Tivisse 28b66bad31 [FIX] sale: Erase product attributes values if no product on SOL 2021-12-02 12:12:03 +01:00
Yannick Tivisse 795aa94cef [IMP] sale: Make several fields pre_compute=True to avoid double computations 2021-12-02 12:12:03 +01:00
Yannick Tivisse 3c07a3fecd [IMP] sale: Apply misc styling improvements + remove dead context keys 2021-12-02 12:12:03 +01:00
Yannick Tivisse 280cf015e1 [IMP] sale: Use compute method for notes + translate field in default value 2021-12-02 12:12:03 +01:00
Victor Feyens 9a1e398702 [IMP] sale_stock: remove unnecessary create override
managed by a compute method now
2021-12-02 12:12:03 +01:00
Victor Feyens da35c78dd8 [IMP] sale: rely on related fields instead of taking them from the order 2021-12-02 12:12:03 +01:00
Victor Feyens 096e8a3b95 [FIX] sale: do not recomputed price_unit on partner change 2021-12-02 12:12:03 +01:00
Victor Feyens 47f6416d8c [IMP] sale: test improvements
* Verify the pre-compute logic, from the SO side (recurisvely) and from 
the SOL side.
2021-12-02 12:12:03 +01:00
Victor Feyens 2905c565d2 [FIX] sale: avoid defaults on compute stored fields
Leave the computation fully to the compute method, to avoid side-effects 
and wrong values in db.
2021-12-02 12:12:03 +01:00
Victor Feyens d9f9826b93 [FIX] sale(_stock): do not override customer_lead compute with default 2021-12-02 12:12:03 +01:00
Victor Feyens bc945ef3f2 [FIX] sale: remove wrong default qty on lines
Compute was never called because of the compute, which lead to wrong
values (raising due to the SQL constraints).

Integrate the default in the compute directly.
2021-12-02 12:12:03 +01:00
Victor Feyens 886d6093f1 [IMP] sale: remove default for fully computed fields
Will be triggered and returned by default_get calls for nothing
2021-12-02 12:12:03 +01:00
Victor Feyens 3314036f71 [IMP] sale: pre-compute stored related fields 2021-12-02 12:12:03 +01:00
Victor Feyens 52a0f2cc6a [IMP] sale: keep only onchange tests in test_onchange file 2021-12-02 12:12:03 +01:00