Commit Graph
143258 Commits
Author SHA1 Message Date
Aurélien (avd) ca478f03ce [FIX] purchase_stock: improve partner._compute_on_time_rate perfs
Improve res.patner._compute_on_time_rate performances by calling
mapped('quantity_done') once on all the order_lines.move_ids.

Moving it out of the for loop allows to befinit from the performance
gains of the read_group call in stock.move._quantity_done_compute.

closes odoo/odoo#72422

X-original-commit: 2841525a3a2f1273783874947884b57494def849
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-06-21 11:00:02 +00:00
Thibault Delavallée 49f95a9a00 [FW][FIX] mail: correctly avoid increasing bounced counter two times
When a bounce has to be managed on a record already inheriting from blacklist
mixin it shoudl not be counted two times: one for email-based bounce and one
for "all records using that email linked to blacklist mechanism should
bounce".

A mechanism exists to prevent that double increase but it was not correctly
done. Protection was reset in a loop.

Task ID-2547347
PR odoo/odoo#72347

closes odoo/odoo#72420

X-original-commit: 6e1bca5df19392d384d7c398b7aea66b62381938
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-06-21 10:57:12 +00:00
Jairo Llopis fd2ca5d8ec [FW][IMP] mail: allow to remove plus addressing from bounce return addresses
Since odoo/odoo@f4524f03c3 plus addressing is not used anymore
for handling bounces. Indeed it relies on references / in reply to to find
original message that bounced. It is therefore not necessary to enforce the
use of plus addressing.

As some provider do not support plus addressing as a way to contact left-part
of email with sub-informations people should have a way to deactivate plus
addressing used in bounce aliases.

To preserve backwards compatibility for stable versions old behavior is
retained unless a new `mail.bounce.alias.static` ICP is set with a truthy
value.

Fix https://github.com/odoo/odoo/issues/71242 by dropping requirement of plus addressing.

@Tecnativa TT29827
Closes #71242
Task ID-2547347
PR odoo/odoo#72347

X-original-commit: df2d955bf41b01556e1b84bb1204aac045c95a63
2021-06-21 10:57:11 +00:00
Benjamin Frantzen (bfr) 8790df40cb [IMP] account_edi_facturx: import shipping partner
When importing a facturx file, the shipping_partner_id on account.move is now processed if it's present in the xml.

closes odoo/odoo#72417

X-original-commit: 69c76c70c354ddefc807ebeb441a4c2d81ea2497
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
2021-06-21 10:38:31 +00:00
Ivan Yelizariev 9d34c72b2c [IMP] stock: clean up and speed up lock acquiring
It makes code more readable, doesn't use savepoing and use just a single query
to acquire the lock

closes odoo/odoo#72338

Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-06-18 11:31:01 +00:00
Thibault Delavallée 6a1cda64f8 [IMP] crm: remove duplicated field activity_deadline_my
Next to the addition of a generic field adding a compute to find
my next activity deadline there is no need to keep a custom field
on crm.lead model.

Task ID-2438822
COM PR odoo/odoo#72219

Related: odoo/upgrade#2566
Related: odoo/enterprise#19044
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-06-21 08:53:35 +00:00
bit-odoo 800f9c499a [FW][FIX] mail, various: show only my activities shown through systray
Before this commit, suppose we have a scenario like below

  Task-A:
    Activity-1:
      name: Email ( Today )
      Assigned to: User-1
  Task-B:
    Activity-1:
      name: Email ( Today )
      assigned to: User-2
    Activity-2:
      name: Call ( Due in 3 Days )
      assigned to: User-1

When User-1 goes through the systray 'Today' filter shortcut he gets both
Task-A and Task-B in the list instead of only Task-A. Indeed currently
activities are not filtered based on current user with its deadlines.

However purpose of systray is to indicate activities current user has to
perform instead of global activities.

After this commit activities will be filtered based on deadlines as well as the
current user. In order to achieve this behavior we needed to pass a domain like
[
   ('activity_ids.date_deadline','=', fields.Date.today()),
   ('activity_ids.user_id','=', 1)
]

And for that purpose we introduced a non-stored compute field with a search
method.

Task ID-2438822
COM PR odoo/odoo#72219

