There was an issue with the computed `read_group` `__range` when grouping on
the same date/datetime field on multiple granularities (i.e. month, week).
Since the range was stored with the field_name as a key, the last evaluated
range would override the previous ones.
Impacted Versions:
- master
(- exists since 15.0 but it does not impact the user directly so it has been
decided to fix this only in master, since the API is modified)
Steps to reproduce:
1. Open a list view and group by a date field with at least 2 granularities
2. Open the chrome debugger (network) and check a web_read_group rpc preview
3. Find the web_read_group for groups related to one of the largest
granularities and check the `__range`
Current behavior:
- `__range = {field_name: false}`
Expected behavior:
- `__range = {field_name: {from: range_start, to: range_end}`
Explanation
Since the smaller granularities are evaluated last, and the condition to update
`__range` is related to the field_name and not the granularity, the range is
always overriden by the smaller granularities (even if their value is False)
when grouping on the same field with multiple granularities.
Furthermore, there is a conceptual problem with the current solution: it does
not allow to store multiple ranges when the read_group is not lazy and when
grouping on the same field with multiple granularities.
Therefore, the proposed solution is to use the full groupby keys in the
`__range` to allow storing multiple ranges depending on granularity. The keys
in `__range` would thus match the group value keys and allow more flexibility
if a domain must be forged from the group(s) range(s).
Task-2894519
closesodoo/odoo#95193
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
*: bus, calendar, iap_mail, im_livechat, project, web.
In order to ease the PR introducing the websockets in Odoo, the bus service
has to be updated to be a wowl service. This PR takes care of it.
task-2053917
closesodoo/odoo#95824
Related: odoo/enterprise#29361
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this commit, it happened that the domain selector
couldn't find the operator linked to the field.
This commit adds a fallback on the existing operators
to find an operator that matches.
for example the domain `[["name", "like", "M"]]` gave
`Name ? "M"`, now it correctly gives `Name like "M"`.
closesodoo/odoo#95891
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In legacy, the domain field had an `in_dialog` option that was
used to display a button that opens a dialog to edit the value.
This commit reimplements the `DomainSelectorDialog` in owl
and adds the option the new domain field.
closesodoo/odoo#95768
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, patching a getter of a class made it enumerable
(`Object.keys({ a: 1 })` -> `["a"]`).
In javascript, getters of a class are not enumerable but
getters of an object are enumerable.
When patching, the system replaced the descriptor of the old class
member by the member of the object.
Now, it replaces some info of the old descriptor by the new descriptor
but not the entire descriptor.
closesodoo/odoo#95921
X-original-commit: fd7c2c0c14bfaac228abacb265278157eec4aad0
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Before this commit, in the HomeMenu, typing several characters very
quickly could result in some not being present in the command palette
when it was opened.
Exemple:
In the HomeMenu,if I type "a" "b" "c" quickly the command palette will
open with the search value "/a" or "/ac". So we have lost the second
and/or third character.
Why:
All characters typed between the first and the moment the command pallet
is not yet mounted are lost because the search bar of the command pallet
is not yet available.
Solution:
If you use openPalette and the command palette is already open.
The configuration of the command pallet will be overwritten by the one
given to openPalette.
In our case, we can pass new configurations with the correct searchValue
until the command palette is returned.
closesodoo/odoo#95492
Task-id: 2906623
Related: odoo/enterprise#29230
Signed-off-by: Géry Debongnie <ged@odoo.com>
Problem:
Have a pivot view in some state. Toggle a favorite with a context in
which a key "pivot_row_groupby" is defined. The pivot view should be
grouped (on rows) by that pivot_row_groupby but it is not always the
case. The basic problem is that the key "pivot_row_groupby" is never
considered after the first load (see method load in pivot_model.js).
Solution:
We make the search model used by the pivot view send as groupby for the
favorite its pivot_row_groupby instead of its groupBy (which can be
different). We do something similar for the graph view that presents a
similar problem.
closesodoo/odoo#95688
Opw: 2837428
X-original-commit: ea9f66f99caaa6136912c467e5b80fe605586845
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, a class was missing when the monetary field was on
edit mode. This results in a non-alignment between the monetary symbol
and the value.
closesodoo/odoo#95620
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the record was given to `field.extractProps`
so it could return props based on the record.
Now, only the attrs and field is given so it can be called
only once when parsing the arch (except for kanban).
closesodoo/odoo#95389
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, all radio buttons were on horizontal style,
the o_vertical class was not taken into account.
closesodoo/odoo#95553
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, when a new domain is created with a list of rules
and in one of those rules contains a PyDate/PyDatetime object in a
right leaf, this leaf will be converted into a plain object instead of
keeping the initial object.
For instance:
```js
a = new Domain([['date', '=', PyDate.create({day: 1, month: 1, year: 1970})]])
a.toList() // result: `[['date', '=', {day: 1, month: 1, year: 1970}]]`
```
Since it is a plain object, when the result will be passed to the
server, the final result will be an object in a string instead of giving
the utc date formatted.
This commit fixes this issue by checking if the object instances of the
`PyDate` or `PyDatetime`. If it is the case, then the ast type will be a
string and the value will stay the same instead of creating a plain
object and the ast type which determines a JSON.
closesodoo/odoo#95570
X-original-commit: be5c8d0fc340b3e2ad9721d21ef1133870d8a774
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Xavier <xbo@odoo.com>
In a grouped kanban view, drag a record to another column can modify the
record validity. In that case, the group changes should not be validated
and the drag and drop canceled.
closesodoo/odoo#95437
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
> Data attributes for all JavaScript plugins are now namespaced to help
> distinguish Bootstrap functionality from third parties and your own code.
> For example, we use data-bs-toggle instead of data-toggle.
https://getbootstrap.com/docs/5.1/migration/#javascript
Task ID: 2766483
Part-of: odoo/odoo#95450
In BS5 there is a check to avoid having multiple handler for one
element and we can't add two components' instance on an element.
So, before disposing a tooltip we check if there is an instance of a
tooltip and we avoid instantiation of tooltip if not already done.
e.g.:
> Bootstrap doesn't allow more than one instance per element. Bound
> instance: bs.collapse.
e.g.:
> Bootstrap doesn't allow more than one instance per element. Bound
> instance: bs.carousel.
> Bootstrap doesn't allow more than one instance per element.
> Bound instance: bs.tooltip.
Task ID: 2766483
Part-of: odoo/odoo#95450
- BS5 JS use the `data-bs-toggle="dropdown"` attribute to
automatically enable the BS Component.
But in this case as the `.dropdown-menu` is only rendered when the
`.dropdown-toggle` is clicked we can't initialize the Dropdown at the
first render. So we do it manually.
- change .dropdown-menu by .o-dropdown-menu (owl)
-> to handle keyboard navigation we can't use BS dropdowns
- use currentTarget of event
As the event can bubble we use currentTarget to be sure to be at the
higher level in the DOM.
> All the events for the dropdown are now triggered on the dropdown
> toggle button and then bubbled up to the parent element.
- BS5 don't add .show on parent group anymore
-> dropdown show class not on the same node on BS5
- avoid dropdown warning using margin in CSS
BS5 show a warning if we use margin statically in CSS for a dropdown.
> Popper: CSS "margin" styles cannot be used to apply padding between
> the popper and its reference element or boundary. To replicate margin,
> use the `offset` modifier, as well as the `padding` option in the
> `preventOverflow` and `flip` modifiers.
- adapt the systray activity dropdown for mobile
On desktop positions are now dynamic and on mobile it's static
- In BS5 the CSS `bottom: 100%;` is not more applied to the
`.dropup .dropdown-menu` selector.
- Change right -> end and add data-bs-popper="none" to avoid
Popper interaction
Task ID: 2766483
Part-of: odoo/odoo#95450
- BS5 uses native inputs instead of pseudo-element for some
input like checkbox, radio, ...
in BS5 input checkbox don't have "virtual visual" checkbox anymore
(::before), so we remove the relative's rules
- removed `.custom-control` class
- `form-switch` use a new layout system in BS5 we adapt the code to
match the Bootstrap approach (inline SVG).
- In tests, we don't check the exact value of the background as it
change in community/enterprise, and it's difficult to check the value
of an SVG.
- Overflow in progressbar is now hidden.
-> we had to restore it.
- In BS5 margins in forms/inputs has been changed
-> we had to restore it (e.g. 'mb-3')
- .form-group, .form-row, .form-inline
> Dropped form-specific layout classes for our grid system.
> Use our grid and utilities instead of .form-group, .form-row,
> or .form-inline.
- .input-group-append and .input-group-prepend
> Dropped .input-group-append and .input-group-prepend.
> You can now just add buttons and .input-group-text as direct
> children of the input groups.
Ref:
[1] https://getbootstrap.com/docs/5.1/migration/#forms
Task ID: 2766483
Part-of: odoo/odoo#95450
- modal 'show' option doesn't exist anymore
-> We need to call .show()
- by default, show is not the default
-> we need to call .show() explicitly.
- generic close button for dismissing content like modals and alerts.
- BS5 modals needs `modal-dialog` class to work
- normally we need also to add `modal-content` class but as the original
XML don't have this nested level of div we don't use it, but instead
we add `pointer-events: auto` for all children `DIV` of `modal-dialog`
-> See DocumentViewer
Task ID: 2766483
Part-of: odoo/odoo#95450
* data('bs.popover') is not a jQuery data anymore
-> fetch data from the instance instead.
* use the new class name 'popover-arrow' instead of 'arrow'
* website_forum: offset is not a number anymore
-> Convert to string instead.
* BS5 event listener: 'focus' -> 'focusin'
* use `mouseover` event to show and `mouseout` to hide.
* disable at some point the animation to avoid remaining listener
in the DOM.
Ref:
https://getbootstrap.com/docs/5.1/migration/#popovers
Task ID: 2766483
Part-of: odoo/odoo#95450
Before this commit, a form view with an empty button box would
produce a crash, in the ButtonBox component, because it assumed to
have slots. This commit prevents this from happening as we no
longer put a ButtonBox component in the template if there's nothing
in it.
closesodoo/odoo#95427
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Before this commit, the context parameter "form_view_initial_mode" was
ignored by the form views, so that the form view would not be always
initialized in the appropriate mode.
closesodoo/odoo#95413
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Problem:
Have
- a slow network
- a kanban view grouped
then move a given record from a column to another twice quickly.
An error occurs.
This is due to the way the transaction system in kanban model works:
the first move done in the first transaction being not yet finished,
no other transaction can begin and an error is thrown.
Solution:
Subclass Error and catch the specific transaction error at the
appropriate time to cancel the second order.
Note that the problem does not occur in a not grouped kanban view
because the hook useSortable prevent asking again a resequencing via
a proper management of the class o_record_draggable. That class is also
used in the grouped case but a rendering of the kanban view takes place
possibly before the end of the transaction: the record is moved in any
case to the targeted column and moved back if the overall operation
fails for some reason.
closesodoo/odoo#95235
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In an x2many sub view, the attribute "force_save" on a field
indicates that the field value must be saved, even if the field is
readonly. Before this commit, this attribute was ignored by the
new views. In the BasicRelationalModal, we only needed to propagate
this attribute to the fieldsInfo given to the BasicModel. In the
RelationalModel, we needed to take the attribute into account.
closesodoo/odoo#95396
Signed-off-by: Géry Debongnie <ged@odoo.com>
This commit adds the ability to pass a placeholder to all fields
containing an input.
This commit tests the ability to use a placeholder in all fields
containing an input.
closesodoo/odoo#95309
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit
There is an issue about the translatable field button not properly
shown.
A translatable field <input/> or <textarea/> should have a right padding
in order to ensure its text content does not go behind the translate
button.
After this commit
Existing style regarding this is reapplied.
Part-of: odoo/odoo#94952
Before this commit
On an empty kanban having a record in quick creation, if a user manage
to give the focus somewhere inside the bottom-left zone of the control
panel (or inside the searchview input) WITHOUT closing the form of the
record in quick creation, and then press the ArrowDown key on its
keyboard, a traceback appears.
How to reproduce?
- i.e. go to "Social Marketing > Campaigns"
- change the filter to show no records
- click on create
- make the record dirty BUT invalid (no value for the Responsible field)
- click on the search input
- press arrow down
- => traceback
After this commit
The traceback is not shown anymore because the kanban renderer makes a
safer check before trying to focus a kanban card.
Part-of: odoo/odoo#94952
Before this commit
When defining a view button in some view arch, the combination of its
class attribute with a `t-attf-class` is not correctly handled.
After this commit
This is fixed.
Part-of: odoo/odoo#94952
Before this commit
The quick create form view uses the new wowl form renderer, but
with the CSS style of the legacy form view.
This led to some issues, i.e. the width of some input fields
were ridiculously small.
After this commit
The quick create form view still uses the new form renderer, but with
the proper class "o_wowl_form_view" to ensure the proper style is
applied.
Part-of: odoo/odoo#94952
Problem:
In a kanban view with progress bars, have
- a record with a false value for the progress bar field
- "muted" be the color of a progress bar field value different from false
a crash occurs.
This happens because no fallback is found for value = false in
findProgressValueFromRecord.
Solution:
Always add a bar for the value false (as it was the case before).
closesodoo/odoo#95215
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*base, event, hr_holidays
Before this commit, `<t t-set/>` nodes declared outside the main
div of a kanban card where ignored by the kanban compiler. This
commit fixes that issue. To do so, we refactor a bit the way the
compiler and KanbanRecord handle multiple root cards (typically,
several roots with a t-if/t-elif/t-else, s.t. there's a unique
rendered root), by removing the faulty logic from the compiler
that identified card root nodes (and filtered out t-set nodes),
and introducing a div for the KanbanRecord component on which we
can set classNames, attributes and handlers.
The issue could be observed on the Apps kanban view, as it
displayed the "Install" button, whether the app was already
installed or not.
closesodoo/odoo#95211
Signed-off-by: Géry Debongnie <ged@odoo.com>
This commit fixes the behavior of the tooltip
enabled by the zoom option which displays
the full image when the field is hovered.
Before the commit, the preview_image option was
not used by the field and the full value was used
for both the field image and the tooltip.
A test has been introduced to check that the
field uses the right images sources when both
attributes are present.
closesodoo/odoo#95208
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The search model should always return [] as groupBy if searchMenuTypes
does not contain "groupBy". This allows a kanban view (for instance) to
define easily that it should not never be grouped.
closesodoo/odoo#95179
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Interrestingly enough, those missing ending square bracketsdoesn't have
consequences on the way the browser interprets these attribute
selectors... Anyway, for consistency sake, let's close them properly.
closesodoo/odoo#95070
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Before this commit, the loading indicator is shown immediately after
each network request. But this is distracting, and may cause an
impression of slowness, since it shows that the web client is working.
However, the feedback is very useful.
So, it has been decided that we would only display the loading indicater
after a delay of 250ms. All requests shorter than that duration will
just not show anything.
closesodoo/odoo#95037
Task: 2900450
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit fixes some inconsistencies of the progressbar
field widget since it was converted to Owl. Some behaviors
were wrongly adapted and edition was not enabled in kanban
views. It was also missing an option to allow editing the
field value in readonly mode.
closesodoo/odoo#95033
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, subtemplates in kanban did not share the same
ViewCompiler instance, thus losing the aggregation of the dropdowns.
Now, a single ViewCompiler is used for each KanbanRecord, properly
taking into account dropdowns declared in subtemplates.
closesodoo/odoo#94977
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In the new Kanban view, clicking on a BooleanToggle field (on any card)
always toggles the field of the first card. We would like to toggle the
field of the card that is clicked on.
This is because the same id (fieldName) is used for all Checkbox
in the BooleanToggle. If you click on a label, its native behaviour is
to click on the input with the same id. In our case, this will always
create a click on the first ToggleBoolean (the first card).
The solution is to make the id passed to the field unique. To do this,
we will add the datapointID to it.
Before:
Card 1: id = fieldName
Card 2: id = fieldName
After
Card 1: id = fieldName_datapoint_1
Card 2: id = fieldName_datapoint_2
closesodoo/odoo#94966
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
"All" is capitalized but not "records".
It should be consistent: either all capitalized, none, or only the first word
closesodoo/odoo#94963
Related: odoo/enterprise#28990
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
This commit allows multiple declarations of a dropdown menu in a kanban
card to generate a dropdown component for each definition.
Part-of: odoo/odoo#92475
In legacy kanban views, one could use JSON in the arch to, e.g.
parse text field values encoding data. This was no longer the case
in the new implementation. This commit fixes the issue by adding
it to the kanban record rendering context. However, we'll consider
adding it in owl directly.
Part-of: odoo/odoo#92475
Some attributes of the elements determining the "ellipsis" dropdown menu
of a kanban card were invalidly reported on the main Dropdown node
created during the compilation. This could cause crashes (during the
props validation) or broke the CSS.
In this commit:
- we fix the above mentioned problem
- we put the class o_drowdown_kanban on all "ellipsis" dropdowns
generated by the kanban compiler in order to get the appropriate CSS
- we make sure that those dropdowns are visible in kanban dashboards
by default
Part-of: odoo/odoo#92475
This commit removes the SimpleDialog class and adapts the
KanbanCoverImageDialog to use the Dialog component instead.
It also makes sure that the KanbanCoverImageDialog uses the FileInput
component to use a more centralized way of calling the HTTP
'upload_attachment' route.
Part-of: odoo/odoo#92475
This commit changes the prop names of the FileInput component to bring
them in line with the current naming conventions. Also the default
route has been changed from '/web/binary/upload' to
'/web/binary/upload_attachment' since the latter is used more often.
Part-of: odoo/odoo#92475
Before this commit, in `getModifier` method when a modifier contains a
domain in a string, the domain is not evaluated and just converted into
a boolean value that is if the string is not empty then the method will
return `true` and `false` otherwise.
Also, the `applyInvisible` method does not take into account an invisible
domain in a string. That is if the `invisible` variable contains a domain
in an `Array` then the domain is evaluated otherwise the domain is
considered as a boolean value.
This commit checks if the modifier contains a boolean value as value to
evaluate it as a boolean and return it otherwise the modifier value is
returned in the `getModifier` method.
In the `applyInvisible`, this commit allows to evaluate the domain if
the domain is containing in a string.
Part-of: odoo/odoo#92475
Co-authored-by: Xavier BOL (xbo) <xbo@odoo.com>
This commit re-adds support for the kanban-tooltip template in kanban
view arch, to do this, it also refactors the tooltip service to give it
a programmatic API, so that we are not constrained to only giving
tooltip info in serialized form, but can instead give the same context
to the tooltip template as to the kanban record's template.
One current limitation is that components that are available in the
kanban record cannot be used in the tooltip, as these are mostly used
for interactive content and one cannot interact with the contents of the
tooltip, we have decided to not work around this issue until needed.
Part-of: odoo/odoo#92475
Previously, we would use t-set to add the tooltip info under the key
"info" in the rendering context, while this works fine, it was mostly
just a workaround for the lack of support in owl for passing a rendering
context to be used by the t-call directly. Since this is now supported
in owl, the commit uses this feature for the tooltips and adapts the
call sites.
Part-of: odoo/odoo#92475
When on click outside of a quick create record, one wants
- to remove the quick create record if it is not dirty
- not to remove it if it is dirty with some exceptions:
if the click is on a "Create", "Load more" or "+" (quick add) button
This fix makes the external listener of KanbanRecordQuickCreate work as
expected.
Part-of: odoo/odoo#92475