Commit Graph
11757 Commits
Author SHA1 Message Date
Romeo Fragomeli 8a755d5833 [REF] web,*: hide buttons that doesn't work in webviews
Some features of the PDF.js library doesn't work in the
webview of the mobile apps.

Initially 'window.print' is defined as an empty function in
webviews unlike browsers where it is already ready.
After that, PDF.js needs to monkey patch 'window.print' and
saves a reference to the original definition, which is not
yet fulfilled in by the mobile app (Java part).
So the print of PDF.js doesn't work in webviews and end
users will need to download the file before printing it.

Regarding the Download button, the 'download' attribute is
not supported by the webview as you can see in:
https://bugs.chromium.org/p/chromium/issues/detail?id=432414
As there's many ways to download a file in Odoo it's not
a big deal to simply hide it in PDF.js.

Because it's quite complicated to fix this, we decided
to hide the features that don't work (Download / Print)
or don't make sense (Open file).

Task-id: 2200168
2021-05-07 11:01:27 +00:00
Romeo Fragomeli c1c225eff2 [IMP] web: add the detection of iPadOS
Before this commit, the iPad with iPadOS was not detected as
'isMobileDevice'.

Now the detection is more accurate.
2021-05-05 10:20:06 +00:00
Romeo Fragomeli e7d6a68a56 [REV][FIX] web: pdfjs: hide buttons that doesn't work in webviews
The commit odoo/odoo@7a40d528 is reverted as the following commit
will do same behaviour without "Monkey Patching" the lib PDF.js
2021-05-05 10:20:06 +00:00
Xavier Morel 79a4d11e24 [FIX] *: bunch of mismarked translation specifiers
`_(xyz)` will wrap them in an underscore.js object, which when used in
a string context will just return the string. So it's basically a
no-op, but it certainly doesn't translate the terms.

closes odoo/odoo#70476

X-original-commit: 92352ed2b5524c97b0aeeba3193c6a8d93ed82a1
Related: odoo/enterprise#18172
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-05-06 12:06:22 +00:00
Luis González fcfc83b66c [FIX] web: Aria attributes on buttons Export All & optional columns
Some aria attributes were missing or incorrectly set on these new
buttons:
- The button "Export All" was missing an `aria-label` attribute
- The button to show/hide optional columns was also missing an
  `aria-label` attribute, and its menu items (checkboxes to show/hide
  columns) were missing a proper role
- Ever since the debug manager was added in frontend on 73327db065,
  the `aria-label` attribute was not being rendered correctly on the
  button to open developer tools

closes odoo/odoo#70433

X-original-commit: ac3e0fcd32d66d6e0bacfabd2d224805d92dbfd1
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-05-05 16:37:04 +00:00
Jorge Pinna PuissantandSamuel Degueldre 9a76719893 [FIX] *: undeclared variables and restricted globals
closes odoo/odoo#69988

Related: odoo/enterprise#17991
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-05-04 13:32:49 +00:00
Jorge Pinna PuissantandSamuel Degueldre a8082fee7f [FIX] web, project: use the ES6 import
Remove the CommonJS require from the odoo-modules files and replace it
with the new ES6 imports.

Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-05-04 13:32:49 +00:00
Jorge Pinna PuissantandSamuel Degueldre f43a0814ae [IMP]*: configuration of ESLint for specific files
This commit will add the needed ESLint configurations on the JS files.
These configurations are added if the JS file uses a different
environment (serviceworker, node, etc) or if it uses a specific global
(google, ace, etc).

Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-05-04 13:32:49 +00:00
Philémon van HeldenandNicolas Lempereur 1d3c886b95 [FIX] web: no error on single active_ids state load
In eg. 13.0 when refreshing sales analysis action of a product, we would
get an error because we have a single active_ids which is not expected
by the code.

With this commit, we use .toString() on the jQuery BBQ parsed active_ids
as it was done before 32b8cec5 refactoring (january 2018).

The added test with the fix fails with an error:

  TypeError: state.active_ids.split is not a function
  at Class.loadState (/web/static/src/js/chrome/action_manager_act_window.js)

opw-2471982

closes odoo/odoo#70285