X-original-commit: f4eaf4d8fb2f97240201104dcd4fc7e2674bce02
2021-06-21 07:51:00 +00:00
Christophe Monniez 6a97f4a013 [FIX] web: fix clickEverywhere test
With the rewrite of the webclient in OWL 29731b404f, the load_menus
method now returns all menus instead of the root menu.

This commit adapts the click_everywhere tests to the change.

closes odoo/odoo#72405

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-21 08:38:17 +00:00
Achraf (abz) 1ca2dcc233 [FIX] web: Prevent quick create from closing after text selection
There is a function allowing to close the quick create if we click outside the element.

`RecordQuickCreate._onWindowClicked`

Except that this function is triggered in a "click" event, so if we click on the quick create element and drag the mouse outside, it will detect that we are outside and close the quick create.
This manipulation can happen when you want to select text with the mouse.

This PR prevents this behavior by detecting when a click is from the quick create

opw-2558932

closes odoo/odoo#72279

X-original-commit: 75538bf2a36aa91df8b183ac21ae99a174e1c2fa
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2021-06-21 08:32:14 +00:00
Ivan Yelizariev 52e06bc615 [REM] account: remove unexisted attribute "reason"
There is no reason to have attribute reason.

Also, fix domain notation.

What the hell is going on this line of code???

closes odoo/odoo#72400

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-06-21 08:13:09 +00:00
Djamel (otd) 95f513aab5 [FIX] sale: re-invoicing of multiple orders
Steps to reproduce the bug:
- Go to sales app > create two SO with different price lists
- Go to expense app > create a new expense
- Add two expense lines related to the two SO
- Click on the “Submit to Manager” button
- Approve the expense
- Click on “Post journal entries”
- An error is triggered

Problem:
We call the onchange_discount on all SO lines together in the “_sale_create_reinvoice_sale_line function”, while it should be called on each created line separately.

Bug introduced by this commit : https://github.com/odoo/odoo/commit/8815f4d9ab8620428d50abbe603c7f6c63076d6c

opw-2571247

closes odoo/odoo#72381

X-original-commit: 3cc4b573e95880d8f55692e986c159b7a8dc8b8d
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
2021-06-18 17:34:26 +00:00
Florent de Labarre 4a66f8059b [FIX] uom : hard to edit factor
In some screen it is very hard to edit the factor.

closes odoo/odoo#72309

X-original-commit: 2e2e588ec5bc1563312415eda75947d10902f060
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-06-17 15:44:06 +00:00
Michael Mattiello (mcm) 7b0193279a [FIX] web: add fields in right order in calendar
Before this commit, fields in calendar popover were added
to the $fieldsList after they were appended but appending
is async and so fields could be disordered.

Now, we add fields before the append to have the right order.

closes odoo/odoo#72262

X-original-commit: da1b85d2fdff85bee35d183a8ee4faa0897dc1b4
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
2021-06-21 06:36:39 +00:00
Sébastien Geelen (sge) 92aac327e9 [FIX] web_editor: various fixes and improvements for the commandbar
See oddo task : https://www.odoo.com/web#id=2522564&action=333&active_id=1695&model=project.task&view_type=form&cids=1&menu_id=4720

closes odoo/odoo#72365

X-original-commit: 7137e97c2409306a5351aed5c70b67f4766ea86a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-06-18 15:20:18 +00:00
Sébastien Geelen (sge) 6308964ba7 [IMP] web_editor: update odoo-editor lib to commit 5fea955f
X-original-commit: 2b0bfd4152db6b20631b0c99c0288197485bebb1
2021-06-18 15:20:16 +00:00
Philémon van Helden e6727f2286 [FIX] base_vat: properly checks NL VAT numbers
In 12.0+ when adding an NL VAT number on a contact without specifying the country as Netherlands, an error shows the VAT number as not valid. This is because the method to check specifically NL VAT numbers requires the complete VAT number with country code, when the country code isn't always provided.

With this commit, we allow the check_vat_nl method to take the NL VAT number as argument, with or without the country code.

opw-2536261

closes odoo/odoo#72382

X-original-commit: 75cfe3f484bd56723b182def09141d929a3169a1
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: pvh-odoo <SwagSamaSempai@users.noreply.github.com>
2021-06-18 17:44:00 +00:00
+3 29731b404f [MERGE] *: rewrite the webclient in OWL (phase 1)
This commit is the first phase of the conversion of the web/ JS codebase to the owl framework. The
impact of this commit is two-fold.

