Commit Graph
14670 Commits
Author SHA1 Message Date
Mohammed Shekha 159e58286e [FIX] web: render buttons after list selection box
With this commit we display list selection box after all list header buttons,
previously buttons were displayed before header buttons.

task-2628038

closes odoo/odoo#78057

X-original-commit: 09c5e178c61feb69d6fd27e4bb9df979fa480f41
Signed-off-by: FrancoisGe <fge@odoo.com>
2021-10-08 16:09:10 +00:00
Mohammed Shekha de765111cc [FIX] web: increase pager hitbox area
Since wowl framework is merged pager hitbox area is reduced and harder
to hit, with this commit we increase pager hitbox area.

task-2610578

closes odoo/odoo#78006

X-original-commit: ff788c20e9582adfb387d7111218a26b29519a70
Signed-off-by: FrancoisGe <fge@odoo.com>
2021-10-08 10:38:04 +00:00
Mohammed Shekha 49b35e85ca [FIX] web: do not clearUncommittedChanges for function actions
Before this commit: In res.config.settings form view when user change something
in form and click on button in form then it will display to save the unsaved
changes, when we click 'Save' button from dialog still dialog remain there
it is not closed(while record is saved in background, just dialog is not closed)

This is because we called 'clearUncommittedChanges' method before executing
client action, 'Save' button on dialog returns client action for reload page
but as we calling 'clearUncommittedChanges' so it will call 'canBeDiscarded'
method of 'BaseSettingController' which again show dialog for unsaved changes.

After this commit: unsaved changes dialog is closed on clicking 'Save' button
from dialog, we called 'clearUncommittedChanges' method only if clientAction is
instance of Component, i.e. if client action is type of function which is our
case, reload is client action which type of function so in that case we do not
need to call 'clearUncommittedChanges'.

task-2662302

closes odoo/odoo#78035

X-original-commit: 5d8376a8f9a8957112afb35854bdb8b050bd6903
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-08 06:09:41 +00:00
Simon Genin (ges) c0e354eeec [FIX] web: company_menu always shown by default (in community)
Before: the company menu would disapear when the screen was smaller than
some threshold. It is expected in enterprise, but not in community as
it doesn't have the burger menu.

After: The menu is set to always be displayed. To remove it becomes
an enterprise reponsability.

closes odoo/odoo#78034

X-original-commit: 039e24eabf258da6bfad45a839c51116f6d86e0c
Related: odoo/enterprise#21535
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-10-07 22:44:59 +00:00
Simon Genin (ges) 2dce16e81e [FIX] web: user menu always shown by default (in community)
Before: the user menu would disapear when the screen was smaller than
some threshold. It is expected in enterprise, but not in community as
it doesn't have the burger menu.

After: The menu is set to always be displayed. To remove it becomes
an enterprise reponsability.

closes odoo/odoo#78033

X-original-commit: 3b18f1cf8cfdbc497c8acba67970e835dabc2eb2
Related: odoo/enterprise#21534
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-10-07 22:44:54 +00:00
Aaron Bohy 4009d98288 [FIX] web: set "data-tooltip" as translatable attr in owl
With this, tooltips specified with the "data-tooltip" attribute in
owl templates will be translated.

closes odoo/odoo#78031

X-original-commit: 238f275e6d7e536764b7dbc3e7573dbc082804a9
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-07 20:16:47 +00:00
Victor Feyens ab022ec12d [FIX] *: target v15.0 documentation with doc links
X-original-commit: acc95ec204baa1dddbe292c379a1768fe1deccbf
Part-of: odoo/odoo#77923
2021-10-07 17:59:52 +00:00
Lucas Perais (lpe) 5481009b23 [FIX] web: localization: add a docstring
This commit just adds a comment to enlighten a developper on how the actual
data of localization is loaded.

closes odoo/odoo#77966

X-original-commit: 73e7628fa1a850e97cd859d1c67d817fc323d155
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-06 14:55:04 +00:00
Nicolas Bayet b036ff1828 [FIX] web: enable master_input call
During the adaptation from jinja to qweb, the call to the master_input
was commented, This commit uncomment the call.

