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.
closesodoo/odoo#117927
X-original-commit: 169a471c7d48891d3295e2b597300425fb145abc
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
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
closesodoo/odoo#117889
Signed-off-by: Géry Debongnie <ged@odoo.com>
*: 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
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>
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
closesodoo/odoo#117588
X-original-commit: 61c8b51a3d77e913acacead6379cd686693f86ce
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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.
closesodoo/odoo#117687
X-original-commit: a020072da17e32fca0bbe6ed02b1afaeec8e8a02
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#117625
X-original-commit: 0a44b5b1e008b591a716efd26217c7db7360c37b
Signed-off-by: Géry Debongnie <ged@odoo.com>
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
closesodoo/odoo#117456
Signed-off-by: Géry Debongnie <ged@odoo.com>
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
closesodoo/odoo#117449
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#117385
Related: odoo/enterprise#38490
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
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.
closesodoo/odoo#117457
Signed-off-by: Géry Debongnie <ged@odoo.com>
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
closesodoo/odoo#117305
Related: odoo/enterprise#39118
Signed-off-by: Géry Debongnie <ged@odoo.com>
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.
closesodoo/odoo#115799
Related: odoo/enterprise#37285
Signed-off-by: Aaron Bohy (aab) <aab@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 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
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
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
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
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
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
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
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
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
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.
closesodoo/odoo#117434
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
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
closesodoo/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>
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
closesodoo/odoo#117378
X-original-commit: 1aa090c6393a13f02f238c5a569875022e27a4aa
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
This is only necessary for the list view, no need to add complexity
to the model for this.
Part of task 3179751
closesodoo/odoo#117309
Signed-off-by: Géry Debongnie <ged@odoo.com>
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
closesodoo/odoo#117267
X-original-commit: 4caab25d182bc2b5d1a2c315795a79d286a4491e
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
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
closesodoo/odoo#117252
X-original-commit: 3b04edc80f916b3b02a6abc7e88de32e53593fc2
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
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
closesodoo/odoo#117194
X-original-commit: f0d71e98743421318a798ef9d4f1e75d11a23334
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
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
closesodoo/odoo#117253
X-original-commit: 08c317743ba90802f471058a8f12d7211f9eb150
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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>
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.
closesodoo/odoo#117145
X-original-commit: 003e6f27db767cd80758b868c8afbf73b78f1abe
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#117023
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#116954
X-original-commit: 49bae69c602d1587fe159719667ff8dd0fb23984
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This is useful when using the owl dev tools to have a better feedback on
which app is which
closesodoo/odoo#116948
Signed-off-by: Aaron Bohy (aab) <aab@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>
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>
*: 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
*: 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
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>
**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.
closesodoo/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>