First, it rewrites the framework part of web with a new system of services and registries. Services allow to
execute code (e.g. do rpcs, setup things) before launching the application. They can also expose an API to
be used by other parts of the application (e.g. a `notification` service would expose a function to display
notifications). Services are often a good extension point for external modules that want to execute code at
webclient startup. Registries offer another way to extend the application. They provide well designed
extension points to add elements/behaviors from the outside (for instance, to add a systray item,
an error handler...).

Second, this commit initiates the conversion of the webclient to owl with a top-down approach, around those
notions of services and registries. The root of the web application is now an owl application. Among others,
the WebClient, ActionManager, Navbar, UserMenu, DebugManager, Dialogs, services (e.g. notification, ajax...)
have been converted to the new framework/architecture.

Legacy views and client actions are still supported (and used). They will be converted in the next months,
and at some point, the support will be dropped.

The code in other addons (e.g. including the legacy WebClient, ActionManager...) has been adapted
to fit with the new implementation.

This commit also does a general design improvement pass.

Task 2344639
Enterprise PR https://github.com/odoo/enterprise/pull/13444

closes odoo/odoo#58287

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: stefanorigano (SRI) <sri@odoo.com>
2021-06-18 23:08:04 +02:00
Lucas Perais (lpe) cc9d05e4ce [FIX] web: http_service: 502 errors should be handled as connection lost
Run Odoo behind nginx, load odoo, kill the server, and trigger the http service to make a request

Before this commit it, the error code 502 was not handled

After this commit, it is handled as if the server was unreachable altogether
2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 09e51c8809 [FIX] web_tour: dialog closes when a tour is launched
Be in debug=tests. Go on a Form View for res_partner. Go in the debug menu => start tour
start the tour "mail/static/tests/tours/mail_full_composer_test_tour.js"

Before this commit, the start tour dialog is not closed

After this commit, the dialog is closed
2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 5c572b2783 [FIX] web: error_utils: fallback when stacktrace is not loadable
After loading Odoo, go offline, and trigger a RPC

Before this commit, the lazy loaded asset of stacktrace.js crashed in a loop

After this commit, when stacktrace.js is not available, we fallback on our error formatter
2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 0195d8e7b4 [FIX] web: view_service: store the Promise in cache, not its result
Before this commit, the result of the load_views was put in the cache, so a load_views could have been
triggered multiple times before the first of them returned

After this commit, the cahce works as expected and stores the whole Promise
We always delete from the cache Promises that are rejected (to let the user re-do it in the hope the situatuion has changed)
2021-06-18 21:31:34 +02:00
Géry Debongnie 4e308bfdab [IMP] web: properly handle errors in action controllers
Before this commit, an error in the rendering of a client action or view
would not be properly cleaned: the action container did not catch any
error, so owl would destroy the UI.

With this commit, we simply catch the error, and empty the content of
the action container.
2021-06-18 21:31:34 +02:00
Géry Debongnie 21622ce515 [IMP] web: update owl from 1.3.1 to 1.3.2
This update contains a fix about owl error handling.

Release notes: https://github.com/odoo/owl/releases/tag/v1.3.2
2021-06-18 21:31:34 +02:00
Géry Debongnie 7ca9a2012b [IMP] web: introduce errorhandler and notupdatable component
This commit adds two utility components:

- NotUpdatable: a component meant to be used when a component does not
  depend on anything from its parent, so it should not be rerendered
  whenever the parent is updated.  This is an optimization.
- ErrorHandler: a component that provides a nice way to catch errors
  in the rendering for a sub component
2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 76c395d7db [FIX] web: tests: deduplicate qunit asserts
Before this commit, two versions of each custom QUnit assertion function
existed. No only one exists: the brand new one from WOWL
2021-06-18 21:31:34 +02:00
Géry Debongnie 97c88e8c06 [IMP] web: add shouldUpdate=false to some components
We add in this commit a "decorator" to make components that do not
rerender when their parent is updating them. This makes sense for some
main components that knows before hand that they do not depend on a
props change.

This commit is mostly an optimization to avoid useless work by owl, but
it also has some interesting properties: before this commit, each
dialogs would be rerendered whenever a new dialog is added. This could
be an issue if the rendering of one of them causes an error, which needs
in turn to add a dialog, ...

