Commit Graph
14329 Commits
Author SHA1 Message Date
Bruno Boi 4e396aeeb3 [FIX] web: remove a window global assignation
Since 5da90dfc4 a test has been added in which
a global readonly variable from `window`
is reassigned.
Furthermore, it is the global "parent" which is
read-only and should nerver be modified.

closes odoo/odoo#117927

X-original-commit: 169a471c7d48891d3295e2b597300425fb145abc
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-04-06 16:12:26 +02:00
Aaron Bohy 5de54e14c4 [REF] web: remove unnecessary params from useModel
This commit removes the onCreate param in Kanban, as it is no
longer useful since [1]. It also removes the beforeLoadProm param
and replaces it by an onWillStart option, which is slightly cleaner
(there was no reason for this to be a model param as it is only
used by the useModel hook).

[1] 067bcac533

Part of task 3179751

closes odoo/odoo#117889

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-06 16:12:18 +02:00
Samuel Degueldre 8d35700aaf [REF] point_of_sale, pos_restaurant, *: stop using legacy environment
*: web

This commit removes the use of the legacy environment from the PoS, as
it is no longer needed. This will allow us to more easily use the new
unit testing infrastructure from web.

Part-of: odoo/odoo#117290
2023-04-06 16:12:02 +02:00
Julien Carion (juca) 41a7af5ba6 [IMP] web, webclient: Add autoOpen prop to Dropdown
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

closes odoo/odoo#117622

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-04-06 14:58:53 +02:00
Julien Carion (juca) 50c448ec56 [IMP] web: Remove manualOnly prop an dropdown
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
2023-04-06 14:58:52 +02:00
luvi ae075ec5c9 [IMP] web: TagsList supports icon props
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.

closes odoo/odoo#117751

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-06 12:48:31 +02:00
luvi 0b2b151784 [IMP] web, *: add tests to TagsList component
*: 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
2023-04-06 12:48:31 +02:00
MerlinGuillaume 6a148518d1 [FIX] web: get datepicker value from event instead of element
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#L395

closes odoo/odoo#117781

X-original-commit: dc195613ecff17d6aadc6e6ad8ab6da3670eb85a
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2023-04-05 15:11:46 +02:00
Pulinckx Pierre (PIPU) 29d55e4403 [REF] *: Replace underscore functions by native JS
Replace _.last, _find, _.extend, _.some, _.every

Taskid 3246238

closes odoo/odoo#117319

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-04-05 12:50:43 +02:00
amdi-odoo 31715f5b87 [IMP] web: clarify "Archive" modals
Removing the "Oks" from the "Archive" modals to
clarify what confirming the action will do.

Also fixing a wording error in the form controller
archive modal.

Task-3241064

closes odoo/odoo#117588

X-original-commit: 61c8b51a3d77e913acacead6379cd686693f86ce
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-05 09:42:32 +02:00
flvr-odoo 3cfcb204ed [FIX] web : isolate new tab to external ressources
This commit is a security reinforcement.

Before this commit:

ir.action.act_url was able to handle and redirect to protocols like
file:, javascript:, date: ... This is unnecessary in the context of
this action. It could potentially be abused by a poorly written custom
module

It also would not isolate the landing page in case of a new tabs.
It means that chrome would still consider the tab to be from the
previous domain in case no url was passed and js was executed.
This would allow the newly open tab to still make query's to the
referrer using the referrer's cookie. While not stricly necessary
if we already prevent url that start with "javascript:", it is a
nice to have.

After this commit:

New tabs are not able to access referrer informations or execute
javascript interacting with the referrer. Also, it is now impossible
to redirect to protocols other than http and https directly from
the ir.action.act_url

Test update:

All new tabs are required to have the "noreferrer" argument

Tested an example of an unsupported protocol.

closes odoo/odoo#117687

X-original-commit: a020072da17e32fca0bbe6ed02b1afaeec8e8a02
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-05 08:38:30 +02:00
Géry Debongnie 44052d58d7 [FIX] web,base: do not display js module errors in some cases
Since saas 16.1, we added a more visible error information box when the
module system cannot find some dependencies, or if there is an error in
the JS code. This error box is very useful to understand a lot of
typical devlopment issues.  However, it was occasionally displayed in
production code.

However, we sometimes observe that the error information box was
displayed, because the request to load an assets failed with a 404.

It is unclear in which circumstance this can happen, but it seems that
the following elements are involved:

- the user has an open tab with odoo, kept open for a while
- some js code is changed on the server, which causes the previous
assets to be deleted
- the user reload its open tabs, so the browser will load the /web page
from disk, which points to the old assets files
- then it will try to load all assets, with a 404 on one of the script
- the error information box is displayed

