Commit Graph
4126 Commits
Author SHA1 Message Date
Aaron Bohy 42ee5c346c [FIX] web: debug menu: can get view
Since commit [1], there was a crash when the user clicked on the
"Get View" item in the debug menu (in any views). This was because
the arch now received by the views in props is an XmlDocument,
whereas before it was a string.

[1] odoo/odoo@cc3a3a328d

closes odoo/odoo#137668

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-06 03:21:50 +00:00
Bruno Boi 5557853f4b [FIX] web: keep the searchbar dropdown in place
**Before this commit**
Open the SearchBarMenu dropdown, then add
numerous filters or groupbys.
When doing so the search bar may grow or shrink,
leading to the dropdown being repositioned while
you interact with it.
This gets really annoying when you are using your
mouse.

**After this commit**
The dropdown will stay in place while your
pointer is inside and get repositioned as
soon as your pointer leaves the dropdown.

**Implementation Notes**
- The usePosition hook now returns an object with functions
  that allow to lock/unlock the positioning updates.
- The "fixedPosition" usePosition's option has become
  obsolete with this new mechanism and has thus been replaced.

closes odoo/odoo#137449

X-original-commit: 3e883a2a1af07875efd7dea8de39cf9914d2a0de
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-10-06 00:55:54 +00:00
Michael (mcm) 89693faebb [FIX] web: fix http.post array params
Since [1] an error was thrown when giving multiple files to http.post.
This commit reverts changes in the function but the function now also
allows to give a FormData instead of pojo.

[1]: https://github.com/odoo/odoo/pull/136271

closes odoo/odoo#137421

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-05 15:36:19 +00:00
Jorge Pinna Puissant ef424a9dc2 [REF] *: remove owl from linter's accepted global variables
Before this commit, owl was in the linter's accepted global variables.
This allowed  direct access to owl global object.