closes odoo-dev/odoo#970

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:34 +02:00
Francois (fge) ea0a718fb4 [FIX] web: add the missing views in legacy_views
Before this commit, the switch from a multiple view (list, kanban, ...)
to a custom form view was not correctly done. The form view displayed
was not the custom version but the default one.

This problem is caused by the filter applied on viewSwitcherEntries
which removes the form views because they are not a multiple view.

To solve this problem, we will add the missing form view in the
actions.views given to the legacy view.

closes odoo-dev/odoo#958

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:34 +02:00
Samuel Degueldre 2e35ba0260 [FIX] web: wait a microtick before starting services
That way, we ensure that all synchronously defined services are
added to the registry, i.e. if a service depends on another one,
its dependency is present, regardless the order they are added to
the registry.

Closes odoo-dev/odoo#967

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:34 +02:00
Aaron Bohy 8b057a7671 [REF] web: move setup_tests to env_tests
To better reflect the prod file structure in the tests.
2021-06-18 21:31:34 +02:00
Michael Mattiello (mcm) aa819f892d [REF] web: change effect service API
Before this commit, effect service provided two functions:
  create(type, params)
  rainbowMan(params)

Now, it provides one function add which is create but renamed
rainbowMan function can be called by doing:
  service.add("rainbowman", ...);

closes odoo-dev/odoo#969

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:34 +02:00
Géry Debongnie 8d8201a8e0 [REF] web: small refactoring of dialog service
- move dialog state handling in dialog service
- remove use of __destroy calls in dialog container

closes odoo-dev/odoo#964

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 8e384a7569 [FIX] web: confirmation_dialog: confirm callback optional
This commit makes the confirm callback optional in ConfirmationDialog
It also adds an AlertDialog which can warn the user by simply passing some body text
2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 7c1a93652f [FIX] hr_timesheet: before/after => beforeEach/afterEach
QUnit's before and after hooks should not be used as they are triggered at the end of a QUnit's module
So that tests within that module would have side effects on one another

This commit changes those hooks to use beforeEach/afterEach so that each test has its own execution environment.
2021-06-18 21:31:34 +02:00
Francois (fge) 2d1316bfe6 [FIX] web: residual rename create to add 2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 0cecc93aa4 [FIX] web: legacy dialog: select only one o_dialog_container to append in
Before this commit, when a test had multiple o_dialog_container elements (the one where we put the
actual modal), a legacy dialog was appended multiple times in the DOM messing around with the test

After this commit, we force dialogs to append once by selecting the first container it finds
2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 80dec11b15 [FIX] web: mockServer: push a mock view name in fieldviewGet
In the new mockServer, we add a name to a view (field name on ir.ui.view) when the found view in `fieldsViewGet`
has an id.

In tests data, one would normally specify default views like

```js
views = {
  "partner,false,form": `<form></form>`,
}

```
In this case and from the point of view of the business code, the view doesn't really exist in DB

On the contrary, if a developer writes, in a test:

```js
views = {
  "partner,999,form": `<form></form>`,
}

```
The returned view from load_views will return that view with ID 999 and, from the business code standpoint, the view would exist
in DB. This is particularly important in studio when it has to fetch a x2m view when none has been inlined in the main view.
2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 832ce8d1f9 [FIX] web, mail: test helpers: fix legacy interactions
The new execution environment of wowl tests has to take into account that legacy objects
can be spawned below it and around it, in particular in mail tests where mail has to create
an owl environment with the right keys.

This commit aims at making this work namely by being to pass an already formed legacyEnv
to the createWebClient helper
2021-06-18 21:31:34 +02:00
Lucas Perais (lpe) 7691354132 [FIX] web: notification: message can be the return of the _lt function
Before this commit, the props `message` given to a notification was defined as being a String
This is unsufficient as the lazy translate function (_lt) is not technically a String but must be
considered as such.

After this commit, notifications support a lazy translated string as message props
2021-06-18 21:31:34 +02:00
Francois (fge) 2aca56f0f0 [FIX] web: doAction supports controllerState passed in option
In legacy, doAction can be passed the `controllerState` key, which contains `searchModel`
and `searchPanel`, that an AbstractController can export.