This commit intercepts the loading error and stop displaying the error
information box, which is basically the same behaviour as 16.0 and
before. We could force a reload in that case, but it seems dangerous,
since in case of errors, it could easily lead to an infinite loop.

closes odoo/odoo#117625

X-original-commit: 0a44b5b1e008b591a716efd26217c7db7360c37b
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-04 16:02:12 +02:00
Michael (mcm) 77e825cab2 [REF] web: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117456

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-04 16:01:57 +02:00
Jorge Pinna Puissant 067bcac533 [REF] web: kanban record quick create
The aim of this commit is to simplify the RelationalModel by moving
Kanban's specific quick create record functions to the Kanban View.

Before this commit, when asking to create a new record using the quick
create on a kanban view, a new virtual record was created by the
DynamicRecordList and added to the DynamicGroupList on the
RelationalModel. A complex mechanism was used to be sure that only one
virtual record is created between all DynamicGroupLists. When the record
was save, the new record (in form view style) was modified to a kanban
style (to do this, the record's activeFields were modified to be
compatible with the kanban card).

Now, the virtual record is created on the Kanban View, in a more simple
way, the kanban renderer knows in which group there is a quick create,
and only in that one the form renderer of the quick create record card
is shown (not need of complex mechanism to have only one quick create
between all groups). After the save, we simply call an existing function
to add the new record to the group using the record's ID (not need of a
complex mechanism to modify the record to a kanban style).

part-of task-id 3179751

closes odoo/odoo#117449

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-04 13:35:15 +02:00
Pierre-Yves Dufays 059dc88d17 [IMP] web: update upload service docstring
As the upload service (js) only uses iteration, index based access and length
on the files parameter, it is compatible as well with an array of File as files
parameter (instead of a FileList). So, we have updated the files parameter
docstring to accept as well array of File. With this change we can easily pass
a modified list of files (ListFile being hard to create on some browser).
Example of use-case, only send to the upload service the files smaller than a
given threshold by transforming a FileList to an array and then by filtering
it.

Task-3179130

closes odoo/odoo#117385

Related: odoo/enterprise#38490
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-04-04 11:02:08 +02:00
Samuel Degueldre a838223a35 [REF] web: remove dependency of js module system on guardedCatch
guardedCatch is a legacy feature meant to differenciate promises
rejected as control flow from promises rejected because of an error. In
recent years we have settled on the stance that using promise
rejections, which are treated as errors by the language in many ways, is
a bad idea. This commit removes the dependency of the odoo module system
on this legacy feature.

closes odoo/odoo#117457

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-03 17:07:30 +02:00
Michael (mcm) ff0d6dd580 [REF] *: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117305

Related: odoo/enterprise#39118
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-03 17:07:24 +02:00
Bastien Fafchamps (bafa) dfda7a14c1 [IMP] web: SelectMenu: Truncate selected value while keeping auto width
Before this commit:
When the label of the selected value was too long, the SelectMenu width
would grow indefinitely to accomodate, this behaviour was causing some
layouts to break.

After this commit:
The width of the SelectMenu is still automatic and will try to fill its
parent but will not make it grow. Instead, if the label is too long and
does not fit in the parent, it will be truncated.

Solution:
Using a grid display we can easly set the label to auto and truncate it
while keeping a constant size for the icons.

closes odoo/odoo#115799

Related: odoo/enterprise#37285
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-03 13:55:18 +02:00
Bastien Fafchamps (bafa) 7a6a64068b [IMP] web: SelectMenu: Support for de-selection in the dropdown in multiselect mode
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
2023-04-03 13:55:18 +02:00
luvi 804c74813e [IMP] web: export SCALE_LABELS from calendar_controller.js
This commits exports the SCALE_LABELS list from the calendar_controller.js
file. This allows us to import and know the list of available scales from
other locations (Studio for example), and be updated with the supported
scales with their value and label.

Part-of: odoo/odoo#115799
2023-04-03 13:55:18 +02:00
luvi 129fa3f150 [MOV] web, *: move TagsList to core components
Since this component is imported and used in many places, it is more
convenient to move this component a core component instead of a
component made exclusively for the Many2ManyTagsField component.

This change makes the usage of TagsList possible by SelectMenu, which
would create issues as the fields folder should not be imported in
other modules.

Part-of: odoo/odoo#115799
2023-04-03 13:55:17 +02:00
Bastien Fafchamps (bafa) eb4a7d18b9 [FIX] web: SelectMenu value with no corresponding choice should not be displayed
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
2023-04-03 13:55:17 +02:00
luvi 2d28239f9b [IMP] web: SelectMenu has multiSelect props
This commit adds the ability to select multiple values from the
SelectMenu component. A list of tags are displayed in the toggler
to remove already selected values, and selected values are colored
in the list of choices.

