Commit Graph
12290 Commits
Author SHA1 Message Date
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
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
Mathieu Duckerts-Antoine 31c9bcaaca [FIX] web: py.js evaluation of to_utc
The class PyDateTime did not have a method to_utc. For that reason, it was
impossible for the search model to evaluate a dynamic domains like
"[('date', '&gt;=', (datetime.datetime.combine(context_today(), datetime.time(0,0,0)).to_utc()))]"

We implement that method.

X-original-commit: 3ad9a3be64da78d596ee3dc435d4b224728a9e76
Part-of: odoo/odoo#77035
2021-09-23 11:26:09 +00:00
Mathieu Duckerts-Antoine dfa90a7ffc [REF] web: patchDate function
In order to be able to easily patch Date in py_date_tests and elsewhere,
we refactor the code of the legacy and new patchDate functions.

X-original-commit: 0e697c82be80cae9cc993b4be179fec42b8dae83
Part-of: odoo/odoo#77035
2021-09-23 11:26:09 +00:00
Prakash Prajapati a61c2ec715 [FIX] web: prevent translation alert from flickering
Before this commit, the translation alert might briefly appear in
form views displayed in dialogs (on new records), just before the
dialog closes.

Task 2639227

closes odoo/odoo#77002

X-original-commit: c9aa20160cd8b1bc9c9bdcd34bb996b8dfefc291
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-23 07:17:47 +00:00
36988d0edc [IMP] *: use new dropdown in legacy too
This commit replaces the control panel dropdowns with the new <Dropdown/> component, in order to get consistent through the new/legacy views (because the current Odoo version is in a state where some views uses the new infrastructure and some others are still not converted - see odoo/odoo#73311).

The diff seems massive, but it is mostly due to tests adaptations.

closes odoo/odoo#77001

X-original-commit: d679cd0d8ba9a2420e81a42a698763e9be2327e1
Related: odoo/enterprise#21077
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2021-09-23 07:17:43 +00:00
Mathieu Duckerts-AntoineandAaron Bohy ee2ae9a75b [IMP] web: deploy ui and hotkey as legacy services
This commit deploys some of the new OWL infrastructure services to the
legacy OWL environment.

The deployed services are the UI and hotkey ones.

These are needed because they are the only prerequisites for the new <Dropdown/>
component to get instanciated with the legacy OWL environment.

As the new reporting views infrastructure has been merged (see odoo/odoo#73311),
the current Odoo version is in a state where some views uses the new
infrastructure and some others are still not converted.

So instanciating the new <Dropdown/> component in the legacy OWL env is
something we chose to do in order to get consistent within the control
panel dropdowns behaviors.

X-original-commit: 6f1ab1cd861549484f94a8d40a16ccf338d7dffe
Part-of: odoo/odoo#77001
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2021-09-23 07:17:43 +00:00
Lucas Perais (lpe) 56dda82a5f [REF] web, *: legacy: lazy loading of legacy reporting views
Since commit 0134495ba5 the reporting
views pivot, graph, cohort are written in full new framework.

Some applications still need the legacy ones, so this commit just implements
the lazy loading of those views.

In stock, report_stock_forecasted has been adapted in order to avoid having
a GraphView override: we now modify the canvas' height in pure JS.

*: board, stock

closes odoo/odoo#76931

Related: odoo/enterprise#21054
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-22 12:22:46 +00:00
William Braeckman e7097fd6e1 [FIX] web: fix calendar quick create removing everything
When an event is currently being inspected by the user, i.e. the popover
is displayed and the user clicks somewhere else on the calendar, we do
not wish to open the quick create menu, only close the popover.
However the code that handled that case was not adapted to the regular
calendar view, only the one from the calendar app and would remove all
data currently displayed.

This commit fixes that issue.

TaskId-2652219

closes odoo/odoo#76939

X-original-commit: ea5c7b643be8c902b03a2ae175c051c479e45ed9
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-09-22 10:58:55 +00:00
Julien Mougenot 6427086210 [FIX] web: Repair web in single module
Since https://github.com/odoo/odoo/commit/344d82ca251bbba8f54e85d6b881cc92f8823f13 :

The `web_editor` module is no longer installed by default in default
databases since it now depends on the `mail` module. This caused a few
bugs inherent to the base modules to surface:

- in the `mock_server` file: performRpc was synchronous and threw
uncaught errors;
- in the webclient scss: the body did not have an assigned with and
height of 100%, which caused some positioning issues.

This commit fixes these problems in the base modules.

closes odoo/odoo#76921

X-original-commit: bc1b14ff8a7d412fbbc5987ed57e2d4cdd00a0a0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-22 06:51:09 +00:00
Aaron Bohy e9961dc5a5 [FIX] web: graph: keep pending filters when toggling a measure
Consider the following scenario on a slow network in a graph view:
 - add a filter (triggers a reload)
 - toggle a measure (triggers another reload, before the first one
   completes)

Before this commit, the new searchParams coming from the first
reload were lost, even though they were still displayed in the
search view.

This commit ensures that we keep the last searchParams when
reloading the graph view.

closes odoo/odoo#76918

X-original-commit: 1719de73099eca0b765237cb47caf44813157b94
Related: odoo/enterprise#21046
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-22 06:50:55 +00:00
Aaron Bohy 5f19d41d32 [REF] web,project: graph: use renderer props convention
By convention, views pass the model instance in props to the
renderer. Moreover, when the renderer needs to perform actions
outside of its natural scope, those callbacks have to be given in
props as well, s.t. the renderer can call them directly (instead
of triggering an event, listened by the parent).

This commit also adds the props validation on the PivotRenderer.

X-original-commit: 0ca538eba780aacca44ab4e34c56d8eed22fa333
Part-of: odoo/odoo#76918
2021-09-22 06:50:54 +00:00
Aaron Bohy cc05e24791 [REF] web: graph and pivot: rework view props
This commit simplifies the props of the GraphView. We only keep
props that are necessary (e.g. for the dashboard view), and for the
others, we find the information in the arch. That way, there's only
one way to do, which is easier to understand.

We also remove the "display" and "title" props from pivot as they
weren't used.

X-original-commit: c26953ef15b0846282bbeccd7cf0de25e1a47392
Part-of: odoo/odoo#76918
2021-09-22 06:50:54 +00:00
Francois (fge) 2de7eb29b0 [IMP] web: move and convert profiling_sweb_view
closes odoo/odoo#76871

X-original-commit: bee8953c3d8b7179bf1f526baa593825f09bfd97
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-20 20:14:07 +00:00
Francois (fge) 97733eae50 [FIX] web: fix Edit ControlPanelView
The debug item "Edit ControlPanelView" is only available if there is
a control panel in the current view.

closes odoo/odoo#76862

X-original-commit: 68cb8d23e2011ed359fc54f3deed6c84290d5c3b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-20 20:14:03 +00:00
Francois (fge) 421a676156 [FIX] web: use makeDeferred from web
closes odoo/odoo#76848

X-original-commit: 2777d187cd72967a1137f851c6c9cc0f9172dcee
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-20 20:13:57 +00:00