Commit Graph
146942 Commits
Author SHA1 Message Date
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
Victor Feyens 31d10b862d [IMP] event_sale: convert onchanges to compute
+ review comments
2021-12-02 12:12:03 +01:00
Victor Feyens 302ad13b3d [IMP] sale,account: follow same pattern for all compute methods 2021-12-02 12:12:03 +01:00
Victor Feyens 1d3b9f6be6 [IMP] sale: minor perf improvement & cleanup 2021-12-02 12:12:02 +01:00
Victor Feyens 1d854b0bb6 [IMP] sale: correctly consider display_type in SOL computes 2021-12-02 12:12:02 +01:00
Victor Feyens 2de16205d2 [IMP] sale: clean date(time) conversions
* remove conversions from & to strings, odoo manages date(times)
natively
* clean imports
2021-12-02 12:12:02 +01:00
Victor Feyens 54fa80c24f [FIX][IMP] sale_*: clean customer_lead code
* remove useless hook _get_customer_lead, since the field is now 
computed
* Add inverse to properly modify existing stock moves when the customer 
delay is modified
2021-12-02 12:12:02 +01:00
Yannick Tivisse d7907ae07d [FIX] sale_timesheet: Avoid recomputing price_unit 2021-12-02 12:12:02 +01:00
Yannick Tivisse de4911aceb [IMP] sale: Remove qty_delivered_manual field
This field is useless since the new compute method from 13.0.

And also introduces side effect / loop recomputations.
2021-12-02 12:12:02 +01:00
Yannick Tivisse fecff7119f [IMP] sale: Don't recompute taxes on tax configuration change
This should be done manually
2021-12-02 12:12:02 +01:00
Yannick Tivisse 01557bf36e [FIX] sale: Split _compute_order_info_from_partner into several methods 2021-12-02 12:12:02 +01:00
Yannick Tivisse 052b15e823 [IMP] sale: Convert _change_sale_ok into compute method 2021-12-02 12:12:02 +01:00
Yannick Tivisse 728cb1b15f [IMP] sale: Remove useless pre-precessing on SOL creation
This is not needed anymore since the last ORM changes from this PR
with the pre_compute attribute.
2021-12-02 12:12:02 +01:00
Yannick Tivisse 1003ef0e70 [IMP] sale: Convert _onchange_discount into compute method 2021-12-02 12:12:02 +01:00
Yannick Tivisse 916e92aa30 [FIX] sale: Split product_id_change into several compute methods 2021-12-02 12:12:02 +01:00
Yannick Tivisse 8a6093c612 [FIX] sale: Add misc missing computation triggers 2021-12-02 12:12:02 +01:00
Yannick Tivisse b16b3e32f7 [IMP] sale: Convert _onchange_product_packaging_qty into compute method 2021-12-02 12:12:02 +01:00