This feature is similar to how jquery select2 handles multiple
selections, by adding the values in the input toggler. The feature
will be used by the studio sidebar during the refactor.

Part-of: odoo/odoo#115799
2023-04-03 13:55:17 +02:00
fdardenne d760b81271 [IMP] web: SelectMenu: support object as value
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
2023-04-03 13:55:17 +02:00
luvi 98a89ed51f [IMP] web: improve SelectMenu and DomainSelectorDialog components
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
2023-04-03 13:55:16 +02:00
Lucas Perais 47699f3e47 [REF] web: x2manyField: ensure we don't pass the props viewMode if not set
Before this commit, we passed the viewMode props to the X2many field everytime.
Since that props is optional, we don't have to pass it if it is not a string (null or undefined)

This allows to display a field set as invisible in studio

Part-of: odoo/odoo#115799
2023-04-03 13:55:16 +02:00
Lucas Perais 2787c9539c [IMP] web: core: ModelFieldSelector improved extensibility
Before this commit, when the ModelFieldSelector was updated, it only transmitted its chain as a string
But in some cases we do need the full chain as Object to check on fields that are part of it.

After this commit, this is the case.

Part-of: odoo/odoo#115799
2023-04-03 13:55:15 +02:00
luvi d80f45792d [IMP] web: add Notebook component features
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
2023-04-03 13:55:15 +02:00
Lucas Perais 6085480ea1 [IMP] web: core: draggable: execute willStartDrag
Before this commit, the draggable hook did not execute willStartDrag, that is, before
the element is actually moved.

After this commit it does, allowing for implementing some features, like copyOnDrag.

Part-of: odoo/odoo#115799
2023-04-03 13:55:15 +02:00
Géry Debongnie 332c781ff6 [FIX] web: make mock_server implementation closer to orm
The mock server implementation does not exactly match the actual orm
implementation. It is not really a big deal, but it makes the test suite
less useful.

In particular, the onchange call should return a value for all fields
when we are creating a new record. Also, the default get implementation
was not exactly correct.

The motivation for this change is to prepare the future relational model
refactoring.

closes odoo/odoo#117434

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-03 12:56:54 +02:00
Audric Onockx (auon) 399e08fa85 [IMP] web: display progressbar in a different color when > 100%
This improvement will give a visual indication that the progress
has gone over 100% by changing its color.
As, depending on what it measures, it could be positive or negative,
we add an option to the widget to determine the class (color)
that should be used.

task-2909337

Part-of: odoo/odoo#96104
2023-04-03 12:56:46 +02:00
Hubert Van de Walle (huvw) af064c1914 [FIX] web: ImageField size attribute not applied correctly in CSS
Steps to reproduce
==================

- Go to the product page
- Open studio
- Click on the picture and set the size to large
- Save and quit studio
- -> The size doesn't change

Port of https://github.com/odoo/odoo/pull/87087

opw-3217741

closes odoo/odoo#117423

X-original-commit: 63a3466c805c09989e5e022519e1ba450ecb1053
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-04-01 17:03:57 +02:00
luvi c47a9b723c [FIX] web: fix crash when loading an export template in debug
This commit fixes a crash that occured when selecting an existing template
in the export dialog, in debug mode. Since the /web/export/namelist returns
a 'name' and a 'label', the template didn't had the 'id' attribute set on
the element and the key couldn't be set properly in the template of the
component.

Now, the id attribute is added and the list can be displayed as expected,
without any crash. 'label' has been set as 'string', to make the component
use the same naming in the template and reduce potential issues. A test has
been added to verify the behavior of the dialog in debug mode, which displays
the field technical name next to its label.

task-3255591

closes odoo/odoo#117378

X-original-commit: 1aa090c6393a13f02f238c5a569875022e27a4aa
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-03-31 18:14:39 +02:00
Aaron Bohy b3b3db6732 [REF] web: move isM2MGrouped logic from model to list
This is only necessary for the list view, no need to add complexity
to the model for this.

Part of task 3179751

closes odoo/odoo#117309

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-03-31 11:59:00 +02:00
Hubert Van de Walle (huvw) 6ca723dee4 [FIX] web: group pager: use correct count
Steps to reproduce
==================

- Go to the products list view
- Remove every filter/group by
- Search for "bolt"
- Group by > Add Custom Group > Active
- Remove the bold filter
- Expand the group

Cause of the issue
==================

The group pager is not displayed because the condition was incorrect

