DataURL returns 'data:' in Chrome for empty files which is not valid dataURLas
it expects 'data:<mimetype>;base64' . This DataURL method is used to obtain
base64 representation of the file data,. That's why the 'data' argument is
missing and error is being generated.
Steps to reproduce:
1) Open Notes and create a new Note in Chrome.
2) Add a new attachment using /image command.
3) Add an empty file.
By applying this,it will return proper format for empty file.
sentry - 3749971166
closesodoo/odoo#120060
X-original-commit: fd6b904a97e7dab6e720675d9c805ed45eacef1e
Signed-off-by: Samuel Degueldre <sad@odoo.com>
This commit aims to make the SelectMenu easier to use with a better
navigation system, and the ability to select a value with the enter
key.
The bottomArea slot no longer adds a div, which could allow to use
DropdownItems in this slot, and navigate fluently from other options.
Those improvements are required by task-3134491, which will replace
a select2 input with the SelectMenu instead.
Tests have been added for the navigation behavior and the selection
with the enter key.
closesodoo/odoo#119934
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
When the user uploads a file the length of the list will return 1, but when
it tries to retrieve a file which is not in the list or wants to upload another
file while the process is ongoing it will throw a IndexError.
After this commit, the race condition is satisfied i.e. now the user will not
able to upload the file while the uploading is still going on.
sentry-3938949468
closesodoo/odoo#120012
X-original-commit: 482e0034e1a5882ea1e0bc4ddb56d8ef5f5a1a92
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Whenever an user updates a company or a currency, the webclient has to
reload, to properly apply these changes. It is done automatically,
immediately after the rpc has completed.
However, before this commit, it would do that always, even if the rpc
has failed (for example, if the user tried updating an invalid field),
so the user would briefly see an error window, then the browser is
immediately reloaded.
With this commit, we only reload the webclient when the rpc succeeded.
closesodoo/odoo#119730
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, users could not query properties
with the domain selector. Now, all the properties are
listed when selecting a properties field.
task id: 3283212
closesodoo/odoo#115270
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
Before this commit, a domain of the form "[(.., .., -1)]" would be
incorrectly represented in the domain selector as .., .., undefined.
The root cause was that py_js view the sub expression -1 as the
application of the operation - to 1 and thus create an AST of type 6 for
it. The domain selector did not expect to get such an AST but did not
crash either. Here we make it extract the intended value from the AST
for -1. More complex expressions like 3-1 are still not supported.
closesodoo/odoo#119620
X-original-commit: f9604da60c6650ad46aafe08e9fad118654a149b
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
*: l10n_fr_pos_cert,portal_rating,pos_adyen,pos_epson_printer,pos_loyalty,
pos_mercury,pos_restaurant,pos_restaurant_adyen,pos_restaurant_stripe,
pos_sale,pos_six,pos_stripe,web
This is part of the continuous effort of refactoring pos addons towards using
more modern modules and programming patterns (such as services). After this
commit, point_of_sale addons are now left with the use of the legacy
`web.concurrency` module because of the `MutexedDropPrevious`. It's okay to keep
it because it's relatively an independent module compared to other legacy web
module.
The following summarizes the changes in this commit.
- import `_t` from `@web/core/l10n/translation`.
- convert `PosDB` to js native class
- remove use of `format` in `TicketScreen`
- To determine the cached orders are up-to-date, we now deserialize the dates
coming from the server using web's `deserializeDateTime` function. Then,
instead of initiating `cacheDate` as native js Date, we use the luxon's
`DateTime` which is supported by the web date utility methods.
- There is no need for the `format` function from `web.utils` legacy module.
- convert `PaymentInterface` to native class
- remove use of `web.config` module
- remove use of `web.time` module
- use `serializeDateTime` from web.
- remove use of `web.rpc`
- remove use of `web.utils` module
- introduce simple check for email address input
- Replace use of `web.utils.Markup` with `@odoo/owl.markup`.
- 'web.utils'.{round_decimals,round_precision,float_is_zero} copied to
'@web/core/utils/numbers'.{roundDecimals,roundPrecision,floatIsZero}.
- These helper functions are not removed from the web addon because they
are also used from other addons that are not linked to pos.
- `floatIsZero` is now computed by directly comparing the result of
`roundDecimals` to zero. This works because rounding a decimal number
which will result to zero will exactly give zero.
- remove use of `web.field_utils`
- Replace `web.field_utils.parse.float` with
`@web/views/fields/parsers.parseFloat`.
- Replace `web.field_utils.format.float` with
`@web/views/fields/formatters.formatFloat`.
- Replace `web.field_utils.format.date` with
`@web/core/l10n/dates.formatDate`.
- Replace `web.field_utils.format.datetime` with
`@web/core/l10n/dates.formatDateTime`.
- convert `PrinterMixin` and dependents to native class
- `PrinterMixin` is converted to `BasePrinter`.
- `Printer` is converted to `HWPrinter` (extending `BasePrinter`).
- `EpsonPrinter` retained its name and is converted to extend `BasePrinter`.
- Moreover, we also removed the convoluted `PrintResultGenerator`, replaced by
simply creating object with the following signature:
```js
{ successful: boolean; message?: { title: string, body?: string } }
```
- remove use of `web.Session`
- replace use of `qweb.render`
- We use `renderToElement` as replacement to templates that produces valid
html.
- Note that `renderToElement` is introduced in `@web/core/utils/render` module
which is extracted from the original `renderToString` method.
- For the epson printer template, we kept the xml layout and manually add
required xml element to contruct the xml that will be sent to the epson in
making print requests.
- use `Mutex` from `@web/core/utils/concurrency`
- remove use of `Markup` when rendering receipt info (`ticket`) in order to
render new lines.
- Remove use of `jquery` in `htmlToImg`.
closesodoo/odoo#117231
Related: odoo/enterprise#39078
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Before this commit:
The AceField component used the ace library to provide the user a code
editing field
After this commit:
The AceField component is now using the CodeEditor component and the usage
of the ace editor lib is now abstracted behind the component.
closesodoo/odoo#117782
Related: odoo/enterprise#39365
Signed-off-by: Géry Debongnie <ged@odoo.com>
This component was created as an easy way to add a code editing field
without needing a record (unlike the AceField component). It also
completely abstracts the use of the Ace Editor library.
The CodeEditor has been moved to web core as it was needed in other
places.
The name "CodeEditor" was purposely chosen to clearly state what the
component is used for and abstract the use of Ace.
Part-of: odoo/odoo#117782
With commit (1), the clear button is only displayed when a selected
value is found from the available choices. But since we used
shallowEqual to find the corresponding choice, we couldn't use objects
containing objects in its values, since a simple comparison was made
in the utility function. This was a wrong usage of the SelectMenu and
we don't want to support objects and arrays as values. The value
attribute should only be a string, and it's the parent responsability
to handle any object related to this string.
The test using an object and an array as values has been removed since
it had no purpose after the removal of this partial and wrong support.
With this fix, an assertion for the presence of the clear button has
been added instead for the import action.
(1): d760b81271closesodoo/odoo#119298
Related: odoo/enterprise#40177
Signed-off-by: Géry Debongnie <ged@odoo.com>
We refactor the ModelFieldSelector and ModelFieldSelectorPopover
components.
We also improve a bit ModelFieldSelectorPopover:
- on first page, the button to go back is no longer available
(so that it is now more difficult to produce an invalid path)
- we always start with a page presenting the model where the last
selected field name belongs to
- the keyboard navigation is improved
- click on model field selector opens the popover with the focus in
the search input (if any)
- for relational fields in popover: the user can either click on the
relational field (and select it) or a special button that make him
follow the relation to the field comodel
We also refactor the hook useDynamicPlaceholder to make it use a new
component DynamicPlaceholderPopover that uses ModelFieldSelectorPopover.
Task ID: 3272798
closesodoo/odoo#117951
Related: odoo/enterprise#39673
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
This commit allows the customization of the bottom area of the SelectMenu
component. The slot can show additional information, of handle any feature
related to the state of the component, such as adding elements, etc. It can
support any kind of content, so it could be used to display all kind of
useful content.
Two test have been added using this custom slot, asserting its presence and
testing an interaction with its content.
This changes is required to use the SelectMenu component in Knowledge, in
task-3134491
closesodoo/odoo#117890
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The objective of this commit is twofold:
- improve the style of the DomainSelector component, in particular, the
style of the control buttons "Add node", "Add branch", and "Delete node".
- add the possibility to reset the domain when the current domain is not
supported. The debug input is also always visible in that case
if the debug mode is active. It is displayed in readonly iff the
corresponding DomainSelector prop is set to true.
Task ID: 3269923
closesodoo/odoo#118057
Related: odoo/enterprise#39512
Signed-off-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
The old submenu "Add Custom Filter" of the menu "Filters" is now replaced
by a menu item "Advanced Search". Click on that item will open an
"Advanced Search" dialog in which the current search domain is displayed
in a domain selector. It is then possible to easily add/remove/edit some
parts of that domain before make a new search with the edited domain.
Task ID: 3269923
Part-of: odoo/odoo#118057
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
**Before this commit**
Almost all of the use cases of the `usePopover` hook are dealing
with an abnormal amount of complexity:
- they have to store the closing function of the popover, and sometimes
keep track to its opening state,
- you can find a duplication of a useUniquePopover hook, which is
anyway the behavior that is always wanted for popover users.
This is due to the fact that usePopover is just some kind of wrapper
to the lower level popover service.
**After the commit**
- The usePopover now has a new API, which simplifies its usage.
- The useUniquePopover hook implementations have been removed and
this "unique" behavior is now merged into usePopover
and has become the standard one (not configurable).
- All of the use cases have been adapted, even the cases where
components used directly the popover service (through `useService()`).
See the adapted jsDoc around the hook in popover_hook.js
closesodoo/odoo#118066
Related: odoo/enterprise#39654
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
**Before this commit**
Only four positions authorized for popovers:
- bottom,
- left,
- top,
- right.
These four positions are by default with the "middle" variant.
But the positioning hook could replace the variant with "start" or "end"
and furthermore the popover already handle those cases to properly
place its arrow.
So it does make sense to authorize all the possible variants as well.
**After this commit**
All the following position are available to popovers:
- {bottom|left|top|right}-{start|middle|end|fit},
- {bottom|left|top|right} (same as {bottom|left|top|right}-middle).
Part-of: odoo/odoo#118066
New module that would allow restaurant customers to see the menu on their own devices by scanning a qr code and navigating to the provided link.
Task id 3232765
closesodoo/odoo#114022
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Before this commit:
It is not possible to add a popover in an iframe (with the popover
service of an app from outside the iframe).
After this commit:
The position hook now finds out the possible target's iframe element,
from which it can compute an offset so it could position properly the
popper element.
Known limitations:
The popover element is not attached inside the iframe's DOM, so there
may be some cases where the popover is shown outside of the iframe
(depends on scrolling).
closesodoo/odoo#116499
Taskid: 3184061
Related: odoo/enterprise#36168
Signed-off-by: Arnaud Joset <arj@odoo.com>
Co-authored-by: Leonardo Pavan Rocha <lpr@odoo.com>
**Before**
The "reference" argument of the usePosition hook is badly named as it
easily be confused with useRef's references.
**After**
The argument has been renamed "target",
which is a terminology used in other places, for example for popovers.
Part-of: odoo/odoo#116499
How to reproduce:
- create a list embedded view in Knowledge (/item list)
- in the control panel click on "Filters"
Current behavior:
- the dropdown is not correctly positioned
Expected behavior:
- the dropdown should be positioned around the button
Fix:
`getBestPosition` uses dimensions and layout positionning based on the viewport,
but `reposition` modifies the style properties `top` and `left` of the element,
which are relative to the closest containing block. Since in that case the style
position is `fixed`, there are a number of factor that can influence the
containing block, as specified in:
https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
We can easily compute the layout offset caused by the containing block just
after resetting the popper top and left to `0px` and take it into account for
the final value.
Task-3267555
closesodoo/odoo#118018
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
We move the function loadFields from the view service to a newly created
field service. That service can also be used to load model fields for a
given path (loadPath), i.e. load all model fields for the models
traversed by the given path.
We use loadPath in useModelField and DomainSelector.
closesodoo/odoo#117882
Related: odoo/enterprise#39418
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
We introduce two new methods for Cache:
- a method "clear" that can be used to delete a specific path
- a method "invalidate" that can be used to delete all paths
Part-of: odoo/odoo#117882
This commit adds a new prop to the Dropdown component: autoOpen.
It is true by default and follows the current behavior of all
current dropdowns (automatically open the dropdown when it is
hovered and a sibling is already opened) when set to true and
disable this feature for the dropdown when set to false.
The commit also applies this new property and set it to false on
all small icon dropdowns that are present by default in the
enterprise navbar to facilitate navigation with these (debug,
messaging and activity)
opw-3259473
closesodoo/odoo#117622
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
This commit removes the manualOnly prop on the Dropdown component
and all its related code because it seems unused.
opw-3259473
Part-of: odoo/odoo#117622
This commits makes the TagsList component able to display icons as well
as images were previously supported. A test has been added to verify the
presence of the icon set in each tag.
closesodoo/odoo#117751
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*: project
This commit adds test to this component and removes unused props. Since commit (1),
it is now considered as a core component. Those props have been removed from the
props declaration, to better match the real usage of the component.
Since the className props was not present:
- The o_kanban_tag class given in theory were not set in practice. The rules
corresponding to that class were already adapted to fix the display of tags in the
kanban view. It was possible to get rid of the references to the o_kanban_tag class.
- The o_field_property_tag_readonly class was also missing, and the logic to prevent
the click on tags was duplicated in the onTagClick function. This makes the class
useless. I removed mentions to this classname. Instead, each tag has the pe-none class
using the same condition, but set in the tag declaration.
(1): 129fa3f150
Part-of: odoo/odoo#117751
When we use a 12 hour time format (without the `%p`), the time set is
always in the morning regardless of the period used (AM or PM).
Using `preparse` and `postformat` in the locale to change the symbols
used for numbers prevents the user from changing the date in the
datepicker because the date will be unparsable
Steps to reproduce:
1. Install Calendar
2. Go to Settings > Translations > Languages and open 'English (US)'
3. Set the time format to `%I:%M:%S`
4. Open Calendar and create a new meeting in the morning
5. Edit the meeting, set the time period to 'PM' and save
6. The time of the meeting doesn't change
Solution:
Get the time from the event passed when we close the bootstrap
DateTimePicker and convert it to luxon.
The period displayed when we open the datepicker is always 'AM'. This is
a limitation with the bootstrap DateTimePicker that uses the value from
the element[^1] (which is already formatted with the 12 hour format,
without the period info). Hence, the time is always in the morning
Problem:
The value of the element is used to set the date but this value is
already formatted with the 12 hour format (without the period info) so
it's always in the morning
opw-3150033
opw-3233229
[^1]:https://github.com/odoo/odoo/blob/16.0/addons/web/static/lib/tempusdominus/tempusdominus.js#L395closesodoo/odoo#117781
X-original-commit: dc195613ecff17d6aadc6e6ad8ab6da3670eb85a
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
Before this commit, in multiselect mode, clicking on a selected choice in
the dropdown did nothing. Now, while hovering, the choice's background
becomes red and clicking on it will remove it from the selection.
Part-of: odoo/odoo#115799
This commit fixes an issue where when a value without a corresponding
choice was given to the SelectMenu, we would display it as a
string. It was missleading as it looked like an option was selected.
Now giving a value with no corresponding choice will result in the same
behaviour as giving no value.
Part-of: odoo/odoo#115799
Before this commit, the `SelectMenu` component didn't support object
in the value props of the component.
This commit allow us to use object in the `SelectMenu` value props.
Part-of: odoo/odoo#115799
This commit makes some changes to the SelectMenu and DomainSelectorDialog
components, since they are now used by web_studio, in the sidebar editor.
Those changes makes them more in line with the features that were used by
their legacy counterpart.
Part-of: odoo/odoo#115799
This commit improves the Notebook component to support the ability to
disable some tabs. Once the page is disabled, the tab is greyed out
and set as inactive. Also, an icon can be placed in the tab, before the
label.
This change is used since the Notebook component is used as the sidebar
element during the web_studio refactor. The sidebar needed to disable a
tab depending certain conditions. Now, the component has this behavior
by default once a page has the isDisabled attribute.
To display an icon before the label, you can use the icons props, as an
object, which keys are page names, and values are font awesome classnames.
A test has been added for each new feature introduced.
Part-of: odoo/odoo#115799
This commit adds a new service "overlay" that will be used as a base
for other service which displays a component on foreground like
"popover" or "dialog". The services "popover", "dialog" and "effect"
already uses this new service to have a common container.
The "overlay" service also fix a stacking context issue that could
happen when a popover opened a dialog and this dialog then opened
another popover thanks to the common container.
task id: 3233266
closesodoo/odoo#115308
Related: odoo/enterprise#38786
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
The operator =? is recognized by expression.py as a valid operator but
was not recognized by the Domain class (see the method "contains") as
such.
closesodoo/odoo#116914
X-original-commit: b6495bd51295c513ab0d5c083560ac3a1236bd4f
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The web client has a mechanism to invalidate the action and the view
cache: in the basic model (and the relationalmodel), some code is
looking for updates to some specific models (such as ir.actions) and
trigger a `CLEAR-CACHE` event. This event is then listened by the action
and view services to properly clear the caches. This mechanism was also
used to reload the page after editing a company, or reloading the
currencies after editing some currency.
With this commit, we modify the orm service to trigger an event after
each rpc. This event can then be used by the action/view service, and
also by the currency/company services to perform their specific cleanup.
This work is one step in the future refactoring of the relational model.
closesodoo/odoo#115655
Related: odoo/enterprise#38814
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, when a user moved its mouse from only a few pixels,
a kanban record could not be clicked on it, or an item in a sortable list
couldn't handle the click, since the dragging state was immediatly applied
to the element.
Now, there is a 10 pixels tolerance, meaning that the dragging sequence is
only applied once the user has moved the cursor from at least 10px horizontally,
or vertically from the original point where the mouse button was pressed and
remains down. This reduces frustation when the user didn't intended to move the
kanban card with the mouse moving by mistake.
A test has been added to verify the behavior when dragging an element in a sortable
list, from at least 10 pixels.
Finally, a test had to be modified, since the triggered mousemove didn't had any
clientX value to enable the dragging sequence.
task-3233698
closesodoo/odoo#116113
X-original-commit: 7e7c950f07b6455118902c15f4354e6ff45ce509
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
* The tours are now run by the `MacroEngine` defined in `macro.js`.
* This is accomplished by converting (at runtime) the user-defined tours to
`Macro`s. See `tour_compilers.js` for the step (and tour-to-macro) compilation.
* API is kept the same as much as possible. Basically, declaring tours stayed
the same with some exceptions:
* `allowInvisible` can be provided in a step to allow consuming the trigger
element even if it is invisible.
* `isCheck` can now be used to replace the no operation `run` that is
traditionally signals the runner to only perform a check.
* Before, multiple `run`s can be called simultaneously. Now, each `run` method
is awaited before proceeding to the next step.
* If the trigger element is `disabled`, the tour runner will *not* proceed on
calling the `run` method and the runner will stay on current step until the
trigger element becomes `enabled`.
* However, the tour runner is okay with `disabled` trigger element if the step
has `isCheck = true`. As long as the trigger element is found for `isCheck`
step, the tour runner will happily move to the next step.
* Some tours are adjusted to properly run with this new tour runner.
* When the tour failed:
* The dom string is not logged anymore.
* However, a warning message containing the relative location of the step will
be logged. This is better in helping the author in locating the failed step.
**Some guidelines learned during the development:**
* Each step may trigger a dom mutation. It's a good practice to insert an
intermediate step that *checks* the existence of an element that result from
the action of the previous step.
* Refrain from using the `run` method for assertions. `run`, in principle, is
provided to perform actions that are not offered by the helper. Use the
`trigger` for assertions.
* During dev, find `SHOW_POINTER_DURATION` and set it to `250`. This will show
the pointer (pointing to the trigger element) for 250ms when watching the
tour.
closesodoo/odoo#107618
Task-id: 3082036
Related: odoo/enterprise#37560
Signed-off-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
With this commit, we can now customize the Dropdown component to
make it disabled.
closesodoo/odoo#115201
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit introduces two small improvements to the autocomplete
component:
- the ability to autofocus the input, once it is mounted
- the ability to set an additional class to its root element
closesodoo/odoo#115142
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
This commit fixes the same problem as the commit #113284
The previous commits partially fixed the solution, but the target can
still disappear between the moment where the `popover_service` adds the
popover and the moment where the setup of `PopoverController` is called.
The solution of this commit is the last defence against the undefined
target, #113284 will be kept as it prevent some owl computation if the
target is undefined at this state.
closesodoo/odoo#115032
X-original-commit: f6c309e595bf76d8ed8bb8c19228795572a8760c
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Dardenne Florent (dafl) <dafl@odoo.com>
This commit fixes the behavior of the FileInput component. Since the html
element of type input doesn't trigger its onChange when a file with the
same name is given twice to the input, we must first clear the input value,
which will cause the input to handle the file even if the input already
contains this file.
Even if that seems unnecessary, this is an easy way to fix issues in the
base_import action were data are not send back to the server when re-uploading
the same file to let the server process the data.
A test has been added to assert that the onUpload is effectively called twice
when uploading a file, even if it's the same exact file.
closesodoo/odoo#114978
X-original-commit: d4a23c521d0e15f893d74e3530bc68ef19641f48
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
This commit moves `removeDomainLeaf` in domain.js to be able to use
the method everywhere in the JS Code and not only in the gantt view.
task-2702636
Part-of: odoo/odoo#108605
After this commit, the user will be able to move dialogs
to see the content hidden behind the dialog.
closesodoo/odoo#111654
Task: 3132894
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*: point_of sale, web
Previously, the error handling code was refactored and centralized, in
doing so, we broke the ability to select a table while offline: when
selecting a table we ask the server about the orders for the table. When
offline, this creates an error that was previously caught, and showed an
offline error popup, but continued the rest of the flow normally. The
refactoring centralized the display of offline errors to an error
handler, but removed the catching, causing the error to interrupt the
flow.
This commit fixes that by catching the error again, and when it's a
ConnectionLostError, it dispatched the error in a separate async call
stack (using Promise.reject) so that the display of offline errors is
still centralized, the the flow can continue normally.
closesodoo/odoo#114077
X-original-commit: f45f5e644b4b219b968fa19737d75cc710c823f3
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
The aim of this commit is to make more warning and error dialogs behave
like the "oh snap" dialog of form views.
task-id=3126594
closesodoo/odoo#112276
Related: odoo/enterprise#37593
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
It may happen that the response of a json rpc isn't json parsable,
for instance when the connection pool is full (PoolError). In this
case, the response is an internal server error (500) in html.
Trying to json parse it throws an error. Commit [1], backported in
15.0 by [2] aimed at throwing a more readable and meaningful error
when this happened.
However, this error occurs frequently on the saas for the moment
(see task 3193565), and users constantly report those HTTPError
tracebacks introduced by [1].
In 14.0, we were using jQuery ajax, and the legacy rpc and error
system, where those internal server errors were handled as
connection lost errors (error code -32098). So basically, a
notification was briefly displayed instead of an error dialog.
This commit restores the previous behavior in the new rpc service.
[1] https://github.com/odoo/odoo/commit/5c4a54022b320
[2] https://github.com/odoo/odoo/commit/a01122543a79cclosesodoo/odoo#113434
X-original-commit: 278686d8540a194f0af51e1a0b68b26b13eaf544
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>