For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`

Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:

`import { xml } from "@odoo/owl";`

task-id 3498859

closes odoo/odoo#137517

Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-05 10:21:53 +00:00
Damien Bouvy ae62a08cbc [IMP] web: fetch raw data for record in debug
This commit introduces a new debug menu item in form view that allows to
read all the raw fields data of the current record in JSON format.

task-3509462

closes odoo/odoo#137260

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-05 08:08:58 +00:00
Saurabh Choraria 2cf99aa452 [FIX] web: groupby date for pivot view
When user tries to apply any Group By as date or datetime in the pivot
view and the column value of pivot view is also a date or dateime, the
traceback will be generated.

To reproduce the issue:
- Install Point of Sale
- Go to 'Reporting' and click on 'Orders'
- Select pivot view
- Go to Group By and select 'Order Date' same as column value
- Issue can be produce in the same way in other modules, such as - 'sale',
'sale_subscription', 'crm', 'planning', 'hr_expense' etc.

Error: TypeError: can only concatenate str (not "relativedelta") to str

The issue is occurring because we are getting duplicate values in
groupby like ['date:month', 'date:month'] while calling orm method over here -
https://github.com/odoo/odoo/blob/6cf3b617d8082df5820283d07e6623b7684cefdd/addons/web/static/src/core/orm_service.js#L143

To solve this issue groupby has been passed into a Set so that no
duplicate values occurs in groupby.

sentry-4262719543

closes odoo/odoo#137550

X-original-commit: de8e6a901b780d8c10484edae5ec1fe6b9fc7d3c
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-10-04 20:52:42 +00:00
Michael (mcm) 2fbc08a197 [IMP] *: remove legacy service mappers
This commit removes the legacy service mappers which are useless now.

closes odoo/odoo#136807

Task: 3439226
Related: odoo/enterprise#48015
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-04 19:40:16 +00:00
FrancoisGe c3e6f4d8a6 [IMP] web: Adds dynamicProps to Widget
As with fields, dynamicProps will be accessible to widgets from extractProps.
This commit will make readonly accessible as the first dynamicProps.
We'll be able to add more when we need them.

DynamicInfo.readonly is true iff the expression given as readonly
attrs in the arch is evaluated to true with the current record.

closes odoo/odoo#137414

Related: odoo/enterprise#48309
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-04 08:39:15 +00:00
Aaron Bohy cc3a3a328d [REF] web,*: simplify arch manipulation and parsing logic
*board,mail,project

This commit aims to simplify the XMLParser logic and the way archs
are manipulated in views, motivated by [1] where we had to
modify the arch in View to insert access right information.

First, the xml utils have been reworked. The XMLParser class has
been removed. The xml utils module already exported a parseXML and
a serializeXML functions, this commit adds visitXML, s.t. the whole
XMLParser feature is fully replaced by the 3 functions.

Second, concrete views now receive the arch in props as an
XMLDocument, as the arch is parsed once for all in View. With this,
we were able to remove serializing/parsing back and forth at several
places, where we needed to extract information for sub-parts of an
arch individually (e.g. View, x2many subviews, list view groupby).

Third, even though this change has been driven by the one above and
wasn't initally wanted, the view compiler cache and API have been
simplified. The cache is now flat, there's an entry in the cache for
each template that has been compiled. Moreover, the useViewCompiler
hook no longer takes the cache key in params, as it can directly
compute it itself (the key being the outerHTML of the template).

[1] odoo/odoo#135145

closes odoo/odoo#136376

Related: odoo/enterprise#47808
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-10-04 08:39:12 +00:00
Julien Mougenot eb3f18ff5e [FIX] web: patch date in object test
Before this commit, a test in the "objects" test suite failed because
it used native dates without patching them, resulting in a low chance of
the generated dates to vary by 1 millisecond and failing the assertions.

This commit patches dates in that test to avoid this issue.

RunBot task 23058

closes odoo/odoo#137426

X-original-commit: aebbbaf942b85cb4d141975a617d8bcadfe9a719
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-03 20:17:57 +00:00
Jorge Pinna Puissant 006ee1fc47 [REF] web, *: remove legacy cookie utils and cookie service
The cookie service was replaced by a utils file in core. This was done
to be able to use the cookies without the need of environment.

"Om Nom Nom Nom" - Cookie Monster

part-of task-id 3439226

closes odoo/odoo#136782

Related: odoo/enterprise#48005
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-03 20:17:40 +00:00
Romain Estievenart 25412e1afa [IMP] web: use the height of the element as the height of placeholder
With this commit we added the ability to use the real height of the
element as the height of the placeholder when we move an item when use
the DnD like jQuery NestedSortable did.

task-3439226

Part-of: odoo/odoo#136375
2023-10-03 19:20:06 +00:00
Romain Estievenart 12821933cb [IMP] web: implement allowed drop on nested_sortable
Like the jQuery NestedSortable, we implement the function `isAllowed`.
When you use the NestedSortable hooks, you can now specify a custom
function to verify if a drop location is allowed. By default, this
function is always true

task-3439226

Part-of: odoo/odoo#136375
2023-10-03 19:20:06 +00:00
Romain Estievenart 1dff3912cb [IMP] web: add a maxLevels params for nest mode on nested_sortable hooks
Add a maxLevels param like the jQuery.nestedSortable has. The goal of
this param is to set the maximum depth of nested items the list can
accept. If set to '0' the levels are unlimited, it's the default value.

task-3439226

Part-of: odoo/odoo#136375
2023-10-03 19:20:06 +00:00
luvi 5124feae97 [IMP] web, *: improve UX of custom group by menu
*: board, website

This commit simplifies the UX of the 'Custom Group by' menu. Before this
commit, many clicks were needed to apply another filter, from an accordion
menu.

Now, a select element is used instead, allowing a better user experience, by
enabling such group by directly, when an option is selected.

Some tests have been adapted to the new selectors and behaviors, and the
applyGroup and toggleAddCustomGroup has been removed, since groups are applied
when selected, and the value can be modified directly with selectGroup.

task-3458519

closes odoo/odoo#132006

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-03 19:19:53 +00:00
Didier (did) 7c4a8f6118 [IMP] web: improve like operators capabilities in the mock server
Before this PR, the `like` operators from the mock server could not handle
request using the `%`.
This PR introduce it.

Part-of: odoo/odoo#118794
2023-10-03 19:19:50 +00:00
Bruno Boi 00875e2654 [IMP] web: remove useless recompute position hook
This commit brings a simple improvement.
There is no need to reposition an element while
you are scrolling inside of it.

closes odoo/odoo#137139

Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-10-03 15:37:32 +00:00
std-odoo b56e6dfdcc [IMP] web: show properties sum in list view
Purpose
=======
Always show the sum of a property column if its type is integer or float.

When we group records we don't show the sum, because it will require
to be able to aggregate properties (`properties.xxxxx:sum`) and the
technical cost is too big for the feature it gives.

Task-3468750

closes odoo/odoo#133700

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-10-03 08:42:19 +00:00
FrancoisGe 22f31a5d0c [FIX] web: external button in many2one field
The goal of this commit is to fix two problems in the Many2one field:
1. At setup, the field is considered to be isFloating when its value is false.
2. When "xxx" is encoded and "Create xxx" is selected, the field is still
   considered to be isFloating even the selection.

isFloating should only be true when the user is performing a search, when
they have made their choice isFloating should be set to false.

These problems should result in the external button not being displayed
in these two cases. Currently, the button is displayed correctly due to
a bug in owl. The bug in owl causes all Components that have executed
evaluateExpr with record.evalContext will be render each time record.update
is called. For example, for Many2oneField, it is the call to dynamic.context
in extractProps that will cause the rendering of the Component Field
containing Many2oneField. This will trigger a call to onWillUpdateProps
each time record.update is called, and will modify isFloating to make it correct.
In order to fix OWL without introducing any bugs, we're going to fix these problems.

How to reproduce after OWL is fixed:
====================================

Case 1:
------
- Go to a form view with an field "x" (with an onchange) and a many2one field
- Create a new record (the many2one field is empty)
- Edit field "x"
- The onChange returns a value for the many2one

Before this commit:
    The external button is not displayed

After this commit
    The external button is displayed.

Case 2:
------
- Go to a form view with a many2one field
- Insert "blabla" in the many2one
- Click on "Create blabla".

Before this commit:
    The external button is not displayed

After this commit
    The external button is displayed.

closes odoo/odoo#137212

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-03 07:18:59 +00:00
Aaron Bohy 2f9c4979fa [IMP] web,survey: better error management in tests
The initial motivation of this commit was to ensure that the qunit
test suite doesn't stop when an error is thrown in a test, which
could happen if the error was thrown "sufficiently close to the
end of the test". Indeed, the "unhandledrejection" event being
async, it was sometimes triggered after the end of the test, when
the service registry was already reset, and the check of the
presence of the error service was wrong, so the error event wasn't
default prevented (e.g. await makeView(...) and the view crashes
at render time).

This led us to rework in more depth the way we deal with errors in
tests. Here are a few behaviors we want (probably not exhaustive):
 - an error in a test must never end the suite (executed in py)
 - an error in a test must always make the test fail, except if the
   error is expected in the scenario, which one must be able to
   state
 - a test must always wait for potential unhandledrejection events
   to be triggered before ending.
 - ideally, we don't want to have to deal with unhandledrejection
   in each test throwing an error (in order to prevent the suite to
   stop)

To achieve this, we come with the following solution. We introduce
a new assertion method, "expectToThrow" which allows to state that
during the test, we expect errors to be thrown. It takes a list of
error messages that will be compared at the end of the test with
the errors that have been thrown during the test. If they differ,
a qunit failure is pushed and the test fails. If an error occurs
in a test and "expectToThrow" hasn't been called, qunit is directly
informed of the error and a failing assertion is done, make the
test fail as well.

If the error service isn't available in the test environment, we
apply the logic above when an "error" or and "unhandledrejection"
event is thrown. If the error service is available, we wrap the
default handler (typically the one that handles everything that
hasn't been handled by specific handlers, like tracebacks) and if
we get to it, we apply the logic above. This means that one must
call "expectToThrow" if
 - the error service isn't deployed, or
 - the thrown error is handled by the default handler, because
   it is something like a traceback (errors like UserError,
   ValidationError are graciously handled by the RPCErrorHandler)
   and thus never reach the default handler.

In all cases, we prevent default the event such that the error
doesn't make the python test end.

Finally, to ensure that "undhandledrejection" events are handled
before the test ends, we wait, in the qunit lib, for a setTimeout
before ending the test, which ensures that all such events have
been dispatched.

closes odoo/odoo#137120

Related: odoo/enterprise#48211
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-03 06:16:46 +00:00
Julien Carion (juca) 0792200c9d [IMP] web: add include archived to domain selector
This commit introduces a new feature to the domain selector that allows
to toggle a new "include archived" option that alters the domain in a way
such that archived records are included or not. This domain part is naive
and may overlap with custom parts of the domain. The special domain part
which includes archived records (['&', <previous_domain>, '|', ('active'
, '=', True), ('active', '=', False)]) is invisible inside the domain
tree but remains visible in the domain code editor.

Also rename the "Match records with xxx of the following rules" statement
to "Match xxx of the following rules".

task-3482381

closes odoo/odoo#135861

Related: odoo/enterprise#47599
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-02 14:12:47 +00:00
Bruno Boi bf954def41 [FIX] web: close popover on pointerdown
**Preliminary note**
The fix mentioned in this commit is already done
in another commit [1].
The below commit message stayed the same for history's sake.

**Before this commit**
A popover would close on outside mousedown event.

This is not sufficient enough, has for instance all the draggable stuff
makes use of the pointer events instead of the mouse events.

This lead to some unwanted behavior, i.e.:
- Open the DomainSelectorDialog
- Open a ModelFieldSelectorPopover
- Try to drag the modal
- The popover remain open and its position is not updated.
  The dialog's dragging is fine.

**After this commit**
The popovers will close on pointerdown away events.
Now:
- Open the DomainSelectorDialog
- Open a ModelFieldSelectorPopover
- Try to drag the modal
- The popover is closed and the dragging still works as expected.

[1]: 76665eb400168a6fd6e2b5f5fe099c8c4e9c8a5e

closes odoo/odoo#137247

X-original-commit: c63dbc4ed0a04e34571c2929f43812873b62fd16
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-10-02 12:58:52 +00:00
Alexandre Kühn b526078ae9 [REF] mail: set data immediately on discuss model relational field
With this commit, instead of `Record.insert()` before setting
relation with records, we can immediately pass record data.
For example:
```js
message.author = { id: 3, type: "partner", name: "Admin" };
thread.messages.add({ id: 10, body: "some-text-content" })
```

This is supported on all relational fields that define a target
model.

To make this work while drastically avoiding cyclic dependencies
in code, whenever data have to be inserted in relation, they are
pre-inserted with essential data, and then they are fully inserted
after being registered in the relation.

closes odoo/odoo#136539

Related: odoo/enterprise#47854
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-02 11:42:55 +00:00
Samuel Degueldre be4f674ff9 [IMP] web: public component service
This commit introduces the publicComponentService, which makes it easy
to mount OWL components in the front end. All public components will share
the same env and therefore the same services.

To define an OWL Component in a public template, first create an owl component
and add it to the "public_components" registry in javascript, then use
<owl-component name="key"> in the template, where key is the key you used when
registering your component. If you want to pass props to your component, you can
give it a props attribute in the template, containing the props as JSON.

Example:

My Public Component:

```js
class MyPublicComponent extends Component {...}
registry.category("public_components").add("my_public_component", MyPublicComponent);
```

My Public Template:

```xml
<templates>
    ...
     <owl-component
        name="my_public_component"
        props='{"title": "My First Public Component"}'/>
    ...