A group pager should only be displayed when the group limit is less than the
group count. The list count was used instead, meaning the total count
was the number of groups and not the number of item in the group.

opw-3221226

closes odoo/odoo#117267

X-original-commit: 4caab25d182bc2b5d1a2c315795a79d286a4491e
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-03-31 10:53:13 +02:00
MerlinGuillaume ae1d574453 [FIX] web: add the same image on different records
Using the same image on new records does not work without refreshing the
page

Steps to reproduce:
1. Install Sales
2. Go to Sales > Products > Products and create a new product
3. Set a name and an image on the product
4. Create a new product (with the 'New' button in the top right of the
   form)
5. Set the image used previously on this product
6. The image does not save

Solution:
Add a `t-key` on the FileUploader in order to recreate a FileUploader
when we open a new form

Problem:
The FileUploader component is not reset when we open a new form (the
files previously uploaded are still present on the FileUploader).
`onFileChange` is thus not called when we use the same image, as the
file hasn't changed.

[This commit] in master fixed the same issue by resetting the
FileUploader after each upload so we can revert it
https://github.com/odoo/odoo/blob/7710c3331ebd22f8396870bd0731f8c1152d9c41/addons/web/static/src/views/fields/file_handler.js#L66

[This commit]:https://github.com/odoo/odoo/commit/18384bb519d95e937ea4cfdd660ac08ba89214c0

opw-3151756

closes odoo/odoo#117252

X-original-commit: 3b04edc80f916b3b02a6abc7e88de32e53593fc2
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-03-31 10:53:10 +02:00
Romain Estievenart fb8112a06b [IMP] mail,hr,web: change the UX of the Many2ManyAvatarFieldPopover
The commit change the design of the Many2ManyAvatarFieldPopover the goal
is to remove the m2m dropdown and fill the dropdown content directly
inside the popover.

It also reverses the order of the displayed tags inside the m2m avatar
field in the kanban view and inside the popover.

It removes the possibility to unassign users on mouse hover in kanban
view.

Note:
It's still possible to remove users inside an m2m_avatar_field popover.

Task ID: 3229888

closes odoo/odoo#117194

X-original-commit: f0d71e98743421318a798ef9d4f1e75d11a23334
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2023-03-31 10:53:08 +02:00
Julien Banken 88c256d8d8 [FIX] web: standardize behavior for int and float property fields
Currently, the property fields of type integer and decimal does not
behave like the standard fields. There are the following issues:

1. The property fields of type integer and decimal do not fallback to
   the value 0 or 0.0 when the field is emptied.
2. The user can not write the value 0 in the property field of type
   integer and decimal. The value gets discarded whenever the user
   unfocuses the input field.

This commit will fix those two issues and ensure that the property
fields have the same behavior as the standard fields.

task-3226202

closes odoo/odoo#117253

X-original-commit: 08c317743ba90802f471058a8f12d7211f9eb150
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-03-31 09:48:46 +02:00
Michael (mcm) 8da2b52333 [IMP] web: introduce overlay service
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

closes odoo/odoo#115308

Related: odoo/enterprise#38786
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-03-30 16:22:51 +02:00
FrancoisGe 6718f001b9 [FIX] web: resequence x2m in dialog form view
Before this commit, in the form view dialog of an x2m, resequencing an
x2m will cause a crash.

Why:
The basic_relatonal_model passes the wrong view type to the basic_model
when resequencing. In this case, we want to use the form view.

How to reproduce:
- Going into a form view with an editable x2m
- Open a record of the x2m in a form view dialog with an x2m containing
  a handle field
- Change the order of the records using the handle field (resequence)

Before this commit:
    A crash is displayed

After this commit:
    The records have been resequenced correctly.

closes odoo/odoo#117145

X-original-commit: 003e6f27db767cd80758b868c8afbf73b78f1abe
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-30 15:09:47 +02:00
FrancoisGe a2342f636c [REF] web,crm: remove allow_group_range_value
The allow_group_range_value option is used in one arch of a kanban in
CRM. We therefore believe that this is not standard behaviour.
So we decided to move this logic to the custom view that uses it.

Part of Task: 3179751

closes odoo/odoo#117023

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-30 10:53:59 +02:00
FrancoisGe 6371565e69 [FIX] web: many2x fail for a good reason
Before this commit, when the "Create" button of a m2x is clicked and
an error is returned by the server, a form view dialog is opened to
create the record. We want to know if the error is caused by a missing
required field but not by any other type of error.
So we open the form view dialog only if the error is of type
ValidationError otherwise we display an error dialog.

closes odoo/odoo#116954

