*base_automation,iap,im_livechat,point_of_sale
This commit introduces a new file in core/utils: hooks.js
This file contains custom hooks (useEffect, useService, useBus...).
The useHotkey hook is tightly related to hotkeys, so it has been
moved to core/hotkeys.
closesodoo/odoo#74535
Related: odoo/enterprise#20003
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Have an action in the breadcrumb (A)
Do an action (B) that has a button which spawns a dialog with a onClose callback executing an`history-back` event.
This may be useful when the action (B) acts as a selection buffer between (A) and the dialog.
(e.g. stock_barcode: execute `stock_barcode_client_action` from a picking)
Before this commit, the history-back event just closed the dialog without going back to the action (A)
This was because the wrong condition was used to determine if the dialog was still alive or not.
After this commit, the action (A) is displayed when closing the dialog from any point.
Opportunity is taken to clean the various follow/join/invite methods into only
one `add_members` method.
Part of task-2360169
closesodoo/odoo#74425
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
The readonly would not clear the old content when new content was put
through an onchange.
closesodoo/odoo#74476
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The purpose of this commit is to make the palette command customizable.
From now, it will be possible to add spaceNames to modify the commands
displayed in the command palette.
For example, if I add the spaceName '@' and associate a provide function
with it, then when I type "@" in the search bar of the command palette,
the commands generated by provide will be displayed.
const commandProviderRegistry = registry.category("command_provider");
commandProviderRegistry.add("example", {
nameSpace: "@" ,
provide: (env, options = {}) => {
return [{name: "myCommand", action: () => ()}]
},
});
It will be possible to define several provide functions for the same
namespace. This will make it easy to add new commands when installing
a new addon.
Now it is possible to define commands that modify the state of the
command palette. This allows a command to change the placeholder
and commands displayed in the command palette.
closesodoo/odoo#73750
Related: odoo/enterprise#19970
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This makes the debug menu more natural to use, and makes the difference
between the "in-dialog" and "out-of-dialog" debug contexts explicit.
closesodoo/odoo#74346
Related: odoo/enterprise#19967
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
With this commit: we remove click event from attachment_image widget, this is
specifically done so that when user clicks on kanban cover image kanban record
is opened, actually kanban record global click check if any of the child has
click event then it does not open on click.
task-2524022
closesodoo/odoo#74383
X-original-commit: a46b9ac37a0121102ddab44eca5ba6d6be82cb80
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
before this commit: when deleting or archiving or unarchive all records of last
page in listview user is displayed with NoContentHelper while we still have
other records in previous page, user should be moved to previous page if all
records of last page are deleted.
after this commit: if user deletes or archives or unarchives all records of
last page in list view then user is moved to previous page.
task-2446911
closesodoo/odoo#74091
X-original-commit: cead08fe6876239d1260b40948fcd74069496a2c
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Currently, When the One2many list contains a large amount of fields and the
user clicks or resizes the header, list takes table width as its initial width
and because of this list to overflows outside of the form view.
Issue raised after commit: d58edef12a
after this commit, clicking or resizing the list header does not impact the
width of the list.
TaskID-2388582
closesodoo/odoo#74277
X-original-commit: a145e1242118d3e539790327221486e1bd94e59a
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
The frontend code was still using the legacy RainbowMan, with the wowl
webclient, we rewrote this RainbowMan and started using that one
instead, but because the frontend code had no access to the wowl
environment, the legacy version was still used in the frontend. Since
the frontend now has access to the wowl environment, the old code can be
removed and the calls can go through the new effect service.
closesodoo/odoo#74148
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, it could happen that the test fails.
We may be waiting too long on the second click in the test and so
the form switches to edit mode too early.
Now, we don't await the click to keep sync.
closesodoo/odoo#74157
X-original-commit: 01708583777cf33e9b505a494fdc5cdb66db86b5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit avoids displaying commands associated with the wrong active
element in the palette command.
closesodoo/odoo#74149
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit: when standalone label is rendered in form view class
o_form_label_empty is not added due to which label text is not muted.
After this commit: when standalone label is rendered, label is sometime
rendered before field widget is rendered due to which o_form_label_empty class
is not added to label, with this commit we postprocess labels so that
o_form_label_empty is added on all field labels.
Also with commit, signature widget's isSet method will return true if value is
set in signature widget, this will make label of signature widget muted if it
is empty and form view mode is readonly.
task-2523197
closesodoo/odoo#71322
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Before this commit: remaining_days widget is not editable and it just shows
information based on value like, Today, Yesterday, Tommorrow etc, when we
change mode to edit it should have date/datetime picker so that user can change
value of the widget.
After this commit: remaining_days widget will display date/datetime picker in
edit mode and in readonly mode it will display delta between the value of the
field and today, it will also support edition of date/datetime value in multi
edit mode.
task-2507961
closesodoo/odoo#70578
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Currently, the time in popover of the year view does not appear
with the title due to record.allday is undefined instead of false
So in this commit, check if record.allday is not exist then display
the time infront of the title instead of after the title.
Related enterprise PR: https://github.com/odoo/enterprise/pull/19134
closes odoo/odoo#72440
Closes: #72440
Taskid: 2502339
Related: odoo/enterprise#19134
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
Try to download a report file but knowing that the controller will raise an Exception
in the case of l10n_be: Tax Report
Remove the VAT number on the Belgian Company and export the report as xml
Before this commit, the error was not well handled, i.e. a traceback was shown
After this commit, a Redirect dialog is shown, giving the possibility to the user to go
on the company's list view and change some company's fields.
closesodoo/odoo#74021
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
When dragging out the last record of a filtered column, its filter is cleared and the column is reloaded.
Taskid-2454209
closesodoo/odoo#72755
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
BEFORE
Various scenarii leads to inconsistencies on the progressbars when a filter is activated:
- when dropping in a non matching record
- when the view domain is updated (e.g. from some input in the search panel)
NOW
These scenarii works fine.
Taskid-2491196
Taskid-2454209
Add HTML fields support to kanban view (currently bespoke but maybe it
should be done via `format`), and remove t-raw for HTML fields there.
Also just strip some t-raws which were completely unnecessary to start with
Descriptions which need to use markup should be explicitly marked as
such. Update examples test to check that both Markup and String
descriptions work fine.
`escFormat` had to be modified quite a bit and ended up requiring
being its own Markup-adjacent type: if the `sprintf()` result is wrapped
in a `Markup`, then what happens is we first decide to escape because
the object returned by `escFormat` only has a `toString()`, then that
blows up because `toString` returns a non-primitive object and the
regex used to implement `_.escape` is very very unhappy.
`escFormat` could return a `Markup` object but then it wouldn't be
lazy anymore which would rather miss the point.
Therefore implement `[_.escapeMethod]` on the thing, such that it
doesn't get escaped, because it's safe (ish).
Also as a result the icons probably don't need to be markup-ed. Oh
well shouldn't really matter.
A note concerning the attributes which I will probably need to take a
look at in the vdom version: the Python version has to process attf in
order to stringify individual elements, and separately stringify the
attribute value so it gets forcefully escaped even if it's
markup-safe (because markup-safety and attributes-safety are
different).
The first should not need to be performed on the JS side, because
Markup can not overload addition, therefore in JS String + Markup is
String whereas in Python it's Markup (and the String gets forcefully
escaped). In general, js!markup is currently much simpler than
py!markup, both by necessity (can't overload operators) and
simplicity (we might want to overload some of the operations
e.g. String#replace, but that's complicated and it's not been strictly
necessary for now).
Also wrt Markup / _Markup: `class` ctors can only be invoked with
`new` meaning they can't be used as template strings or regular
functions. Here `class` is useful to avoid the mess of calling the
super's constructor explicitly (which may not even be possible for
`String`), however it means we need a facade function to support our
use-cases.
Also update `utils.sprintf` to be Markup-aware: if the format string
is a Markup object, interpolated values get automatically escaped (if
necessary) and the result remains a Markup object.
If we need to perform explicit instance check we can always set
`Markup.prototype = _Markup.prototype` (I think), however in theory
that's not necessary: there are protocols in place for the relevant
pseudo-escaping operations and they ought suffice.
qweb/js divergence from qweb/py
===============================
Unlike qweb/py, qweb/js will *not* return a Markup object. That is
because in js a primitive `string` and a boxed `String` object don't
match when typechecking, and while `markup instanceof String` passes,
`typeof markup === 'string'` does not.
The overwhelming majority of string typechecks are the latter: there
are all of 6 `instanceof String` in the entire codebase, all in
dependencies, while there are hundreds of `typeof $X === 'string'`,
several of which get fed the output of template rendering
e.g. `jQuery.parseXML` or `AbstractView#init` (some widgets will
render a template then use it as the `arch` of a subview, so
`viewInfo.arch` can be the output of a qweb template rendering). This
makes for very annoying and somewhat gnarly debugging.
Plus jQuery in particular really doesn't like being fed a boxed
String, as it will interpret said boxed string as an array, and assume
it's an array of DOM elements to wrap, leading to a rather strange
jQuery object as output. Since feeding the result of a template
rendering to jQuery is a major use-case in non-vdom widgets... that's
a bit of an issue.
For the same reason while `_.escape` is `Markup`-aware, unlike
`markupsafe-escape` it does not *produce*, though it is
`Markup`-transparent.
This commit adds an optional "toggler" props to the Dropdown
component. If set to 'parent', no toggler will be generated by
the Dropdown component. Instead, the parent element of the dropdown
will be its toggler.
closesodoo/odoo#73858
Related: odoo/enterprise#19702
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
The dropdown Component takes 2 slots: one for the toggler, and one
for the actual dropdown content. Before this commit, the default
slot was the toggler, and the other one was named "menu".
However, as the toggler is actually optional, and the "menu" slot
contains the central information about the dropdown, we decided to
swap them. The content of the dropdown is now the default slot and
the toggler can be specified with the "toggler" slot.
The purpose of this commit is to have a test environment
that does not depend on the OS of the machine
on which the Odoo server is deployed.
Because the navigator.platform is deprecated, we will use the
navigator.userAgent to identify the OS.
Purpose
=======
If the counters are enabled, this could lead to inconsistent counts,
as the session context (with allowed_company_ids) is not passed, and the
multi-company rules are not applied properly if we fall back on another
company that the ones on which the user is logged.
Previously, push_state events triggered from withing window actions
inside dialogs would bubble push their state into the URL even while
within a dialog, this is undesirable as this can cause the URL to become
invalid (eg by pushing the id of a record from an entirely different
model)
This commit fixes that by simply checking whether we are in a dialog
within the adapter before calling pushState.
task-2602458
closesodoo/odoo#73720
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
In previous commits, all references to the legacy notifications and
notification service have been removed, this commit removes the now
unused legacy notification and notification service
Part of #72675
When writing the new webclient, the notification service was rewritten,
and all of its uses in production code were changed to use the new
services, however, some tests were still reliant on the old notification
service.
This commit removes references to the legacy notification service so
that we can be one step closer to removing it from the code base.
Part of #72675
Bug
===
Since cc67988241 a new option is available
for the reference widget.
When the new option "model_field" is used on a reference field in a list
view, after saving and then editing, we need to change the model to be
able to select the records
Links
=====
Task-2127615
See odoo/odoo/pull/46304
See odoo/enterprise/pull/7701
See odoo/upgrade/pull/848
closesodoo/odoo#46304
Related: odoo/upgrade#848
Related: odoo/enterprise#7701
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit, the modified test sometimes failed on runbot.
We need to wait for an extra tick, because the dialog might be
rendered in another animation frame that the crashing client
action.
closesodoo/odoo#73675
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Since [1], the modified test was failing randomly on runbot. Here
is what happened when it failed:
- the initial action crashed
- we toggled the menu dropdown
- an error dialog was displayed -> the active element changed
- the dropdown was closed (due to commit [1])
- we asserted that the dropdown contained 3 items, but it was
closed, so test failed.
[1] https://github.com/odoo/odoo/commit/300ef9ac6fc92bcfd9c37a6088df650e0af32018
In the case we have a legacy dialog calling a new dialog,
tabindex set on the legacy dialog prevents the new dialog
to get focused as well as its children.
Because of this, we cannot select text or focus text input/area
in the new dialog.
closesodoo/odoo#73639
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
before this commit, the name of the event and hour is not
correctly centered while dragging the pill in month mode.
This commit fixes the issue by adding the CSS property.
after this commit, the name of the event and hour should be
correctly centered while dragging the pill in month mode.
TaskID-2506060
closesodoo/odoo#73553
X-original-commit: 59156daa150bf285626600f0a999dfe9838e1344
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
The purpose of this commit is to:
- Improve the design of the command palette
- Add few data-command-category and data-hotkey
- Scrolling through the command palette dropdown with the up/down arrows
should loop
- Moving the mouse over the palette command no longer causes scrolling
Task-2590390
Before this commit, if there was a crash in a view or client
action during an update (i.e. the action is already in the DOM,
but an update triggers a re-rendering), the error was caught by
the action service, it wasn't displayed to the user, and the
action was re-rendered again (which could obviously result in the
same error being thrown again and again).
With this commit, we properly show the error, and we do not try
to re-render the action.
closesodoo/odoo#73507
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
From this commit:
- It is possible to modify the overlayModifier allowing to display the
overlay and to access the data-hotkeys defined in the Dom.
- Adding a hotkey using the service or hook does not add the
overlayModifier anymore.
closesodoo/odoo#73279
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Sergey Shebanin <sergey@shebanin.ru>
Before this commit, when hovering a button with a bootstrap tooltip set on it
(form view with header button in debug mode) and then clicking while staying hover
the tooltip was not destroyed and there was no easy means to destroy it.
After this commit, any click within a legacy context remove any bootstrap tooltip from the DOM,
since popper and tooltip are not meant to be used in the future in a wowl setting.
closesodoo/odoo#73447
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
* google_recaptcha, mail, partner_autocomplete, point_of_sale, website
Now, to read session information, the module "@web/session" must be
imported. Not that, there is also the user service with all the user
information.
closesodoo/odoo#73201
Related: odoo/enterprise#19434
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
- Install Sales > Configuration > Settings and activate Delivery Methods
- Create a SO as followed:
* Add a section (i.e. Section 1)
* Add a product (i.e. Product A)
* Add a product (i.e. Product B)
* Add a shipping (i.e. Delivery X)
* Add a section (i.e. Section 2)
* Add a product (i.e. Product C)
- Move (drag & drop) Delivery X to the first place
SO lines are reordered, but Product B is moved after Section 2.
It comes from the fact that some lines have the same sequence and that
only the lines between the source and the destination position are
re-sequenced.
Before the move, the sequencing is as followed:
1) Section 1: 10
2) Product A: 10
3) Product B: 10
4) Delivery X: 11
5) Section 2: 12
6) Product C: 13
After the move, only lines from 1 to 4 are re-sequenced. Leading to the
following sequencing:
1) Delivery X: 10
2) Section 1: 11
3) Product A: 12
4) Product B: 13
5) Section 2: 12
6) Product C: 13
As Product B has now a greater sequence than Section 2, it will be moved
after it.
If some lines between the source and the destination position have the
same sequence, all lines should be re-sequenced to prevent such a behavior.
opw-2531524
closesodoo/odoo#73456
X-original-commit: 8f64ac8ff2b94b66a8d8e94a8635727d0d53ca6b
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
Currently, the optional field's dropdown displays outside of the form view when
columns are expanded. it happens because the left css property is applied when
the column is expanded.
This commit fixes the issue by applying the correct css property after this
commit, the optional field's dropdown should always be positioned on the
right side of the list in ltr mode.
closes#69727
TaskID-2510187
closesodoo/odoo#73411
X-original-commit: bbc338438518bbb7d0e9ad1a313e872f95a36870
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Before this commit: when clicking on an editable state_selection widget in
listview, the dropdown is not displayed. this is happening because overflow
of cell was hidden.
After this commit: when clicking on an editable state_selection widget in
listview, the dropdown is displayed. change overflow to visible for
state_selection column. Also fixed the issue when selecting option from
state_selection widget row was get edited or if it is not editable listview
then view is swithed to form view, it is because of event propagation which
we stopped here.
Task - 2485883
closesodoo/odoo#68129
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Before this commit, two tests had undeterministic outcomes:
they wanted to assert something in DOM was present at the same tiome as an owl rendering
After this commit, the problematic asserts are removed and the tests behave deterministically.
closesodoo/odoo#73379
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
before this commit: if user enters some random value in daterange widget and
click outside the daterange field it throws traceback while it should not throw
traceback, it should only warn user that you are entering wrong value.
after this commit: if user enters some random value in daterange widget then it
will show warning toaster that you are entering wrong value.
task-2410523
closesodoo/odoo#73366
X-original-commit: 588d133f3daf28e0ce69052ae57ad89c5a96eb3a
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Do an action that will change the hash.
During this, change the url hash to load another action
Before this commit, the hash taken to load the second action was wrong, because the first
action pushed its state instants before the hashchange event is actually triggered.
This is because the hashchange event is triggered in a non blocking stack
(https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-fragid)
After this commit, the right action is loaded with the right hash
closesodoo/odoo#72878
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
When the owl refactoring landed, we rewrote the pyjs evaluation system.
Then, we used the new system in the new code. In particular, the action
service uses it to evaluate the action domain.
But the previous code had a subtle behaviour in the special case of
evaluating domain: it added the context as a pydict object in itself, so
one could evaluate expression such as `context.get('a', 14)` to read the
value of a key in the context with a fallback.
With this commit, we uniformize this behaviour across all python
expression: the `context` key is now reserved, and used to access
anything in the current evaluation context.
closesodoo/odoo#73227
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
With this commit, we can simply skip performing a rpc when we know that
the id list given to read/unlink is empty.
closesodoo/odoo#73063
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>