X-original-commit: bf9a985f4b62cc6f1eef4f9fcca2a8dfbd453004
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: pvh-odoo <SwagSamaSempai@users.noreply.github.com>
Co-authored-by: Nicolas Lempereur <nle@odoo.com>
2021-05-03 18:01:10 +00:00
Chong Wang (cwg) be2981324c [FIX] Calendar: fix avatar preview on hover
delete redundant '}' added by accident

The redundant '}' might be added by accident.
It makes the the correct avatar image cannot be found and shown as a default camera image when the user
* Open calendar
* Hover on on of the responsibles listed in the right side panel of the calendar view

closes odoo/odoo#69139

Taskid: 2504659
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
2021-04-16 09:14:24 +00:00
Samuel Degueldre 557a24e4f4 [IMP] web: allow lazy-loading asset bundles' templates
Previously, lazy-loading xml templates was only possible by fetching the
xml file directly, this meant that it was impossible to lazy-load an
entire bundle's templates with a single request. Additionally,
requesting the xml files directly meant that no inheritance was applied,
causing the need for a separate inheritance system using t-jquery on the
client-side.

This commit alters the /web/webclient/qweb route so that it now takes a
bundle id, meaning that it is now possible to lazy-load the xml from
arbitrary bundles.

task-2497943

closes odoo/odoo#70084

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-05-03 07:25:20 +00:00
Simon Genin (ges) ecfe85db84 [REF] web: static/src/(img|fonts) => static/(img|fonts) 2021-04-29 07:34:40 +00:00
Romeo Fragomeli 7a40d528e7 [FIX] web: pdfjs: hide buttons that doesn't work in webviews
Some features of the PDF.js library doesn't work in the
webview of the mobile apps.

Initially 'window.print' is defined as an empty function in
webviews unlike browsers where it is already ready.
After that, PDF.js needs to monkey patch 'window.print' and
saves a reference to the original definition, which is not
yet fulfilled in by the mobile app (Java part).
So the print of PDF.js doesn't work in webviews and end
users will need to download the file before printing it.

Regarding the Download button, the 'download' attribute is
not supported by the webview as you can see in:
https://bugs.chromium.org/p/chromium/issues/detail?id=432414
As there's many ways to download a file in Odoo it's not
a big deal to simply hide it in PDF.js.

Because it's quite complicated to fix this, we decided
to hide the features that don't work (Download / Print)
or don't make sense (Open file).

Note that a refactoring is already in progress in order to
avoid to patch this library in master.

closes odoo/odoo#70110

Task-id: 2200168
X-original-commit: 39225827035efe11cdc90b2a7f1ae1f24a54b136
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: rfr-odoo <rfr-odoo@users.noreply.github.com>
2021-04-29 14:27:31 +00:00
Xavier Morel 4bcbf47cfa [FIX] web: web client boot when user has not apps available
This mostly an issue when trying to run just the tests of `web` (aka
`-iweb`) with only community modules available,
`TestMenusDemoLight.test_01_click_apps_menus_as_demo`, wait for the
ready code times out:

    AssertionError: False is not true : The ready "odoo.isReady === true" code was always falsy

and the test suite fails.

The ready code simply checks that `odoo.isReady` is set. The web
client sets `isReady` when `webclient_started` is
triggered (specifically in `_onWebClientStarted`, which is the handler
for that event).

[The community web client only triggers `webclient_started` at the end
of `doAction`][0] meaning the community client is considered ready
until after the first action has executed.

[The first action is executed by `show_application`][1] whose process
is the following:

1. load and initialize the menus
2. if an action is specified in the URL, run that
3. otherwise if the user has a home action, run that
4. otherwise run the first menu's action

When installing only `web`, the only menus which could be available
are Apps and Settings, and the demo user has access to neither. This
means the demo user has no applications, and opening the first app is
a no-op ([`openFirstApp` has a case just for that situation to ensure
it does nothing][2]). As a result, `webclient_started` is never
triggered, `_onWebClientStarted` is never called, `odoo.isReady` is
never set, and the tour never runs.

Fix by updating `openFirstApp` to return *whether* it opened an
application, and in `show_application` the last fallback if even
opening the first application failed is to just declare the web client
ready.

While at it, rewrite `show_application` using ES6 facilities and
flatten and linearize it using guards. This means the code pretty much
tracks the process described above, with one step added:

5. otherwise complete the webclient's startup

