This commit handles 2 things:
1) the merging of the `py_utils.context()` into the evaluation context
returned by `BasicModel._getEvalContext` to access the same time-related
keys,
2) the addition of 2 new keys into the `py_utils.context` (thus
transmitted to the basic model): `today` (an alias for the already
present `current_date`) and `now` which represents the current date and
time value.
Task 2269697
Adjacent buttons are not displayed in a single column. When the
table overflows, we try to squeeze largest columns to make it fit
into its container (in this case, text may be clipped and an
ellipsis is displayed). Button columns didn't get away from this.
As a consequence, now that a cell may contain several buttons,
some of them may be clipped and replaced by the ellipsis, which
isn't what we want for buttons.
This commit removes the button columns from the list of columns
to squeeze, so we let the browser reduce them as much as it can,
and we keep them as they are.
Task 2282470
closesodoo/odoo#54258
X-original-commit: e00960daa3ed3d1fd3a7572b2acedd3d2fb0448e
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, in a grouped kanban view with sample data (e.g.
crm.lead), one could toggle the 'settings' dropdown menu of a
group, and then drag&drop the group by clicking on the muted "Fold"
item in the dropdown.
After this commit, dragging a column is only possible by clicking
on the column title (but not on the 'config' or '+' icons, nor the
config dropdown).
Task 2290197
closesodoo/odoo#54179
X-original-commit: 58c38a024c96eba3469c142a8422b7bd0ab54ea4
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, there were a few tests in the "sample server" suite
that asserted that every group resulting of a "read_group" would contain
at least one record, while there was actually a slight chance of it not
happening.
Now, the sample server used in the tests has been rendered deterministic
and these kind of issues are completely avoided.
closesodoo/odoo#54164
X-original-commit: a6d32ff46558b68ce3f19458f29c311ee5c658fd
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Before this commit, boolean fields (without widget="boolean") in
kanban views were displayed as [Object object], because when no
widget is specified, we display the (textual) formatted value of
the field. However, the boolean formatter returns by default a
string encoding an html checkbox.
This commit passes the correct option to force a string formatting,
so it now displays "True" or "False". Moreover, this commit
uniformizes formatter options for that purpose, as another option
had been recently introduced for monetary field.
Note that those options should not be necessary, as formatters
should always return text values (no html). But this is a larger
change, that we might do in the future.
Task 2280394
closesodoo/odoo#53937
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Some widgets allow the edition in readonly (e.g. boolean_toggle,
priority...). In this case, the changed value is saved directly.
Before this commit, this didn't work in (main) list views: the
widget was updated with the new value, but it wasn't saved in db,
so the change was lost at reload.
This was due to the list controller not being correctly aware of
its mode ('edit' or 'readonly'), on which the basic controller
relies to determine whether a change must be saved directly or
not.
With this commit, a list is always in 'readonly', except when a
row is being edited, in which case it is in 'edit'.
Issue reported on task 2288963
closesodoo/odoo#54075
X-original-commit: 64e55cb42163643386740fbd23d710f64033b2ae
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In the search panel, the categories, i.e. fields select="one",
with attributes expand="0", and enable_counters="0" (defaults) were not
correctly updated when the domain outside of the search panel was
updated. This is no longer the case.
closesodoo/odoo#54040
X-original-commit: 99e9cac63f5034c1ba2154779fe82170dd656236
Related: odoo/enterprise#11642
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Problem:
Go to the application apps, select accounting in the search panel,
then filter on lunch in the search bar: the category all is displayed
as selected in the search panel (accounting is no more a valid value
since expand="0") but the application lunch does not appear in the
kanban view.
Root cause:
The kanban model is reloaded with the old domain using accounting
without waiting the search panel to be reloaded but it is only known
after the search panel has been reloaded that the accounting value is no
more valid and that all should be selected instead of accounting, thus
that the domain used by the kanban model should be updated.
Solution:
The solution to the problem is simple: first reload the search panel,
then reload the view model with the updated domain.
X-original-commit: 8589babcd0f2c15433fe1eb06d0d745e80d01c22
Before this commit, when the same field occurred multiple times in
a form view, all occurrences were associated with the same id, and
all occurrences of the corresponding label (if any) had the same
'for' attribute. As a consequence, besides the fact that there were
warnings in the chrome console, clicking on any occurrence of the
duplicated label focuses the first occurrence of the field.
This commit generates a unique id for each pair label/field, when
possible. However, there is a case that can't be handled
automatically: when the label isn't automatically generated (field
located outside a group, or with nolabel attribute set to "1").
Typically, in this case, there is a <label> node with "for"
attribute referencing the associated field. In this situation, the
id must be defined in the arch, and used in the "for" attribute:
<form>
<label for="phone"/><field name="phone"/>
<label for="phone_2"/><field name="phone" id="phone_2"/>
</form>
Task 2261697
The on_attach_callback methods on the widgets (comming from a tag
'widget') of a form renderer were not called at an appropriate time.
They were not called at all or called before the widgets were actually
in the dom. This was made manifest in the dashboards that generally use
pie charts widgets. Each time a pie chart widget is renderered,
a new canvas with a unique id is created. The above mentioned problem
explains why Chart.js was not able to acquire the canvas contexts: they
are obtained by looking for a specific id in the dom.
The present commit fixes that problem by doing in the class FormRenderer
what was already done correctly in the child class DashboardRenderer and
remove the unapropriate calls to on_attach_callback in _renderWidget.
Task ID: 2278717
closesodoo/odoo#53853
X-original-commit: 7641c7074616b4375f1eb4f1fcb5a96e2ed39f94
Related: odoo/enterprise#11537
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, when archiving a record through the action
menu, the 'Archive' link was not updated to 'Unarchive' and same
when unarchive was clicked, the link was not updated to 'Archive'.
After this commit, when archiving a record through the action menu,
the 'Archive' link is updated to 'Unarchive', same way when
unarchiving a record link is updated to 'Archive'.
This commit also introduces a new prop 'closeOnSelected' to the
Dropdown component, to specify whether the dropdown should be
closed when an item is selected, and makes Action Menu dropdown
closed on item selected.
task-2251739
closesodoo/odoo#53835
X-original-commit: dc5d02ade7747c74c31566c74932ef45c30e9356
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Currently, when kanban card drag and drop, it call onchange method
when onchange fails due to python error raised, e.g. UserError, kanban
view is not reloaded and kanban card stays in dropped column while
kanban card should come back to column from where it is dragged i.e.
kanban view should reload if onchange fails.
After this commit, if onchange trigerred from kanban drag and drop fails
then kanban view will get reloaded and card will come back to column
from where it is dragged.
note: in not stable version, forceFail option will not be added and
promise will fail in all cases but it is not done in stable for safety.
task-2267444
closesodoo/odoo#53695
X-original-commit: 27257d34c8b7374bfd8037de71f175f4ecb2913e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
When comparing time ranges in pivot, it makes more sense to display the
previous period before the one being compared. This commit allows that.
Task ID: 2269770
closesodoo/odoo#52746
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Co-authored-by: Priyanka Kakadiya <pka@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
On a re-render, when:
- a field is not yet started (still in willStart because of RPC)
- then an action is executed
we can get a traceback because we try to save the field before it is
started and `this.el` is not set.
eg. in MRP on a work order:
- click on + to get new serial number
=> page is re-rendered with RPC call to update duration to
mrp.workcenter.productivity().search_read to update time
counter
- click on "Record production" before RPC is finished
=> traceback because we try to save `duration` that is not already
started (`this.$el.toggleClass` when `this.$el` is `undefined`)
Without change, added test fails with:
"Cannot read property 'toggleClass' of undefined"
in BasicRenderer.canBeSaved
"Expected 6 assertions, but 5 were run"
Before saas-11.3 5faec34a3c this.el was always set in `init` so this
issue did not happen.
opw-2272117
closes#53532closesodoo/odoo#53612
X-original-commit: befcad51fd236fdaf284f76cea5624d21c070b0e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Previous commit introduces the sample data feature in list and
kanban views. When sample data is displayed, most parts of the
renderers can't be clicked on, to prevent the user from interacting
with sample records (e.g. to open a sample record in form view from
the list). This commit disables keyboard navigation as well, as
those sample records could still be accessed with the keyboard.
To do so, several refactorings have been done in views:
- _giveFocus function added on controllers (so that we can hook
on the moment where we want to focus the renderer, and prevent
it in sample mode), it kind of replaces giveFocus of ActionMixin
which wasn't use from the outside
- updateRendererState -> _updateRendererState as it is private
- _setState function added on controllers, to have a hook when we
set a new state (already existed, but only in kanban)
- _renderView function moved from Basic to AbstractRenderer, so
that we have a proper hook to deactivate clickable elements in
sample mode
Task 2232801
X-original-commit: 4482a03fe2f083f4f44fc6eb76d90ae22afbff91
With this commit, it is now possible to display sample (fake)
data in empty views, in the hope of easing user onboarding.
This can be enabled (in list and kanban views) with attribute
sample="1" on the arch root element. In this case, if there is
no data to display, sample data will be generated based on
heuristics (depending on field types and names). This can be
used in addition to the no content helper.
Task 2232801
X-original-commit: 7c8e627ff5029cb539d702705e5ce53d658c76ed
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Jérémy Hennecart <jeh@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Before this commit, monetary fields occurring in kanban views
without widget="monetary" specified weren't correctly formatted:
the whitespace separating the value from the currency symbol was
formatted has $nbsp; (html) instead of a simple whitespace.
closesodoo/odoo#52521
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
The counters for categories were not updated when filter values were
selected. This commit fixes that situation.
This might impact the global performances of the search panel but
there is still room for improvement. Actually, it could be
possible to reload categories and filters less often by carefully
track the internal changes and the categories/filters attributes
(enable counters, expand,...).
closesodoo/odoo#49307
Related: odoo/enterprise#9795
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In the search panel, the domain used to compute the field image values
(when the attribute expand is false) was the same as the domain used
to compute counters (if enabled). The idea was that a value bringing an
empty domain is totally useless and should not displayed.
That being true, it turns out that if one does not allow them and
several fields are used, selecting a value in the search panel will very
often totally transform the search panel. From a UI perspective,
this turns out to be bad: the search panel 'moves'.
Let us give an example:
Let us start from a search panel that looks like to:
first_field
A 1
B 3
second_field
C 1
D 2 <--- mouse above D
E 1
with first_field and second_field both with expand="0" and
enable_counters="1". Let us also assume that no record in the global
domain has both first_field=A and second_field=D.
Click on D would make the search panel look like to something like
first_field
B 1
second_field
C 1
D 2
E 1 <--- mouse here
(the selection of D does not impact the values for the second_field but
does for the other first_field values).
This has led us to use basically only the domain comming from
outside of the search panel to compute field image values.
This means that we might now have value with zero count even if expand
is false. In the above situation, a click on D would give us
first_field
A
B 1
second_field
C 1
D 2 <--- mouse still above D
E 1
Task ID: 2154749
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
This commit introduces a new attribute 'limit' for search panel fields
that allows to avoid performance issues. That integer attribute (with
default 200) allows to fix a maximal number of values to display for the
fields. When the number of field values to display reaches the limit,
no values will be displayed. Instead, a warning message will be shown
in the corresponding search panel section.
Note it is possible to have no limit using limit="0" on a field.
This commit reintroduces in a better way the principle brought by the
fix 8d57153b34c04952a85f6642951cb2697016da84.
Task ID: 2154749
The commit introduces two new attributes for search panel fields:
- hierarchize: boolean attribute (default True) available for
many2one fields with select="one". It allows to choose whether
to hierarchize the field values using the _parent_name (if set)
on the field comodel.
Note that a sanitization of the parent hierarchy takes place.
Basically, it ensures that parent chains are
completely in the domain (on comodel) accessible by the user.
See _search_panel_sanitized_parent_hierarchy documentation for
more information.
- expand: boolean attribute (default False) available for many2one
and many2many fields. If set to true, all field values are fetched
and displayed in the search panel. If set to false, only the
values that have at least one corresponding value in the field
model (and in some domain) are fetched.
An exception in the case of an hierarchized field
(hierarchize=True and _parent_name set): more/less values can be
displayed in order to have a good representation of the parent
hierarchy. That means we complete and sanitize the set of initial
field image values.
Note that the fix 8d57153b34c04952a85f6642951cb2697016da84 bringing the
notion of limit in search panel has been reverted in the present commit.
An upcomming commit will reintroduce the limit principle in a better way.
Task ID: 2154749
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
This commit adapts tests following recent changes on the helpers.
The main change is that addMockEnvironment (and all functions using
it) are now async, as they need to wait for services to be started.
Generally, Users are not necessarily aware that they can quick create a most
records by simply typing in their name+enter in the many2xxx field input.
The exact purpose of this commit is to make sure the user discovers the quick
create feature of our many2xxx fields.
For that, when the input is empty, display 'Start typing to create a record...'
at the bottom of the dropdown when can_create is set and no_create_edit option
not set. So the user can easily understand that by typing and pressing enter
will create the new record.
Also "Search and Create" options in the dropdown only been shown to the user
when it type anything in the input box as the same case in the "Create" option.
Task : 2266557
Co-authored-by: Mohammed Shekha <msh@openerp.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
PURPOSE
The purpose of this task is to improve the interface by removing the
fa-building icon which is automatically appended by the property field
(i.e. company-dependent) and, instead, indicates that a field has
company-specific values in the tooltip of the field.
closesodoo/odoo#52313
Taskid: 2266519
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, list selection box was not hidden after multi
record edition.
task-2266999
closesodoo/odoo#52590
X-original-commit: ac46e9f82b7cbfc55f395b66b2011399b9f972f1
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Tests have been adapted accross all affected modules to support the new
"comparison" menu component.
Task ID: 2245719
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
This commit adds the support of nolabel attribute on fields
in list view. This attribute can be used to empty the column header.
Example of use:
<record id="module_example_tree_view" model="ir.ui.view">
<field name="name">module.example.tree.opportunity</field>
<field name="model">module.example</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="tag_ids" widget="many2many_tags" nolabel="1"/>
</tree>
</field>
</record>
Result:
This will create a tree view with 2 columns.
The second column will have an empty header and won't be sortable.
Name |
--------+--------------
Record1 | [tag1]
Record2 | [tag1][tag2]
Record3 | [tag2]
closesodoo/odoo#52302
Task: 2269315
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Adjacent buttons in the arch are now displayed in a single column
in list views (main and x2many views). As soon as there is a node
in-between (even if it is invisible="1"), the rule doesn't apply
anymore and buttons placed before/after that node are rendered in
a separated column.
Task 2261774
closesodoo/odoo#51970
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, owl renderers were mounted twice.
This commit makes owl renderers mounted just once as it should be
X-original-commit: 9234aa5c5c7de2f7af23071a3ff76adf93e9cee7
1) Clicks on a section value are now bound to the entire header, meaning
that the sole purpose of the carets is purely esthetic.
2) Search panel categories will now only be folded if they are being
clicked on while already selected.
Classes that were no longer useful have been removed and tests have been
updated accordingly.
Task 2264700
closesodoo/odoo#51555
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In this commit, hierarchy carets in the search panel have been moved to
the left side of the labels. To achieve a consistent and correct
alignment, some DOM elements have been added/moved and the related SCSS
sheets have been adapted.
Carets on filter sections of the search panel have also been removed.
Task 2258508
Due to commit odoo/odoo@0150141756
when the widget calendar is initialized with date type record for
date_start and without all_day mapping events aren't shown on day/week
views. This is because all day zone isn't visible when all_day mapping
is not set.
After this commit, we show the all day zone also when the date_start is
a date type.
Steps to reproduce:
* Go to Project App
* Select/Create a project
* Select/Add a task with a deadline
* Return to project
* Select calendar view
* Select week view (of the deadline) => BUG
closesodoo/odoo#51818
X-original-commit: 1d83f4184e1b82db4dd4db54d98e509432340996
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: rfr-odoo <rfr-odoo@users.noreply.github.com>
PURPOSE
Currently, reporting views such as the bar and line charts have
their x-axis sorted either alphabetically or according to a
sequence. When reporting, the user would be interested in sorting
the x-axis values by their measure.
SPECIFICATIONS
Add 'ascending' and 'descending' options in graph view for bar and
line charts
Task 2070103
closesodoo/odoo#49970
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
This commit makes easier to select records in list views, by
extending the clickable area to the whole cell, instead of the
inside of the checkbox.
closesodoo/odoo#51156
Task: 2247387
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Have two x2many lists in a group in a form view. Increase the
width of a column in the first table. Before this commit, the
second table was also expanded.
task-2189968
closesodoo/odoo#47652
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Issue
- Install Projects
- All Tasks > Form View
- Edit the view
- Set statusbar clickable to '0'
Still clickable
Cause
In relational_field.js we do
`!!'0'` which returns true
like `!!'anythingelse'`
Solution
Add a '+' which will convert
the value into an integer
for a better conversion.
OPW-2235311
closesodoo/odoo#51083
X-original-commit: 53cc68fce32f46a0b4bc83a1e73a5d13a60fc995
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Before this commit: A problem occurs with kanban views that are not
groupable (i.e. for which searchMenuTypes does not contain 'groupBy'):
if the action has a default groupby (set in Studio for instance) then
it is still applied and causes crashes. That happens in the documents
kanban view for instance.
More generally, if a view is not groupable, some information on groupbys
can appear in the interface (in a facet) while not used/useful
for the view.
After this commit:
- if a kanban view is not groupable, a default groupby will never be
applied.
- if a view is not groupable, we ensures that
- the search query generated in the control panel has
groupBy = [],
- groupbys cannot be represented in a facet.
closesodoo/odoo#51041
X-original-commit: 91c80291e90127792623476d8997fd2a67569170
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
before this commit,
tabbing into the date or datetime field input it has only focus, value is not
selected.
after this commit,
navigate through a view in edit mode with the TAB key, when focus comes into
date/dateetime field input then input is focused and value of date/datetime
field is also get selected.
task-2246593
closesodoo/odoo#51062
X-original-commit: 962e4e18b559d90aa3456c77035659ac8017501d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Before this commit, it wasn't possible to multi-edit boolean
fields in list views. Actually, it didn't work for fields rendered
by Owl components. It only impacted boolean fields because it was
the only editable field widget that had already been converted in
Owl.
It didn't work because of three issues:
1) there is some sort of an hack in basic renderers: we set the
attribute '__node' on the field widgets, and this attribute is
used for instance by the controller, when it has to handle a
multi-edition. It tries to read it from the event's target
(typically the field widget). However, with owl components,
'__node' was set on the FieldWrapper (wrapping the actual
Field Component).
2) the original target (the Owl Component which triggered the
event) was lost when the event went through the compatibility
layer (for owl Component embedded in legacy widgets).
3) the multi-edition confirm dialog didn't handle Owl field
components.
Task 2254717
closesodoo/odoo#51044
X-original-commit: 36d23cfcdef3cea3539004ee5bb4479b859b8137
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
... when there is no data and user clicks anywhere in the no content
helper.
Task 2239617
Co-authored-by: Jinal Patel <jip@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
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>
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
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