This commit introduces several changes in the search panel with
respect to record counts:
- the record counts are now also available for
the fields with select="one" attribute
(if not disabled explicitely).
- the record counts are better computed using the idea that
selected values within a group should not impact the counts
for the group values but only the counts for the other
group values.
On the way we have changed two keys in the values returned
by the server:
- 'count' becomes '__count'.
It has been done to avoid a possible clash in case a model would
have a field named 'count' and that the field values would be
wanted for some reason.
- 'name' (multi case) becomes 'display_name'.
It has been done in order to make the select one and multi cases
more similar and factorize some code.
TASK-ID: 2166814
Co-authored-by: Raphaël Collet <rco@openerp.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Alexis Lacroix <laa@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Add a "sortBy" helper to core utils. This function takes an array and
an optional criterion as arguments and returns a new array sorted
according to the given criterion.
This commit improves the dialog that opens when a user clicks out
of an 'un-commited' many2one. It is no longer possible to edit
the value, and the sentence has been reworded.
closesodoo/odoo#49528
Task: 2234212
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In the search panel, if a select multi was grouped by a field that can
take the value 'false' (like a char field), that value would be confused
with the value false and the group 'false' would never be
displayed (its values would be put in the group false).
This commit avoids that situation by using JSON.stringify instead of
the implicit stringification done when using a value as an object key.
closesodoo/odoo#50647
X-original-commit: 5b19e6c13b636d108e8aa1a09f01124fdb38a577
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
If set, this value will be displayed as column name in list views.
This attribute could be used in the future in form view for the
same purpose.
Part of task 2195254
This widget is an extension of Many2OneAvatar, designed for
many2one fields pointing to the 'res.users' model, or a model having
itself a many2one field pointing to 'res.partner'.
With this widget, when the avatar is clicked, we open a DM chat
window with the corresponding partner. If the user clicked on itself,
we open a blank chat window for the sake of consistency.
In kanban views, this widget only displays the avatar.
Part of task 2195254
In readonly, this widget displays the image of the related record
next to its display_name. In edit, it behaves exactly like the
regular many2one.
Part of task 2195254
This widget can be used on date and datetime fields. In readonly,
it displays the delta (in days) between the value of the field and
today. In edit, it behaves like a regular date(time) widget.
Part of task 2195254
Have a list view with "badge" field component and 'decoration-xxx'
attributes (on that field). Before this commit, it flickered when
the user refreshed the list (for instance, by clicking on the list
icon in the view switcher). The badges were displayed with a grey
background (i.e. no decoration) for a brief moment, before their
style was applied.
Their style is applied in the mounted hook, which is called by
'on_attach_callback' (legacy version of mounted). However, the list
renderer computes its column widths in 'on_attach_callback', which
produces a repaint.
This commit moves this operation to the end of on_attach_callback,
such that other processing (like applying the badges style) is done
before the repaint.
This new field component displays the field's value inside a
bootstrap pill badge. Supported field types are 'char', 'selection'
and 'many2one'. The background color of the badge can be customized
by using the decoration-xxx mechanism, e.g.
<field name="state" decoration-danger="state == 'cancel'" widget="badge"/>
Part of task 2195254
This commit refactors the way the decoration-xxx attributes are
applied to field widgets/components, in a way that it can be
overridden in a given field or component to generate the approriate
className. By default, 'decoration-x' applies className 'text-x'.
This will be necessary for the new 'FieldBadge' component, which
needs to apply 'bg-x' classNames instead of 'text-x'.
Part of task 2195254
In list views, one can specify decoration-XXX attributes on the
arch root node. Those decorations are evaluated for each record,
and the corresponding style is applied on rows for which the
condition is true.
This commit allows to specify those decoration-XXX attributes on
field nodes as well. In this case, when the condition is met by a
record, only the field on which the attribute is set will be
impacted.
Part of task 2195254
Buttons with icon and string attributes now have both their icon
and string displayed, whereas before only the icon was displayed
(the string was available as title).
We also force class btn-link to style buttons with icon, except if
another btn-xxx class is explicitely provided.
Part of task 2195254
In the pivot view, groups comming from many read_group are assemble
to create the header hierarchies and the table.
Groups returned by the read_group may be already sorted by the server
using the order set on the model for instance and that order should
be reflected in the header hierarchies (and in the table).
It is important to keep that order since it might not be possible
to recreate it in the interface. Even if possible it might not be a
good idea for performance reasons.
Before this commit:
The groups are added in a JS object, whose keys are the group ids
(when grouping on a many2one at least). Then, to generate the table,
we iterate over the keys of that object, but those keys are sorted
according to the numerical order (not the insertion order),
because keys are kind of numeric.
See https://stackoverflow.com/questions/5525795/does-javascript-guarantee-object-property-order.
After this commit:
Instead of a JS object, we use a Map for which the insertion order
is used (official spec).
Task ID: 2243416
closesodoo/odoo#50551
X-original-commit: 1a9a85c8b8d0f47c3c6f3878cd6d9401ddc3ad75
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Issue
- Install CRM
- CRM > Reports > Activities
- Add a custom filter > Created on
- Select the date
You can't, the date picker is not shown
Cause
Actually, the date picker is shown but
very quickly and it is closed by a scroll
event thrown by Chart.js.
Solution
Close the date picker only if the user
scrolls manually.
OPW-2245019
closesodoo/odoo#50482
X-original-commit: bda320052ac937f5bc17c7da81d84633d72a8370
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Revision on 7ecae33571
Commit above introduced activity widget on partner kanban, but
unintentionally affected style of all other kanban views that have
details on kanban record.
This commit fixes the issue by applying special CSS rule only on
partner kanban view, so that other kanban views remain unaffected.
Task-Id 2237638
closesodoo/odoo#50474
X-original-commit: b0ef12bc0bcdb29ffc7e61f1a1a185248650283c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This reverts commit 715ef9fc2684dc875cf82ee312f20575ed42f94d.
Purpose of commit above was to fix an issue in kanban view
CSS introduced by 7ecae33571
This commit, however broke more kanban views. This happened
because the original commit changed a CSS rule with flex, and
commit above attempted to fix the issue by turning problematic
UI elements to their flex equivalence.
This change is too broad and unsafe, so the better decision is
to revert them.
Task-Id 2237638
X-original-commit: 6badf3839147c0b9a475247699227ed304bd402d
Before this commit, after adding a column or loading examples in a
kanban from the quick create column, it stays open. After this commit,
it will stay open if adding a column through it, but it will fold if the
user has loaded a set of columns from an example.
Task ID 2047369
PR #48299
Inspired by what is done in the task kanban of the project module,
add examples of kanban stage setups for UTM campaigns, and allow users
to load them.
There have also been some minor changes to the campaigns view:
- The helper message when there are no UTM campaigns has been changed
to a more descriptive message.
- All stages that existed by default (hardcoded in the data XML) have
been removed except default New one. An user with a fresh database will
have no stages in their kanban. The old hardcoded stages have been moved
to the demo data instead, so they will still be added by default if the
user installs demo data.
- The ghost columns that appear in the kanban when no stages exist have
been renamed to match the old stages that were hardcoded.
- When the user opens the view to create a column, the 'See examples'
link will appear below the 'Column title', just like in the project
addon, and clicking it will open some examples specifically made for UTM
campaigns. Clicking on the 'Use This For My Kanban' button will load the
stages of the selected example.
- A min-height property has been given to the example modal view so that
the view does not change size depending on the number of rows in the
ghost columns.
Task ID: 2047369
PR #48299
Before this commit, the only module that allows for selecting and
applying kanban column examples is the project module, for its tasks
kanban, so the message in the button to apply the example is hardcoded
as "Use This For My Project".
After this commit, the text in this button can be customized to make
this more generic, so a different module could use a different message
like "Use This For My Campaigns". If no text is specified, a generic
"Use This For My Kanban" is used instead.
Usage
```
kanbanExamplesRegistry.add('utm_campaign', {
applyExamplesText: _lt("Use This For My Campaigns"),
```
Task ID: 2047369
PR #48299
The color picker help the user to choose a color instead of picking it
by id.
The title and arial-label "no-color" default value are removed from the
picker_preview because they are not accurate. Instead name of currently set
color is used.
Task ID 2128166
closesodoo/odoo#47474
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Replaces unnecessary (harmless in this case, but still), 't-raw'
by 't-esc'. Also replace a t-raw used in the SwitchCompanyMenu
(unnecessary and harmless as well).
closesodoo/odoo#50411
X-original-commit: 691c9d2d2868885124749482aa8954322a40f130
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, searching a many2one field in the search bar would create a
domain with a parsed version of the input string. However the parser of m2o fields
returns a number (ID) and would consistently return 'NaN'.
Now, raw values are taken as is when searching with many2one fields.
Task 2239254
closesodoo/odoo#50410
X-original-commit: bac74010daae868da474de9439bc7027d9206e38
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Revision on 7ecae33571
Commit above introduced schedule activities on partner kanban view,
and also made slight CSS change in order to position next activity
nicely at the bottom of the card.
This change broke the layout in Rating kanban view with a groupby
filter. This happens because some CSS rules made use of a combination
of inline-block/float/margin-compensation to display image next
to kanban textual information.
This commit fixes all above issues by using flex.
Task-Id 2237638
closesodoo/odoo#50386
X-original-commit: e7e3d14f980b221158042097568061363f6f1468
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Since the commit https://github.com/odoo/odoo/commit/46cf65d68e9c13193dff4b563b9b0bbb2199dfc1
when help is not defined in action then nocontenthelp is displayed as
[object, object] due to the desciption passed from renderder of the
pivot view.
So in this commit while calling the NoContentHelper pass the
descitption as string instead of jquery element.
we can use the t-value in template but that string will create
issue for transalation so pass the desctiption from the pivot render.
closes odoo/odoo#50347
Taskid: 2240167
Closes: #49859
X-original-commit: c7cc672aba669175280d619ad39b14daefd7733f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Handling of escapes (`\`) was performed during evaluation rather than
parsing, so strings in the AST stored the escaped form (rather than
the proper one), and _formatAST had to mess around in order to try and
get it back into a semblance of relevance (especially as the AST would
store the escaped string without delimiters).
Fix: perform the escapes handling (aka normalisation) during
tokenization where it belongs. This means the AST formatter can now
just JSON.stringify the data. Until and unless we decide to produce a
cpython-compliant
repr (https://github.com/python/cpython/blob/0169d3003be3d072751dd14a5c84748ab63a249f/Objects/unicodeobject.c#L12902-L13006)
which is unlikely.
closesodoo/odoo#50236
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Before this commit, if a many2X field with a big comodel was added
in a search panel, the view using it would crash. For instance that
problem occured in the kanban view for hr.job, where res.users
appears as the comodel for the field user_id.
Now, we fix an arbitrary limit of 200 to the numbers of values to fetch
for each many2X fields in the search panel. This avoid the problem
mentionned above.
Furthermore, in case the limit is attained for a field used
as select="one", the values are displayed without being hierarchized.
Indeed the limit can leads to gaps in the knowledge of the hierarchy
and consequently to a bad representation of it.
Task ID: 2154668
closesodoo/odoo#50334
X-original-commit: 8d57153b34c04952a85f6642951cb2697016da84
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Avoid messing up with style by translating it
closesodoo/odoo#50251
X-original-commit: 6151757a8357693e189ff1ab31ece5efdbac65d6
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Before this commit, when a list contained owl field components,
the mounted hook was called twice on those components. This may
cause tricky issues like handlers being bound twice, and memory
leaks.
closesodoo/odoo#50127
X-original-commit: 206dd91e78f7896fc6b01020507657e61771787f
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, we waited for 10 seconds before defining the
boot test (checking that all JS modules have been correctly
loaded). However, small test suites (like the mobile one) ended
before this test was defined. So we could end up with a green
branch with tests not being executed (e.g. if a testing module
had missing dependencies, and was part of a small suite).
This commit removes the boot tests and instead does the check
at the end of the suite, before logging that the suite passed.
closesodoo/odoo#50109
X-original-commit: 048557eef32df94715ab464614c9d9d34c4a2689
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, some elements in the control panel were not properly encapsulated
in layout-related parent elements and this caused some inconsistencies if some of
the control panel components were not displayed. For example: if the breadrumbs
were missing, the search bar went to the left side instead of the right.
Now, all components are in a grid-like structure (in desktop mode) and should not
overstep their given boundaries. The layout in mobile remains unchanged since the
top part behaves quite differently.
closesodoo/odoo#50057
X-original-commit: 533db5991a5bb871198485cd71a63f75a8c6becf
Related: odoo/enterprise#10148
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Before this commit, when re-activating a previously active notebook tab, the form
renderer would assume that a tab was actually active. However this does not happen
if no tab is visible or defined and it results in a crash instead.
Now, if no active tab is found, a default active tab (0 = first) is set. This only
helps to prevent the crash and does not affect the current behaviour.
closesodoo/odoo#50006
X-original-commit: 73e0c0a1395ebd0e2b4ac7f857c863a0358c5e17
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Have a list view with an Owl field component (e.g. widget="badge"),
visible. Open the optional field dropdown and make another field
visible.
Before this commit, the '_onToggleOptionalColumn' handler was
executed twice, because two click events where triggered: one on
the label, and one on its associated input (because of the for
attribute, see [1]).
As a consequence, the new field was added, and directly removed
from the view. This could even cause subsequent crashes.
The difference between an Owl component and a legacy widget is
that the Owl component is async (more than a nextTick) as we wait
for the nextAnimationFrame to render. When the rendering is fast
enough (e.g. without Owl components), the click event isn't remap
to the input yet (because we empty the list HTML node), so the
handler is executed only once.
[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label
Issue reported on task 2204306
closesodoo/odoo#49920
X-original-commit: b02d347e8770835ad28a6487071930a904bce101
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
When an element is clicked during the test and a tiemout occurs, message
that appears in Odoo logs is not really clear.
closesodoo/odoo#49907
X-original-commit: 0e1545c52fdca6d311a18533d3d4efed984df329
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Before this commit, the result of our custom qunit assert
'doesNotHaveClass' was incorrect when it was called with
several classnames.
For instance
assert.doesNotHaveClass(<span class="a"/>, 'a b');
passed, whereas it shouldn't.
closesodoo/odoo#49892
X-original-commit: c40fc67a130ae8e0f061a89d3a21d2507a0f9ae3
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Currently in kanban view which contains search panel when user click
on kanban dropdown menu then a dropdown menu will be hidden due to
scrollbar of kanban view.
This issue arises from this commit:
https://github.com/odoo/odoo/commit/a95cbbd631a2fa9be62eb42cba43e853fdf4b789
closes odoo/odoo#49791
Task-id: 2204306
Closes: #47586
X-original-commit: d613bb8ba4f5a4d818592a80f4aee2ef67916bc0
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Before this commit, the 'selection' fields were treated like 'char' fields in the
"Add Custom Filter" menu of the control panel's filter menu. This meant that their
value was defaulted to "".
Now, the default value of a selection field is its first selection value.
closesodoo/odoo#49772
X-original-commit: 62b62570725bc8eb3d3fa77fd1e8efd7a4fb5d2b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
This commit introduces a new option in fields inheriting from type Numeric
which is `format`.
By default, Numeric fields are formatted according to their subtypes and locale
Adding, in a view, the option format set to a falsy value
will prevent the field's value from being formatted.
```
<field name="int_field" options="{\'format\': false}"/>
```
Task 2050119
Before this commit, the SearchPanel widget was given a single unified domain coming
from the view/controller. The issue was that some modules injected additional leaves
in this domain and there was no way to remove them/separate them from the original
view/controller domain.
Now, another paramater (the `viewDomain`) is given to the SearchPanel, containing
the distinct domain related to the view. The Lunch module has been adapted to give
the `location` domain through this new key.
Note that some tests steps had to be inverted since the method retreiving the
domain of the view/controller is asynchronous (needed by Lunch to give time to the
model to be loaded). It mainly concerns the RPC order which does not matter in this
case.
Task 2239706
closesodoo/odoo#49720
X-original-commit: e895e553899933be14c8abfd8c676b44a7f534d8
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>