closes odoo/odoo#77918

X-original-commit: fae5e1c76ea3fca7b39e67d37f17beedeb391cb9
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2021-10-06 13:50:52 +00:00
Louis Wicket (wil) 021bc1bfd8 [IMP] mail: open and join call on click on the start a meeting button
Automatically create and open a new channel, then start a call, on click
on the "Start a meeting" button.

Part of task-2651831.

closes odoo/odoo#77946

X-original-commit: cedc8e934bf8c97f94f455389315f9f4c40137c7
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-10-06 10:27:12 +00:00
Martin Trigaux e132c36ee6 [I18N] *: export 15.0 source terms
closes odoo/odoo#77898

X-original-commit: ad5afb1d18661784bfcf51bca66e576de1f6c49b
Related: odoo/enterprise#21478
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-10-05 16:54:21 +00:00
Romain Derie de0308e87f [FIX] web: remove the command palette from the frontend
There is multiple issue with the palette in the frontend:

First, the command palette is bound to CTRL+K, which need to be bound to link
creation as this is an universal keybind, as CTRL+P CTRL+F are, as any other
edition app in the world does.
(Note that link creation is not only for edit mode but also for end user, eg
forum post)
History of the keybind:
1. Command palette was introduced with CTRL+K
2. The keybind was changed to CTRL+M to restore CTRL+K for link edition, see
   8727ed2766
3. The keybind change was reverted and command back to CTRL+K, as CTRL+M can't
   be used on MAC

Second, the command palette do not correctly work in the frontend, the menu are
not opened when an entry is selected, and the submenu are not shown in the palette
when the menu was opened before opening the palette.

Lastly, the CTRL+K in frontend does not only open the command palette but it
also create a link in the background of the palette being opened.. which
result in very bad usability..
The one expecting a link has to deal with a palette.
The one expecting a palette has had a link created without really noticing it.

task-2659885

closes odoo/odoo#77879

X-original-commit: 6135b04738a58564592f438364f5a147ce9c471f
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2021-10-05 15:41:46 +00:00
Aaron Bohy 25690c2879 [FIX] web: fix documents tests failing randomly
Since commit [1], several tests from the "documents" addon failed
randomly, because there were leftovers in the DOM at the end of
the tests. Those leftovers were the many2one dropdowns. Since v12,
we whitelist jQuery autocomplete dropdowns in the leftover check.
However, since [1], the many2one autocomplete has an additionnal
className, and it thus didn't match the element in the whitelist
anymore. Note that we duplicated the entry in the whitelist
because we need both (there are several types of autocomplete
dropdowns in the "documents" view).

[1] 84715436d87bb05b421bc9ccaacda67d07571690

closes odoo/odoo#77861

Related: odoo/enterprise#21460
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-05 15:41:15 +00:00
Xavier Morel 6f4b78764a [FIX] web: more reliably avoid downloads on new file
519555054a mitigated an issue of being
able to try and download files which don't exist yet, make the fix
more reliable by clearing out the field completely and hiding the
content if the (readonly) field has no value *or the record is not
saved yet*.

Also clean up the code:

* an old-style forward port created a duplicate fixprovement
  (a8d01cbf4e) which seems less correct
  as it applies conditionally
* and the code is branchier than necessary, we can make it simpler by
  judiciously leveraging jquery's API

closes odoo/odoo#77856

X-original-commit: 05db9be15d75dc0794095aad75c80d0c2e540808
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-10-05 14:17:37 +00:00
Bruno Boi 8326dcd621 [FIX] web: center ONLY o_cp_action_menus div
The commit 590d0ca8 tried to center the o_cp_actions_menu but instead it
was spreading every direct child of the o_cp_bottom_left zone.

This commit puts the bottom left zone back to a left aligned flex layout
and puts an automatic left margin on the actions menu zone.

closes odoo/odoo#77852

X-original-commit: 4d5e64f04c421af554abbbde29d98278a6c27a1f
Related: odoo/enterprise#21457
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Bruno Boi <brboi@users.noreply.github.com>
2021-10-05 14:17:25 +00:00
Lucas Perais (lpe) 885d105075 [FIX] web: py_js: py_date: relativedelta revive features
Before this commit, absolute notation was not supported.
weekday, yearday and nlyearday were not supported either.
Some other computations did not work, or weren't tested for.

