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@cc3a3a328dclosesodoo/odoo#137668
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
**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.
closesodoo/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>
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/136271closesodoo/odoo#137421
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#137517
Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
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
closesodoo/odoo#137260
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#137550
X-original-commit: de8e6a901b780d8c10484edae5ec1fe6b9fc7d3c
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
This commit removes the legacy service mappers which are useless now.
closesodoo/odoo#136807
Task: 3439226
Related: odoo/enterprise#48015
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
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.
closesodoo/odoo#137414
Related: odoo/enterprise#48309
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*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#135145closesodoo/odoo#136376
Related: odoo/enterprise#47808
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
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
closesodoo/odoo#137426
X-original-commit: aebbbaf942b85cb4d141975a617d8bcadfe9a719
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#136782
Related: odoo/enterprise#48005
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
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
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
*: 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
closesodoo/odoo#132006
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
This commit brings a simple improvement.
There is no need to reposition an element while
you are scrolling inside of it.
closesodoo/odoo#137139
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
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
closesodoo/odoo#133700
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
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.
closesodoo/odoo#137212
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#137120
Related: odoo/enterprise#48211
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
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
closesodoo/odoo#135861
Related: odoo/enterprise#47599
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
**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
closesodoo/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>
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.
closesodoo/odoo#136539
Related: odoo/enterprise#47854
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
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>
This commit changes the default label of the graph view's axis to None
instead of undefined.
task-3519566
closesodoo/odoo#136822
Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
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.
closesodoo/odoo#136654
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*: 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
closesodoo/odoo#134858
Related: odoo/enterprise#47148
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
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.
closesodoo/odoo#136271
Task: 3439226
Related: odoo/enterprise#47775
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#134481
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#136450
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#136118
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
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
closesodoo/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>
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.
closesodoo/odoo#135950
X-original-commit: 7955def19c7d4a8c49be472413423bbf3beec2e5
Signed-off-by: Géry Debongnie <ged@odoo.com>
* = 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.
closesodoo/odoo#136295
Related: odoo/enterprise#47770
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
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] abae4d4a5cclosesodoo/odoo#136247
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
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.
closesodoo/odoo#133977
Task-id: 3456679
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#133608
Related: odoo/enterprise#46562
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#135842
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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#descriptionclosesodoo/odoo#136104
Related: odoo/enterprise#47723
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
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
closesodoo/odoo#135145
Related: odoo/enterprise#47584
Signed-off-by: Raphael Collet <rco@odoo.com>
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
closesodoo/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>
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
closesodoo/odoo#135774
X-original-commit: 7d11e281fa70a853191378bee3750d12bb76f9b9
Related: odoo/enterprise#47513
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Before this commit, in form view, editing a record then switching page
incremented the pager limit by 1.
closesodoo/odoo#135659
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#135500
X-original-commit: e341f592e2a8ebc3c2e479566425df89a29bf2c7
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>