[0]: https://github.com/odoo/odoo/blob/1eb474243b55f1b9e10c70d199bbe022e68b51d0/addons/web/static/src/js/chrome/action_manager.js#L174

[1]: https://github.com/odoo/odoo/blob/d1c56ec7c435c5baba8604feccc6116e4c25ca96/addons/web/static/src/js/chrome/web_client.js#L77-L107

[2]: https://github.com/odoo/odoo/blob/e24ab17d38fb049404f04112990e8b2fe1dd7727/addons/web/static/src/js/chrome/apps_menu.js#L44-L46

closes odoo/odoo#70039

X-original-commit: a5b2146404da9ea0cd4752a21dcd230140822c86
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-04-28 14:52:56 +00:00
Aaron Bohy b592d119e5 [FIX] web: make test pass on chrome 90
The changed test uses the drag&drop helper, and an operation does
not work as expected with the given params on chrome 90. The runbot
currently uses chrome 80, so it is not an issue, but if your chrome
is up-to-date, and you try to run the test suite, this test would
fail.

closes odoo/odoo#70032

X-original-commit: 43994da9980e4133274984f720bb58f3546ea0f9
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-04-28 14:35:07 +00:00
Nicolas Bayet 9c2197a896 [IMP] web: add trigger in FormViewDialog 2021-04-28 07:34:43 +00:00
Antoine Guenet 639e19ff64 [FIX] web: limit mouse events on colorpicker to its own document context
When the colorpicker is in an iframe, listening to mouse events on the
global document can have unexpected effects. Namely clicking in the
colorpicker, then moving the mouse outside the iframe made it move the
color cursor.
This fixes that by binding it to the parent widget's document, with a
fallback on the global document in case it's missing.

closes odoo/odoo#69877

X-original-commit: 4fb33f7f8d6955a44fbb7c94c7d204e9baa09707
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-04-27 07:14:15 +00:00
Sébastien Theys 6855cc3d2c [FIX] web: prevent test_menus loading DiscussWidget if no mail module
Follow up on bd67479316

This test file is not respecting Odoo module dependencies.

If the module is not defined, calling `[Symbol.for("default")]` will crash.

Old require system didn't have this syntax, the similar guard was done just
before using the class.

closes odoo/odoo#69845

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-04-26 13:37:05 +00:00
Michael Mattiello (mcm) a3b3ca9568 [FIX] web: fix bouncing edit button prevention
The PR https://github.com/odoo/odoo/pull/68799 tried to prevent the
form's edit button to bounce when quick editing.
The fix was wrong and some field continued to bounce the button.

This commit prevents the edit button to bounce when clicking on
any field by checking if we are quick editing.

closes odoo/odoo#69826

X-original-commit: 8393b3c51b38bd285acb91279cb08a28c241c9ca
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-04-26 09:35:30 +00:00
Xavier Morel 95128e6472 [FIX] web: test broken in Firefox
This is arguably a 20 years old Firefox bug (at the very least an
under-specified area of the spec where Firefox's behaviour is
technically allowed under spec but not super useful or convenient):
`window.getSelection()` simply doesn't work when invoked on a form
field: https://bugzilla.mozilla.org/show_bug.cgi?id=85686.

Getting the selection data more explicitly by looking up the focused
form element, then checking *its* selection, seems to work fine and be
cross-browser.

Also focus() the input while at it: according to MDN

> Calling element.select() will not necessarily focus the input, so it
> is often used with HTMLOrForeignElement.focus.

And jQuery doesn't really document whether `select()` will implicitly
`focus()`, so better safe than sorry.

closes odoo/odoo#69579

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-04-21 06:22:48 +00:00
Xavier Morel f6790b9895 [IMP] web: drop event during click() dispatching if disabled
Causes the failure of [0] on FF as it expects that clicking a disabled
button does nothing, which is what happens for Chrome, but the event
is dispatched for Firefox.

Asking the internet it looks like Firefox is in the right here:
click() ultimately calls dispatchEvent (directly), dispatchEvent
should go through even on disabled event. This was specifically fixed
in Firefox[1], and there is an issue opened against Chrome[2] (cf
also: spec discussion[3]).

There's an other issue which mentions inconsistencies between the
actual browser and WPT[4], but for us Chrome always 100% does the
"wrong" thing.

Anyway add a disabled flag in click, though I don't know that it's the
right fix, and it may need to be added to other events as well?