This commit re-introduce the support for all those features.

closes odoo/odoo#77851

X-original-commit: c423326a97060fb9132abcaf997ffba41a63b5fe
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-05 14:17:21 +00:00
xO-Tx dde609a838 [IMP] web, website: remove website menu loading effect
The goal of this commit is to remove the menu fade-in effect
on page load since we can now call the initAutoMoreMenu in
non-lazy JS code.

When 'initAutoMoreMenu' called, images won't be loaded yet,
that's why we add a class: '.o_menu_image_placeholder'
to set a default size on images and once all images are loaded,
we reupdate the menu.

task-2618929

X-original-commit: 6be166df24dedbe4729e1e7bfe6a302713932b74
Part-of: odoo/odoo#77843
2021-10-05 14:17:13 +00:00
xO-Tx 898d181c7f [MOV] *: move initAutoMoreMenu to a non-lazy loaded file
*: web, website

task-2618929

X-original-commit: 0a031fca52e92ce052522446b0c1751aac5dc572
Part-of: odoo/odoo#77843
2021-10-05 14:17:12 +00:00
xO-Tx 0de634965a [REF] web, website: rewrite initAutoMoreMenu method
The goal of this commit is to make initAutoMoreMenu fully
non-jquery and totally independant of other odoo utils.

task-2618929

X-original-commit: 7be1bb9083c786064fa140c811952e7735ce5539
Part-of: odoo/odoo#77843
2021-10-05 14:17:12 +00:00
Géry Debongnie 6d67d02ece [IMP] web: update owl from 1.4.4 to 1.4.6
Release notes:

https://github.com/odoo/owl/releases/tag/v1.4.6

- fix: crash in component render (in rare cases)
- fix: build system now target ES2017 instead of ESNext
- fix: remove useless log in prod mode

https://github.com/odoo/owl/releases/tag/v1.4.5

- qweb: expose translatable attributes
- ci/tests: update jest/rollup
- doc: clarify tutorial
- doc: update readme, add nice badges

closes odoo/odoo#77835

X-original-commit: aa2cfb63932d28821a4a333d5162827392bf3366
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-05 14:16:54 +00:00
Francois (fge) 71213bdb77 [FIX] web: _t missing in debug_menu
closes odoo/odoo#77749

X-original-commit: a182fc9d078fba7d041563c8bda157bc3d142c2e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-05 07:27:24 +00:00
Nasreddin Boulif (bon) 0e576c9700 [FIX] web: Display properly company phone in report
Steps to reproduce :

  - Install Sales
  - Modify the report, use the theme "Clean" and the font "Open Sans"
  - Modify the company phone to: +41 26 322 01 02
  - Print a quotation

Issue :

  Company phone is on 2 lines

Cause :

  CSS issue with wkhtmltopdf.

Solution :

  Replace CSS display value `inline-block` by `inline`.

ref commit: https://github.com/odoo/odoo/commit/5b022f433a44e627541d30ae21d7a867f4a3a6ff
opw-2567836

closes odoo/odoo#77647

X-original-commit: d462f13e0c1c04e792895bba9f2edfb35d9ee9d3
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-10-04 21:33:47 +00:00
Philippe Wauthy b34d68c842 [IMP] hr_holidays: delete from dashboard in year view
Previously, the land page of Time Off was month view. When you select a leave from Month's view, you can edit/delete it directly.
Now, the land page is Year's view, and you can open the modal form of the leave, but it's not possible to delete it.
Add a delete button on the form view of the leave from the year's view of the dashboard

task-2638305

closes odoo/odoo#76080

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-10-04 09:15:56 +00:00
Francois (fge) 3e7996a448 [FIX] web: expanded search item
Let us assume we have a slow network and a (new) search bar with two
items, one of them expandable.
Before this commit, click to expand that item and then hover the other
item quickly would not end in a situation where the item is expanded.
This was due to a naive concurrency management in the (new) SearchBar
component.