This commit re-implements this in the action service.
2021-06-18 21:31:33 +02:00
Samuel Degueldre 8a888bca8a [REF] web: move crash manager to frontend only
Previously, we removed the crash manager and moved its responsibilities
to the error service.

Because the crash manager was used in both the frontend and backend, and
because the infrastructure code required to use the error service in the
frontend hasn't been written yet, the crash manager has been moved to
the frontend assets where it is still needed in the interim. Most of the
logic of the crash manager has been moved to public_crash_manager (as it
is now the only crash manager and it doesn't make sense to keep the
inheritance hierarchy).

References to the crash manager in the backend were adapted where needed
or removed where they were no longer useful.

closes odoo-dev/odoo#943

Related: odoo-dev/enterprise#174
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:33 +02:00
Géry Debongnie c37e5efa48 [REF] web: reorganize popover service
This commit improves the popover service in two ways:

- it moves the popover state and handling into the service itself
- it removes the use of private functions such as __destroy

closes odoo-dev/odoo#961

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:33 +02:00
Mathieu Duckerts-Antoine d4070495d6 [FIX] web: traceback when assets loading fails
Before this commit, if the loading of a js or a css asset would fail
(via useAssets), a traceback with an incorrect message would appear.
This was due to the fact that a promise was rejected with an event as
parameter. We correct this by rejecting the promise with a custom error.

closes odoo-dev/odoo#960

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:33 +02:00
Michael Mattiello (mcm) 580533ecfb [REF] web, *: change dialog service api
* iap, web_tour

This commit changes the API of the dialog service.

Before, the API gave 2 functions: "open" and "close".
Now, there is only one function "add" which is the same as "open"
but returning a callback that does the close.

closes odoo-dev/odoo#940

Related: odoo-dev/enterprise#171
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:33 +02:00
Géry Debongnie d1b260b424 [REF] web: refactor notification system
This commit does some improvements on notification system:

- move notification handling logic in service
- remove use of __destroy
- simplify types

closes odoo-dev/odoo#955

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:33 +02:00
Jorge Pinna Puissant 85dfc9cf49 [IMP] web: remove the Portal from dialog
In this commit, we simplify the dialog template by removing the Portal.
The Portal is no longer used, as now we always use the dialog service to
open a new dialog.

also:

- remove the dialog container class from the webclient;
- add the dialog container class to the dialog container;
- move the management of the inactive modal class to the dialog container;
- remove the dialog manager class from the dialog container;

closes odoo-dev/odoo#947

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:33 +02:00
Lucas Perais (lpe) c65e57e17b [REF] web: ui_service and block UI in @web/core/ui/
closes odoo-dev/odoo#925

Related: odoo-dev/enterprise#166
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:33 +02:00
Lucas Perais (lpe) 694e3f5904 [REF] web: services register their own component
Some services are coupled with a Component. Usually the service
handles the state of the system, and the Component displays or uses it.

To enable the communication between the service and the component
while making it private, the services should add themselves their
Component in the relevant registry, with the proper means of communication
passed in props.

This mechanism relies on c1d49d494e0ae3a94b3943186eb6d1ebd7b98a6e
2021-06-18 21:31:33 +02:00
Simon Genin (ges) 010bbcd9fe [REF] web: errors remove non-needed event
closes odoo-dev/odoo#953

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:33 +02:00
Bruno Boi 47acba560a [FIX] web: open menus in new tab
Before this commit, menus in navbar and clickable elements on the home
menu were not openable in a new tab through a ctrl-click or through the
middlemouse button.

In order to achieve that, we now use default behavior of <a href/> elements.

As such default behaviour would conflict with <DropdownItem/> clicks,
a global click handler is added in the WebClient constructor which stops
the click event propagation under these specific circumstances
(ctrl-click inside an <a href/> element).

Besides this work, it has been found that the <Dropdown/> root element
should not always be a <div/> as it was, but sometimes it has to be
another HTML element in order to comply with the W3C specs. E.g. a
<Dropdown/> component as a first level child of an <ul/> element must
have a <li/> root element instead of a <div/> one.

Thus, a new prop is added to the <Dropdown/> component (`tag`) allowing
the developer to choose another root element: `<Dropdown tag="'li'"/>`.

closes odoo-dev/odoo#913

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:33 +02:00
Simon Genin (ges) b124343d21 [REF] web: linting 2021-06-18 21:31:33 +02:00