[0] https://github.com/odoo/odoo/blob/c89cdcf11c66e80c33cd77edceaee7eb59a704b3/addons/web/static/tests/fields/relational_fields/field_many2one_tests.js#L2044
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=329509
[2] https://bugs.chromium.org/p/chromium/issues/detail?id=1115661
[3] https://github.com/whatwg/html/pull/5805#issuecomment-672960163
[4] https://bugs.chromium.org/p/chromium/issues/detail?id=1116161
2021-04-20 14:11:30 +00:00
Xavier Morel fe8204a48d [FIX] web: overspecified test
Testing what's literally just a native feature seems odd, but in this
case it's also way over-specified: Firefox's error message for the
conversion of a symbol to a number is

    can't convert symbol to number
2021-04-20 14:10:31 +00:00
Leonardo Pavan Rocha 8cae451d58 [IMP] web: makes signature scale to canvas size to avoid mobile/desktop inconsistency
In the sign app, if a signature is saved in mobile resolution, when the user tries to sign a document in desktop, the size that is shown is the mobile size, which is strange for the user.
This PR is an odoo change and it modifies the library method that adds the image to the canvas, resizing the image to the canvas size.

task-2479787

closes odoo/odoo#68160

Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
2021-04-22 12:53:59 +00:00
Nicolas Lempereur 17428749b4 [FIX] web: find scrollingElement despite rounding
In mass mailing edition, in some configuration of:

- being in a modal or not
- size of window
- zoom level

we might get an error when getting the scrolling element.

For example when editing a mass mailing, if I set my viewport to 595
pixels height and have a 90% zoom, the editor is broken.

This is because in SnippetsMenu.starts  `$().getScrollingElement()`
doesn't find an element that has the height of body. In my use case body
height is 329.111 pixels, and scroll height is 328 pixels.

Testing different zoom level and viewport height, the maximum difference
I was able to get was 1.25 so this commit increase to 1.5 the maxmimum
difference.

opw-2455727
opw-2469174

closes odoo/odoo#69664

X-original-commit: c7a4cca4a082af7c6b33a70d4b19e700e4d487e7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-04-22 10:32:05 +00:00
Gorash aa47eda087 [IMP] web: add mode qweb in ace
Add a new parser in the ace for the qweb highlight. This makes it possible
to visualize the qweb tags and the part of code.
Used in the website and in xml fields.

closes odoo/odoo#69609

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-04-21 12:15:01 +00:00
Sunil Shrimali 7c2fb9bb16 [IMP] web: set visible overflow on modal for inline domain editor
When we have (inline) domain widget within a modal, user can not see
all the fields because overflow is hidden on the modals by default.
This is not ideal behavior.

With this commit, when the inline domain editor is opened with field
widget within a modal, we allow field selector to overflow by
manually setting visible overflow on the parent modal. The changes
are inspired by 'DomainSelectorDialog'.

Task ID-2480625
COM odoo/odoo#68586
2021-04-21 07:49:12 +00:00
Qiuyu (QHO) bd67479316 [REF] mail, mail_bot, im_livechat, *: convert JS files to ES6 modules
task id: 2487514

closes odoo/odoo#69376

Related: odoo/enterprise#17749
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-04-19 13:33:35 +00:00
Aaron Bohy c0c6be8dd1 [FIX] web: properly unpatch session after each test
Before this commit, `getTZOffset` and `user_has_group` weren't
correctly reset to their initial values after tests. As a
consequence tests executed afterwards might behave unexpectedly.

closes odoo/odoo#69497

X-original-commit: b7b83db88c61d7db87045d87b09d7348f3a8a9eb
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-04-19 15:48:31 +00:00
Nicolas Lempereur ffec6256de [FIX] web: web_translation route lang required
The /web/webclient/translations route's `lang` argument has had some
changes in the last year:

- before june 2020 (a9a756cf): very often it was set to null

- after june 2020 (a9a756cf): it was more often correctly set or had
  en_US as fallback so never null

- after 31 march 2021 (8cc06617) in saas-14.3: lang is not sent to
  server if it is null (which should never happen)

- after 15 april 2021 (a93a0a3): en_US fallback is removed to prevent
  overriding server language if another language is better

But the fix in 31 march and 15 april are not compatible because the
route /web/webclient/translations require a lang argument.