In this commit, we allow to focus another item (via the mouse or the
keyboard) without cancelling an ongoing asynchronous operation.

closes odoo/odoo#77655

X-original-commit: 6fc0c5ee2d1d68bf82a034fe1744ac5673e522c9
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
2021-10-04 07:57:08 +00:00
b63ee52552 [FIX] *: remove scss 'extend' from dropdown components
This commit removes all the 'extend' initially introduced to avoid code
repetition and ensure visual consistency across Bootstrap and Owl dropdowns.

Despite achieving the desired results, using 'extend' in this context
was seriously impacting the bundle generation time, probably due to an
underestimated amount of Apps' legacy-code applied on these elements.

In order to achieve the same results, the chosen strategy is to add
Bootstrap default classes directly into Owl dropdowns.
Also, it moves code related to bootstrap dropdown in 'webclient.scss',
leaving 'core/dropdown/dropdown.scss' for Owl code only.

Due to the discrepancies between Bootstrap and Owl html
structure, the '.dropdown-item' class could not have been added
directly to Owl's '.o_dropdown_item' itself, without refactoring
the Dropdown component structure.

// ==== Bootstrap 4.6 default Structure ================================
<div class="dropdown-menu">
  <button class="dropdown-item" type="button">Action</button>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== OWL default Structure before this commit =======================
<ul class="o_dropdown_menu">
  <li class="o_dropdown_item">
     <span>Action</span>
  </li>
  <li class="o_dropdown_item">
     <a href="#">Another action</a>
  </li>
</ul>

// ==== OWL Structure after this commit ================================
<div class="o-dropdown--menu dropdown-menu">
  <span class="dropdown-item">Action</span>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== web.assets_backend.css Bundle Generation Comparison ============
With all modules installed (enterprise edition over runbot):
Before this commit, bundle took ~2.5s and ~4s to generate and weighted ~322kB (~2.5MB uncompressed)
After this commit, it takes between ~1.2s and ~1.6s and weights ~257kB (~1.6MB uncompressed)

closes odoo/odoo#77649

X-original-commit: 84715436d87bb05b421bc9ccaacda67d07571690
Related: odoo/enterprise#21370
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Stefano Rigano <sri@odoo.com>
Co-authored-by: François Georis <fge@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-04 07:57:00 +00:00
Mohammed Shekha 63099f5b13 [FIX] web: center o_cp_action_menus div
Since commit a1f286916d o_cp_action_menus is not centered
anymore as justify-content: space-between; was removed from scss.

with this commit we are making o_cp_action_menus centered again.

task-2628050

X-original-commit: 590d0ca81382d4c3d6007bdf9bf65ed3a0ed795e
Part-of: odoo/odoo#77649
2021-10-04 07:57:00 +00:00
Leonardo Pavan Rocha 736fbc5458 [IMP] web: add url_parse in report download to get data from URL
When printing particular reports without specified record IDs, an indexError
occurs, therefore preventing the printing. This PR changes the way the data
is get from the url by using url_parse instead of string.split('?'), which
sets the data to an empty dictionary if no params exist in the url.

task-2552160

closes odoo/odoo#77471

Related: odoo/upgrade#2694
Related: odoo/enterprise#19808
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
2021-10-01 11:25:11 +00:00
Samuel Degueldre 27853412a3 [FIX] web: avoid masking crashes when original error has no stack
In some contexts, an error caught by the error service has no stack,
trying to annotate the stacktrace of this error with the Stacktrace
library crashes, masking the original error which is unwanted.

closes odoo/odoo#77421

X-original-commit: 347ddcc06e23d8f1a94c06379b2bfe104b116d90
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-30 17:11:50 +00:00
Julien Mougenot c440c2eb95 [REF] web: Pivot with view layout
This commit rewrites the pivot view template to make use of the view
layout component.

X-original-commit: ebb046c5b9b6b629fd6731a419c5b7daf57a9f7d
Part-of: odoo/odoo#77463
2021-09-30 10:38:30 +00:00
Julien Mougenot 163be99e53 [REF] web: Graph with view layout
This commit rewrites the graph view template to make use of the view
layout component.

It also removes a duplicate test in the graph test suite.