X-original-commit: 49bae69c602d1587fe159719667ff8dd0fb23984
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-29 11:47:15 +02:00
Géry Debongnie 2ac72eae76 [IMP] web: add a name to the main owl app
This is useful when using the owl dev tools to have a better feedback on
which app is which

closes odoo/odoo#116948

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-29 11:47:12 +02:00
Mathieu Duckerts-Antoine d1f450adde [FIX] web: domain: support of '=?' operator
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.

closes odoo/odoo#116914

X-original-commit: b6495bd51295c513ab0d5c083560ac3a1236bd4f
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-29 09:33:52 +02:00
FrancoisGe a7ed23a41c [FIX] web: decoration on a many2one field
Before this commit, in a list view, the style of a decoration on a m2o
widget was ignored. For example, when applying the danger decoration,
we want the m2o field to be in red.

How to reproduce:

Go to a list view with a field having the many2one widget and
a danger-decoration.
Have a line that respects the decoration condition.
Before this commit:
m2o field text uses its base colour (blue)

After this commit:
m2o field text uses the colour red for danger decoration

closes odoo/odoo#116621

Forward-port-of: #115831
X-original-commit: 9e0eac2
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-29 09:33:38 +02:00
Bruno Boi 4e974e5977 [IMP] web: allow kanban folded columns examples
Will add the ability to make grouped kanban column examples
with an initial folded status.

**Usage**
Add your kanban column examples with the following options:

```js
import { registry } from "@web/core/registry";

const kanbanExamplesRegistry = registry.category("kanban_examples");
const myExamples = "my-examples";

kanbanExamplesRegistry.add(myExamples, {
  // ...
  allowedGroupBys: ["stage_id"],
  foldField: "fold_state",
  examples: [
    // ...
    { columns: ["To Do"], foldedColumns: ["Done"], /* ... */ },
  ],
});
```

In your arch description:
```xml
<kanban examples="my-examples" ...
```

Your python model should look something like this:
```python
from odoo import fields, models

class Project(models.Model):
  _name = 'project.project'
  stage_id = fields.Many2one('project.project.stage')
  # ...

class ProjectStage(models.Model):
  _name = 'project.project.stage'
  _fold_name = 'fold_state'  # optional, default is 'fold'
  fold_state = fields.Boolean()
  # ...
```

closes odoo/odoo#115909

Taskid: 3246042
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-29 09:33:35 +02:00
Bruno Boi d2575b50eb [FIX] web,*: restrict kanban examples availability
*: project,utm

**Before this commit**
With the following steps, it is possible to use kanban column quick
creation with unexpected fields, i.e. creating projects instead of
stages inside a project:
- Project > New > Groupby 'Project'
- Click on the "see examples" link in the column in creation
- Apply any column examples
- Instead of stages inside the project, new projects are created

**After this commit**
The kanban_examples registry elements should now clearly
state which are the allowed groupby fields.
The 'See examples' link will not be displayed if the groupby field
is not allowed.

**Usage**
See the modified files in project and utm modules in this commit.

Taskid: 3246042
Part-of: odoo/odoo#115909
2023-03-29 09:33:35 +02:00
Bruno Boi ba45832946 [REF] web,*: change a KanbanColumnQuickCreate prop
*: crm

Before this commit, the KanbanColumnQuickCreate receives
the groupByFieldString property as a string.
This commit changes that in order to give the groupByField object.

This change eases the further work in same pull request.

Taskid: 3246042
Part-of: odoo/odoo#115909
2023-03-29 09:33:34 +02:00
Géry Debongnie 378edfa566 [FIX] web: make notebook tab focusable
Before this commit, the notebook tabs were skipped when navigating with
the keyboard tab or shift+tab keyboard shortcuts. This commit simply
modify the tabindex to 0, so they are not ignored.

Users can now move through the tabs with the tab key, and press enter to
activate a specific tab.

Note that there is not tests because that kind of user interaction cannot
be simulated from the js code

closes odoo/odoo#116874

Task: #2622077
X-original-commit: 1a9a4aef728b406b4c3a1c99cb66e3fc4fd4ff52
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-03-28 23:17:52 +02:00
Bruno Boi 1a2865580b [FIX] web: incompatibility with fc and owl popover
**To Reproduce**
- Calendar > Month View > Create Many Events the same day
- Click on "+x more" link: will open fc popover
- Click on an event: will open owl popover
- Click somewhere in owl popover

**Before this commit**
Both the popovers will close and nothing happen

**After this commit**
It works.

closes odoo/odoo#116912

Taskid: 3246033
X-original-commit: 7ee230d9ecf3678ef4246b81783fedaf82119a53
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-03-28 21:23:47 +02:00