With this changeset, lang argument is always sent to the server.

closes odoo/odoo#69487

X-original-commit: 0604dce996882fb93cd71885f7eb4d0749eb357f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-04-19 13:25:26 +00:00
Michael Mattiello (mcm) 3036fc05b8 [FIX] web: fix widget wrapper and weekdays widget
Before this commit, `WidgetWrapper` tried to redirect the call to
`updateState` on its wrapped component but it can happen that the
wrapper is not mounted yet and thus calling a function on its wrapped
component will crash.

This commit changes the implementation of `WidgetWrapper.updateState`
to redirect the call to `this.update` which will update the props of
the wrapped component and not directly its state.

task 2504521

closes odoo/odoo#69421

X-original-commit: 67f09b9a9df248fec26f53758e76070ab3171435
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-04-16 16:04:00 +00:00
Jérémy Hennecart ac13964244 [IMP] calendar: improve the way calendar event are displayed
With this commit we try to improve the way the events are displayed
to the user. Now, an event is displayed for each attendee of the event
that are selected in the filter. These events are displayed correctly
based on the status of the attendee in the event.
The colors displayed for the events now represent the attendees and not the
organizer.

If an attendee edit an event, it is edited for all others attendees.
Also, when an attendee that is not the organizer try to delete the event,
then the event is now declined in place of being deleted. If the organizer
delete the event, it is deleted for all attendees.

In case of an event where all attendees have declined it but the organizer,
the organizer see now a danger icon before the name of the event and it's
outlined and not filled with color, no matter of the actual status of the
organizer in the event.

task-2196775
COM PR: odoo/odoo#55190
ENT PR: odoo/enterprise#12196
UPG PR: odoo/upgrade#1532
2021-04-15 16:07:12 +00:00
Simon Genin (ges)andjeh-odoo 0774459f5d [IMP] web: prepare calendar view to ease modifications
The calendar renderer used a template for events.
Now moved as a configurable template to ease futur calendar changes.

This commit adds also a custom event to the calendar renderer so that custom
implementations have a way to re-render the event items within the calendar
after making internal changes to the event records.

We introduce also a new option for a field "filter_field" which allows to specify
the field of the model in which we will save the status of a filter.

This is preliminary changes in order to make the calendar view able to modify
the attendance status of a meeting and refresh the events to visually display
if the user is attending or not.

Task ID 2196775
COM PR: odoo/odoo#55190
ENT PR: odoo/enterprise#12196
UPG PR: odoo/upgrade#1532

Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: jeh-odoo <jeh@odoo.com>
2021-04-15 14:05:10 +00:00
Anh Thao Pham (pta) 55eb75d949 [FIX] web: do not use default en_US lang when loading translations from session
When loading translations from Session, if no lang is defined in context or html,
it is loading translations of en_US lang by default.
No default should be used to fallback on the language of the current user.

opw-2501708

closes odoo/odoo#69336

X-original-commit: 0b9ab4efcf66d4c5099a9f33d2fb1b4dd814eb5c
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2021-04-15 16:23:20 +00:00
Aaron Bohy facd78d5f3 [FIX] web: onchange: send correct nested x2manys values
Commit [1] recently fixed an issue with nested x2many fields and
onchanges: in some cases, all field values weren't sent to the
server as they should.

However, there is a small issue with this fix. We didn't correctly
apply the default value to option `changesOnly`: when not given,
it was considered false, whereas in this particular function it
should have been true.

It caused an issue in the following scenario:

Have a form view with an x2many field (say A) displayed as a list.
In the list, there is another x2many field (say B), and (whatever
its type) a field C with an onchange. When the user changes C, the
onchange is performed, and we send to the server the value of all
fields. In particular, in the row, we send the value for the
many2one field pointing to the main record (the inverse field of
the x2many relation). The value for that field is basically the
whole record, containing itself field A. For field A, the value is
a list of commands, and for the updated record, it is a command 1.
Before this commit, in the values sent for this command, field B
was the empty array, even if it wasn't empty.

This issue was reproducible in account.move, on an existing record
having already a line in invoice_line_ids (this is field A). In
that line, tax_ids (this is field B) must have a tax which is
included in the price. When changing the quantity of the product,
the subtotal wasn't correctly computed.