X-original-commit: a9a65fd51a2317adc07bf3742f7edc360236d32e
Part-of: odoo/odoo#77463
2021-09-30 10:38:30 +00:00
Julien MougenotandAaron Bohy 5bcf16311a [IMP] web: View layout
This commit introduces a new component: the layout component.
Its purpose is to make abstraction of most generic components and
classes when writing a view template or an action.

To make use of this component, we also needed a new system to pass slot
from the parent of the layout to the control panel. This was done in a
hacky way and is meant to be replaced as soon as Owl provides a built-in
way to pass slots.

The control panel has also been slightly tweaked to default its props
from an environment's newly introduced key: the 'config'. This has been
done to reduce the amount of props passed to the layout and search
subcomponents.

X-original-commit: 3b29dd230acd961a72fb0cb971f9363958f65b60
Part-of: odoo/odoo#77463
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
2021-09-30 10:38:29 +00:00
Julien Mougenot 6dd7efed58 [IMP] web: Only display search panel with sections
Before this commit, the search model would consider displaying a
search panel regardless of whether it had any sections.

Now, the search panel is considered non-displayable when there is no
sections.

X-original-commit: d3b191600b50fb052a956d1199730453789674e2
Part-of: odoo/odoo#77463
2021-09-30 10:38:29 +00:00
Mathieu Duckerts-Antoine da8f749f56 [FIX] web: py.js datetime.timedelta implementation
The identification of timedelta with relativedelta was wrong.

Here we define a class PyTimeDelta used by py.js to evaluate most
expressions in which datetime.timedelta and some operations producing
timedeltas occur.

The class PyTimeDelta allows to:
    - create a timedelta
    - add/substract two timedeltas
    - multiply (divide) a timedelta by a float (resp. an integer);
    - take opposite of a timedelta
    - evaluate equalities between timedeltas and other expressions
    - decide when a timedelta is "false"
    - get total_seconds of a timedelta

In relation with that, we have improved the implementation of PyDate
and PyDateTime to allow most manipulations of datetime.date and
datetime.datetime producing/using timedeltas. It is now also possible to
evaluate equalities between dates/datetimes and other objects.

closes odoo/odoo#77453

X-original-commit: fcd4959a65a92e34ce986575c7fc279c195e9a11
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
2021-09-30 10:38:19 +00:00
Simon Genin (ges) ff6823cb24 [IMP] web: xml parsing doesn't fail silently
closes odoo/odoo#77452

X-original-commit: 58c3a36ee955cb2c3bb461244dd026fd0ab798ac
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-09-29 23:57:22 +00:00
Aaron Bohy 09da30fbcd [REF] board,web: namespace legacy view root classnames
The pivot and graph views have been rewrote in owl in [1]. However,
the former implemention has been kept as it is still used in some
cases (e.g. board application, studio, PieChart widget), but they
are lazy loaded [2].

Before this commit, both the new and former implementations mostly
shared the same DOM (in particular, their root element had the
same classnames). It means that the scss rules of an implementation
might interfer with the other, and vice versa.

This commit adds the "legacy" keyword in the root classnames of
those views, and properly namespaces the scss rules of legacy views
to properly dissociate the style of new and legacy views.

For the pivot view, we re-used the same scss file, so in this
commit, we duplicate it (one for the new view, the other, lazy
loaded, for the legacy view).

[1] 0134495ba5
[2] bd3cf85c841168dfd87f7166b545dd00d9b38bf4

closes odoo/odoo#77323

X-original-commit: 3862d5aae1df72d3585f915e8a2a2626322e74ad
Related: odoo/enterprise#21223
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-09-29 08:32:55 +00:00
Hubert Van de Walle (huvw) 8b7d840646 [FIX] web: Select the correct record when there is an html table in a line
Steps to follow

  - Add an HTML field in the sales order line view
  - Create a sales order
  - Add a product
  - Add a table with multiple rows in the HTML widget
  - Add a new product
  -> The new product isn't selected

Cause of the issue

  The CSS selector used for finding the record to edit was taking all tr
  element into account

Solution

  Only select direct descendants of the tbody

opw-2632817