</templates>

```

Part-of: odoo/odoo#136159
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2023-09-29 09:21:51 +00:00
Julien Carion (juca) fadb88b651 [IMP] web, *: display none instead of undefined
This commit changes the default label of the graph view's axis to None
instead of undefined.

task-3519566

closes odoo/odoo#136822

Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
2023-09-28 13:21:01 +00:00
Sébastien Theys 635762db77 [REF] web, mail, snailmail: tests: merge containsMulti into contains
closes odoo/odoo#136658

Related: odoo/enterprise#47913
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-28 01:51:27 +00:00
FrancoisGe ba0205afbb [FIX] web: autocomplete inEdition
When a user is editing an Autocomplete, we don't want to delete its value
if the props value changes.

For example:
- In a form view with a many2one field and another field with an onchange
- Edit the second field
- Insert a value in the many2one input
- The onchange of the first field returns a value for the many2one

Before this commit:
    The value inserted in the many2one is lost. It is replaced by the
    onchange value

After this commit:
    The value inserted in the many2one is unchanged.

closes odoo/odoo#136654

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-28 01:51:24 +00:00
luvi b91f4034ab [IMP] *: improve documentation of options in fields metadata
*: analytic,  base_automation, loyalty, mass_mailing, project, web, web_editor, website

This commit adds many new documentation of options and their usage for
fields. This makes them more usable and customizable in Studio, and adds
documentation for developers to know the type of expected option.

Some options that might lead to issues or that are too technical have
been removed, as they are not relevant and not required in most use cases.

task-3469741

closes odoo/odoo#134858

Related: odoo/enterprise#47148
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-09-27 14:57:03 +00:00
Michael (mcm) 7422eb643c [IMP] *: remove legacy rpc
This commit removes the files ajax.js and rpc.js then adapts all the
places where their exports were used. For most of the changes, it's a
replace of `this._rpc({...})` by a new `useService("rpc|orm")` like
pattern in the widgets.

closes odoo/odoo#136271

Task: 3439226
Related: odoo/enterprise#47775
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-27 11:33:01 +00:00
Sébastien Theys aee3cb8929 [REF] mail, *: tests: remove last occurences of jQuery in contains()
* = im_livechat, project_todo, test_mail, web

closes odoo/odoo#136425

Related: odoo/enterprise#47825
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-27 07:28:08 +00:00
Julien Carion (juca) 2a2f53f7ce [FIX] web: fix translations for duplicate records
This commit ensures that changes in translated fields on a freshly
duplicated record will apply to all translation even when the user
language is not en_US.

Steps to reproduce:

-go to accounting -> configuration -> taxes in other language than en_US
-open any record in form view
-duplicate the record
-change the name of the record and save
-ensure that the name is the same in all languages

task-3339736

closes odoo/odoo#134481

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-27 01:50:52 +00:00
FrancoisGe ef77dbee98 [FIX] web: x2m causes an onchange on the parent which fails
When the onchange triggered by an x2m fails on the parent record,
we want to reuse a valid value (the one before the onchange).

How to reproduce:
- Go to a form view with an x2m (onchange=true) that contains at least one record
- Edit the record in the x2m
- onchange on parent record fails

Before this commit:
    The value is unchanged.

After this commit:
    The value of the edited field is replaced by its old value.

closes odoo/odoo#136450

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-25 15:20:22 +00:00
Julien Carion (juca) bbc4de86d9 [IMP] web: list many2oneAvatar should not be a link
This commit changes the canOpen prop of the many2oneAvatar field to be
set to true only when in form view. The field will therefore stop being
a link in readonly when outside of form view.

closes odoo/odoo#136118

Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-09-25 11:30:11 +00:00
Tom De Caluwé 3de3a1903a [FIX] web: avoid undefined format in parseDate
The safeConvert function in the useDateTimePicker hook will call parseDate with
an undefined format when no format option was provided to the hook. Before this
commit, since the options object passed to parseDate still contained the format
property, the undefined format will also be passed on to the parseDateTime
function. This is problematic, because now the parser will use the default
datetime format, and it will fail because of the absence of a time value in the
input string.

For some input formats, parseDateTime will still yield the correct result using
one of its backup parsing methods. However, a wrong result will be returned for
date formats containing some textual parts (for example MMM/dd/yyyy).

Making sure no undefined format values are passed on in the parseDate function
resolves the problem.

opw-3478797

closes odoo/odoo#136221

X-original-commit: b04482ed87db05b3fc2523a08ce7ca5818af578b
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Signed-off-by: Tom De Caluwé (tdc) <tdc@odoo.com>
2023-09-25 09:38:38 +00:00
Mathieu Duckerts-Antoine 1995f21d42 [FIX] web: field service: protect async methods
The async methods of field service were not declared in its key async.
This would allow destroyed components to process the results of those
methods (despite an initial call to useService). We fix that.

closes odoo/odoo#135950

X-original-commit: 7955def19c7d4a8c49be472413423bbf3beec2e5
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-09-25 07:53:58 +00:00
Sébastien Theys 7a90938a70 [REF] mail, *: tests: simplify text option of contains
* = bus, calendar, im_livechat, hr, project_todo, sms, snailmail,
    test_mail, web, website_livechat

The current implementation often led to tests relying on DOM structure
to properly target the correct element with the text.

It is now easier to simply check if a parent contains some text.

closes odoo/odoo#136295

Related: odoo/enterprise#47770
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-23 10:33:04 +00:00
Aaron Bohy 4fdff785c6 [IMP] web: keep supporting old cids syntax in url
Commit [1] changed the separator of cids in the url to make it
better looking, by using a character that doesn't need to be
encoded (namely, "-" instead of ","). However, by doing so, urls
still using the former separator couldn't be correctly parsed
anymore. This commit adds a small backward compatibility layer,
s.t. links in emails for instance keep working as before.

[1] abae4d4a5c

closes odoo/odoo#136247

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-09-22 15:06:07 +00:00
Bastien PIERRE 3192051806 [IMP] web: Add duplicate action on view list
Include the 'duplicate' action in the action menu in list view. The copy_batch
method will call the copy method with a loop to keep any existing override.

closes odoo/odoo#133977

Task-id: 3456679
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-22 15:06:01 +00:00
Damien Bouvy 264ec1c4dd [IMP] web: support explicit mobile view mode on window actions
Up until this commit, which view was displayed by default on mobile was
somewhat of a lottery.

Initially, only kanban views were considered as 'more adapted to mobile
devices' and used as a main fallback to display records who had a kanban
view in the window action definition.

The the concept of 'mobile-friendly view' was extended to map and grid
so that these views could take precedence over the kanban view in
specific circumstances (indsutry_fsm and timesheet_grid, both of which
are enterprise edition apps) - basically they were marked as
mobile-friendly not because they *are*, but because it was the only way
to override the kanban override.

But this comes with its lot of problems and limitations, namely that the
mobile friendly view will be found based on the order of view modes for
a window action, so if you have a window action with the view modes
`kanban,map,tree,form`, you will never be able to have e.g. the kanban
view shown on desktop by default and the map view on mobile.

This commit introduces the notion of a 'default mobile view' on window
actions so that one may decide on an *arbitrary* view mode to use on
mobile for an action - without impacting the ordering of views on other
models, etc.

Task-3460374

closes odoo/odoo#133608

Related: odoo/enterprise#46562
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-22 15:06:00 +00:00
Sébastien Theys cc9e2c147c [REF] web, mail, *: tests: remove legacy file utils
* = mrp

closes odoo/odoo#136141

Related: odoo/enterprise#47716
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-22 11:55:58 +00:00
FrancoisGe d682871a8b [FIX] *: Wrong usage of onWillUpdateProps in Field
Since the new model (PR: odoo/odoo#114024), updating a record no longer
triggers a deep render and therefore no longer triggers the onWillUpdateProps
for Field components.

The goal of this commit is to adapt the usage of onWillUpdateProps
in Field composents in order to fix the bugs introduced by the RelationalModel

closes odoo/odoo#135842

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-22 11:55:55 +00:00
Sébastien Theys 5a7e882766 [REF] mail, *: tests: convert remaining :contains from QUnit tests
* = web, sms

closes odoo/odoo#136131

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-21 23:54:27 +00:00
Aaron Bohy abae4d4a5c [IMP] web: better looking cids in url
Before this commit, cids in the url (in the hash part) were
separated by a comma, which was encoded by encodeURIComponent as
it is not considered as a safe character, resulting into "%2C"
appearing in the url in between company ids. This was kind of ugly
and made the url a bit hard to read.

This commit uses "-" as separator for cids, which is a safe
characters [1] to use in the url and which is thus left untouched by
encodeURIComponent.

AL request.

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#description

closes odoo/odoo#136104

Related: odoo/enterprise#47723
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-09-21 23:54:25 +00:00
Gorash ba1a5509fa [IMP] base: Remove context dependencies from get_views method
In this viewtiverse, the heroes remove the context dependencies for
`get_views`, from the views and python fields (such as domain). To reduce
inconsistencies and the number of rpc.

Current issues:
* There may be inconsistencies in views at the JavaScript level. Some
overrides modify the behavior of get_views or domains on fields via
context keys, therefore by changing the action, the rendering may be
different. However, these views are cached. However, the cache key
(Javascript) does not reflect the entire context, and requires additional
post-processing from the server.
* Multiple rpc for the same rendering. get_views being dependent on the
context, as soon as it changes, a new rpc is performed. In most cases,
when JavaScript needs the same view, there is no change depending on the
context, the rpc is useless.
* Inconsistency when rendering subviews, some views could be different
depending on the context, this context can be modified in the view itself
via the context attributes. However, the JavaScript client does not redo
an rpc for each change of these sub-contexts. Therefore the result may be
inconsistent.

Solution:
Limit as much as possible the number of context keys provided when calling
get_views, and use the context provided as a cache key. The authorized
keys are 'lang' and '*_view_ref'. For the cache key, options are added in
the get_views method.
Instead of using the context, it is inserted into python expressions.
This will be evaluated by JavaScript and thus avoids inconsistencies.

task-3414108
task-3414068

closes odoo/odoo#135145

Related: odoo/enterprise#47584
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-09-21 16:52:10 +00:00
abd-msyukyu-odoo 657314adb1 [IMP] web: draggable_hook_builder option to ignore selectively
The way the `ignore` property is implemented means that nested draggable
elements under a single element matching the `ignore` selector will all be
disabled.

In Knowledge, the sidebar allowing to move articles around has nested draggable
elements that the user should be able to move around, under other draggable
elements that should stay in place (depending on access rights).

Therefore, this commit introduces another way to disable dragging with the
`preventDrag` property which is a function that receives the dragging candidate
and returns a boolean to indicate whether the element can effectively be dragged
or not in its current situation.

task-3456741

closes odoo/odoo#135981

X-original-commit: eb302dbf48500b2eee61a0efb865868866fb454b
Related: odoo/enterprise#47640
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Damien Abeloos (abd) <abd@odoo.com>
2023-09-21 06:31:01 +00:00
Michael (mcm) 28f786917f [FIX] web: remove override of rpc service
closes odoo/odoo#135371

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Jinjiu Liu (jili) <jili@odoo.com>
2023-09-19 16:37:15 +00:00
Leonardo Pavan Rocha e6e3722dec [FIX] web: show caret in NameAndSignature
Adds a caret to the font selection in the NameAndSignature component.
Prior to this change, the font icon was hidden without the caret.

Also, the caret direction is not being correctly updated when the target
element is closed. This commit fixes this by storing the initial direction
and forcing this direction when the dropdown is closed.

task-3431069

closes odoo/odoo#135774

X-original-commit: 7d11e281fa70a853191378bee3750d12bb76f9b9
Related: odoo/enterprise#47513
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-09-18 22:17:14 +00:00
FrancoisGe d84e570630 [FIX] web: switching pages doesn't change pager limit
Before this commit, in form view, editing a record then switching page
incremented the pager limit by 1.

closes odoo/odoo#135659

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-15 19:14:28 +00:00
Mathieu Duckerts-Antoine 4aa5f00dc9 [IMP] web: sample server: support of array_agg
In SampleServer, we make _mockReadGroup support array_agg (at least for
the field id).

closes odoo/odoo#135020

Related: odoo/enterprise#37757
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-09-15 10:48:25 +00:00
Aaron Bohy 3d9aebdcac [FIX] web: fix randomly failing form tests
We must wait for an additional tick to be sure that the error
dialog is displayed, because the "unhandledrejection" event is
triggered asynchronously.

Runbot issue-24690
Runbot issue-24691
Runbot issue-24744
Runbot issue-24733
Runbot issue-24742

closes odoo/odoo#135500

X-original-commit: e341f592e2a8ebc3c2e479566425df89a29bf2c7
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-09-14 18:09:51 +00:00