[1] https://github.com/odoo/odoo/commit/a8b43d02066b2299ac2f4b88056c37725e9ce6cd
opw~2489755

closes odoo/odoo#69227

X-original-commit: 3f54ca3e29d1537f66c6a3b56494dc065d9230e9
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-04-14 09:01:34 +00:00
Michael Mattiello (mcm) b73545ff2a [FIX] web: no bounce button form field/label click
Since commit [1], a delay was added to "debounce" the quick edit to
check if the user did a click or a select.
Because of this delay, the edit button now bounces when clicking on
a field or label.

In this commit, we check if the user clicks on a "quick editable"
field or a label to prevent bouncing.

[1] https://github.com/odoo/odoo/commit/2939ea4dd4736e659cc3e4df2226a3b08ac8ec48

closes odoo/odoo#68835

X-original-commit: 755a02135049f22e1e8db356169b5224f00c1f92
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-04-06 13:50:07 +00:00
Xavier BOL (xbo) 5072b68f95 [MOV] web: move the utils function in own JS module
Before this commit, we must to copy paste the functions useful for the
GraphRenderer when we override this model.

This commit moves the functions and the global variables in a new module
called graph_utils.

task-2458017
2021-04-08 08:27:49 +02:00
Oussama MESSAOUDI 875bbc287b [FIX] web: review rounding of HSL color values
Change the conversion to HSL system to return floating values and leave
the rounding to the caller (for instance when converting to RGB system).

Part of https://github.com/odoo/odoo/pull/68488

X-original-commit: eab46cb2fdc55cf4951977bfc32751a33374fe1d
2021-04-06 17:49:32 +00:00
Sébastien Theys 637684fb50 [FIX] web: ignore recursiveCallMounted on not yet rendered children
This should hopefully fix the race condition that is described in the related
task. The issue is that our mounted callbacks are legitimately relying on the
component to be actually rendered.

task-2481713

closes odoo/odoo#68838

X-original-commit: 8782de993d922b321d3be479dbb84e9d20a0c87a
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-04-06 14:22:26 +00:00
740168ce8d [REF] web_editor, website_*, mass_mailing: adapt to Odoo Editor
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Sébastien Geelen <sge@odoo.com>
Co-authored-by: Emilien Durieu <edu@odoo.com>
2021-04-01 16:01:06 +00:00
Hardik Prajapati 7faa4c3bc6 [IMP] web: display nocontenthelp message in graph view
Currently, graph view display the blank chart when the
sample data is set and the noContentHelp message is empty.

so in this commit, graph view display the sample data with
noContentHelp message even if the noContentHelp message is empty.

TaskID-2347554

closes odoo/odoo#62153

Related: odoo/enterprise#14840
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-04-01 09:46:47 +00:00
Alexandre Kühn 1874d6e827 [IMP] mail: Attachment viewer header UX on mobile
Task-ID 2200168

closes odoo/odoo#66614

Related: odoo/enterprise#16579
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-03-31 16:53:24 +00:00
Mohammed ShekhaandMathieu Duckerts-Antoine 3ed1890c7a [IMP] web: use search groupbys in pivot
Before this commit: all groupable fields were offered to selection when
a user would click on a suitable pivot header. While guaranteeing maximal
flexibility, this was easily overwhelming to any new commer.

After this commit: when at least one groupby is defined in the search
arch, the selection is done in the search arch groupbys (plus eventually
some custom groupbys) via a menu similar to the "Group By" menu in the
control panel. The advanced users have still access to more options in a
"Add custom group" menu again as in the control panel. When no groupby
is defined in the search arch, the selection is done among the groupable
fields as before.
This has led to a small modification of control_panel_model_extension.js:
it has become necessary to distinguish the groupBy filters coming from
the arch from those created by the user via the "Add custom group" menu.

Task ID: 2376505

closes odoo/odoo#61572

Related: odoo/enterprise#17341
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2021-03-31 13:56:38 +00:00
8cc066173d [IMP] *: Improve assets management
This commit changes the way assets are declared in Odoo modules.

Before: assets were declared in template files. Template bundles were
generated from primary templates, so technically any qweb template could
have been called as an asset bundle, with the 't-call-assets' directive.

Being standard qweb templates, they had access to standard HTML tags
(script, link, with or without raw scripts or style definition), qweb
directives (t-call, t-raw, etc.) and could be inherited by other
templates.