closes odoo/odoo#77380

X-original-commit: a8a0f38f5f45f18bc8221bf835d6e54ddabc471d
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Hubert Van De Walle <hubvd@users.noreply.github.com>
2021-09-29 07:12:29 +00:00
Simon Genin (ges) b6be398743 [FIX] web: Allow the graph context option fill_temporal to be set
The option was available before but was forgotten when the graph view
was refactored.

closes odoo/odoo#77330

X-original-commit: 624fd812c5d6b01c0cc11e8620dc703dc0370f73
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-29 07:12:24 +00:00
Aaron Bohy dd47708f5f [FIX] web: clickbot: correctly wait for next view
Before this commit, the clickbot test failed when switching from
a dashboard view to a pivot, graph or cohort view, because the
condition to wait before toggling the filters in the next view was
wrong. As a consequence, we started to toggle the filters for the
next view on the dashboard view, so when we actually switched to
that view, the filter menu was closed and the tour was blocked.

The previous condition used the `.o_{view_type}_view` classname,
targetting the root node of the view (which appears in the DOM when
the view is loaded). Unfortunately, since [1] and the new
implementation of the graph and pivot views, we added root
classnames to graph and pivot (o_graph_view and o_pivot_view),
whereas it wasn't the case before. So when leaving a dashboard
view to a graph or pivot view, the former condition was directly
true (if the dashboard contained those views), and we didn't wait
for the next graph or pivot view to be loaded.

Note that the former implementation of the cohort view already added
the "o_cohort_view" classname on its root node, but it didn't make
the clickbot test fail because we don't have cohort views next to
dashboard views in standard actions.

This commit changes the condition to use the view switcher icons
instead.

[1] 0134495ba5

closes odoo/odoo#77324

X-original-commit: bc53eebc8b9cd9f6e949bbe7e91ec2f98e5a0dfc
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-29 07:12:20 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Lucas Perais (lpe) 7e8cf3d458 [FIX] web: legacy: no memory leak via owl.qweb
Root components register a listener on env.qweb's "update" event (component.ts:constructor).

This means that every legacy ComponentWrapper does this and it proved to cause memory leaks.

This fix is two fold:
- the owlCompatibility code unregisters the handler on destroy, so that the production run is not impacted by the leak.
- the legacy test infrastructure also forces the unregistration. This is necessary because even though components are destroyed, the qweb singleton in legacy tests holds on to destroyed components' reference.

closes odoo/odoo#77285

X-original-commit: 89034cf597a418bfd35fdd71324415cdbf046a16
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-28 06:48:40 +00:00
Lucas Perais (lpe) 7d54ec45cf [FIX] web: scrolling: take html to scroll in mobile
Before this commit the scroll position in mobile mode were not kept.
This was because the scroll element was the body node.

After this commit, the scroll is saved and reused correctly as the reference
node is the html node.

This commit makes no sense without its enterprise counterpart. (https://github.com/odoo/enterprise/pull/21150)

closes odoo/odoo#77232

X-original-commit: 4957fd2ceec51ba3907a968bd0fce0512a57f3ac
Related: odoo/enterprise#21196
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-27 16:56:58 +00:00
Hubert Van de Walle (huvw) 6f08752fc2 [FIX] web: select all feature now works as intended
Steps to follow

  - Go to the variant tab of a product
  - Add an attribute and click search more
  - Select the checkbox at the top to select all records from the current page
  - Click on Select all
  - Click on Select
  -> Only the records from the first page are added

Cause of the issue

  `getSelectedRecords` doesn't return the record from all pages
  but only from the current one

Solution

  If the domain is selected, use all the records

opw-2586877

closes odoo/odoo#77228

X-original-commit: 963ccf1b4f3bb82c974af2ac0e47344c0ce060ac
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Hubert Van De Walle <hubvd@users.noreply.github.com>
2021-09-27 16:56:54 +00:00
Michael (mcm) 1331165c0f [FIX] web: fix error stack undefined
In javascript, Error.stack is not standard so it could be undefined on
some browsers.

This commit fixes possible crashes when we perform some operations
on error.stack.

closes odoo/odoo#76917

X-original-commit: f8bc701e78b31f90a30baebe734290f6202a0af9
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-27 16:56:15 +00:00
Lucas Perais (lpe) 3f2ffca97a [REF] web: remove compile_lib and view_widget from web
These helpers and component should be moved to web_dashboard, which is the only
place they are used. Also, we want to avoid setting a precedent by putting these
in web.

closes odoo/odoo#76912

X-original-commit: 7f4bc27702844cf9b9f010a4ab3c1ac077442ecc
Related: odoo/enterprise#21042
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-09-27 16:56:07 +00:00
Lucas Perais (lpe) 5208c68f0c [FIX] web: dropdown: avoid positioning in mobile
Before this commit, the positioning of the dropdown (which is powered as a poppover)
was executed all the time.

This commit prevents this behavior in mobile, assuming there is not enough space anyway
to have a proper fixed position and that we should use scrolling instead.

closes odoo/odoo#77206

X-original-commit: 1271ef80fafa4438271af0919dcca229aa20bf81
Related: odoo/enterprise#21191
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-27 05:59:46 +00:00
Francois (fge) 2d8c868363 [FIX] web: do_action open twice error dialog
Before this commit, using a do_action that throws an error opened two
error dialogs.
To solve this, in the compatibility layer, we check that the error has
not already been thrown.

To reproduce the problem, you can execute an action using do_action
which will return an error. For example, an action performing an rpc
and the server returns an error.

You can find an example scenario to test the problem on the 2618694.

closes odoo/odoo#77148

X-original-commit: 582604990e28c329348475f373b03295903ed77e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-24 12:35:21 +00:00
Aaron Bohy 800297064c [FIX] web: useTooltip: clearInterval on willUnmount
Before this commit, the useTooltip hooks didn't call clearInterval
when the component using it was unmounted/destroyed. In practice,
it wasn't an issue because the only component using it was the
webclient, and it is never destroyed. However, for this hook to be
usable in other contexts, it is important to remove this leak.

closes odoo/odoo#77113

X-original-commit: d076afd035ad8fadc5a0774c6c0eec15acb15026
Related: odoo/enterprise#21147
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-24 09:45:44 +00:00
Aaron Bohy 9d98d1e870 [REF] web: useTooltip: use template instead of component
Allowing to specify components inside tooltips to obtain dynamic
and/or html content was a bit overkill and unnecessary: a template
can do the trick and it is easier to define.

This commit thus renames attribute "data-tooltip-component" into
"data-tooltip-template" (the name of the qweb template) and
introduces the "data-tooltip-info" attribute (its value is then
available in the template under the "info" variable).

X-original-commit: 8683a8d762339451e3d9f8706aac86da80510b37
Part-of: odoo/odoo#77113
2021-09-24 09:45:43 +00:00
Aaron Bohy 35ac826f94 [FIX] web: effect: display rainbowman by default
In [1], we rewrote the effect feature in the wowl infrastructure.
However, we lost something in the process: the "type" of effect
(basically "rainbow_man" as it is the only implemented effect)
became a mandatory param, whereas before it simply defaulted to
"rainbow_man" when not set. As a consequence, previously defined
effects in views could crash.

This commit fixes that issue, and reworks a bit the feature by
introducing a registry of effects, which easily allows to add new
effects from the outside. An effect is a function that may return
a Component (and its props) to display.

Most of the diff in the tests is about moving files where they
should be (the effect feature being in core/, the tests must be
in core/ as well, and not depend on the webclient).

[1] 0573acae23

Task 2652927

closes odoo/odoo#77109

X-original-commit: 74dc3f654ee5849982b494e46eefb1fc2b4e0c74
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-09-23 20:18:47 +00:00
Mathieu Duckerts-Antoine 99e77f708e [FIX] web: py.js evaluation of current_date
current_date was absent from py_builtin. For that reason, it was
impossible for the search model to evaluate a dynamic domains like
"[('date_deadline', '&lt;', current_date)]"

We add current_date to py_builtin.

closes odoo/odoo#77035

X-original-commit: ade082c5ad9221c82de90ddbe68b814b1487753d
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-09-23 11:26:10 +00:00