Now: assets are defined in the module's manifest and generated by the
't-call-assets' directive.

More information on the new system can be found on the updated user
documentation (see the "JavaScript Reference" section).

Task: 2352566

Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Romain Derie 0d6cdeef2f [IMP] web_editor, *: show a progress bar on image upload
*: web, web_unsplash

Without this commit, the user had no hint to know something was actually
being performed.
It would be worst when uploading multiple image at once, eg in image
wall, as it could take some times for the images to be processed and
uploaded.

The user now has a visual hint about the upload progress through a
toaster and some progress bars.

For unsplash, note that as the actual image download is performed S2S,
the progress bar will automatically jump to 100%, then will wait for the
RPC success once the server is done to show a success progress bar.

Part of https://github.com/odoo/odoo/pull/65828
task-2345082
2021-03-31 07:06:35 +00:00
Aaron Bohy c89cdcf11c [FIX] web: tests: patch form multiClickTime once for all
A lot of tests in different QUnit modules need this delay to be
patched to 0. Some of them (e.g. the 'ActionManager > Misc' module)
didn't patch it correctly. It worked before because a patch was
done in a previous test, and wasn't unpatch. The previous commit
ensures the patch is removed, so now we have at least 2 tests of
the above mentionned module that fail. This commit ensures that
the delay is patched in every tests, and allows to specify a
custom delay if necessary.
2021-03-31 09:30:07 +00:00
Aaron Bohy a3937cfde5 [FIX] web: tests: properly unpatch after test
For testing purpose, the multi-click timeout delay of the quick
edit is patched. However, in this specific test, it is patched
twice (once to set it to 0 in beforeEach, and once to set it to 50
in the test itself). A single call to unpatch removes the second
patch (50) but keeps the first one, for the remaining of the test
suite. This could lead to weird situations where the whole suite
passes, but a single test executed on its own fails.

Issue spotted in the assets revamp PR, as it alters the test order.
2021-03-31 09:30:07 +00:00
Michael Mattiello (mcm) 7ad8bb2c09 [FIX] web: fix quick edit tests
Before this commit, quick edit tests could crash in an undetermined way.
It was due to the setTimeout for the quick edit event in FormController
which waits at least 1 tick even if timeout = 0 like in those tests.
Now, if this timeout is 0 then we bypass the setTimeout.
2021-03-31 09:30:07 +00:00
Mohammed Shekha 8b6063ac16 [IMP] web, *: discard unchanged record in editable list
* sale_product_matrix

Before this commit, if we created a new row in an editable list view,
do not "touched" it and clicked out of the list then the record tried
to be saved and threw error notifications.
Now, that flow will discard the record to make it consistent with the
form view which discards the record when we leave the form.

task-2431691

closes odoo/odoo#68382

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-30 10:44:25 +00:00
Aaron Bohy aa07146421 [IMP] web: boot.js: throw even if not in debug
Before this commit, when a module wasn't correctly defined (e.g.
wrong format for dependencies, wrong format for module name, name
already defined...), an error was thrown but only in debug mode.
In non debug mode, the problem was simply ignored, which is wrong.

An example of harmful consequence would be the following: if
someone defines a new test file and uses an already used module
name, he won't be notified of his mistake unless he runs the suite
in debug mode. If he doesn't, the runbot won't detect it either as
it runs tests in non debug mode. It would then lead to one of the
two test suites not being executed.

Fun fact: a lazy loaded file was actually loaded twice, but we were
only notified in debug mode. With this change, it made the test
suite fail all the time, no matter the mode. We simply removed the
file from the page source, and let the first test needing it lazy
load it.

closes odoo/odoo#66918

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-03-30 08:57:35 +00:00
Aaron Bohy 835cb1d593 [FIX] web: empty fields don't increase row height
Commit [1] tweaked the empty (unset) fields css rules s.t. they
have a non null height in readonly, to reduce the shift between
readonly and editable form view. This only concerns form view,
but the changed rule also applied in list view. As a consequence,
empty fields increased the rows height in list views.

https://github.com/odoo/odoo/commit/288b24cbdf54ac0dbee7e012f074fac9a0c68238

closes odoo/odoo#68482

X-original-commit: 020b814b3be055c6bf795153dce6079810d34b1c
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-29 15:24:24 +00:00