The current spreadsheet layout is not adapted to print the document as
the spreadsheet component is designed to only be rendered in the visible
part of the client viewport, the invisible parts of the spreadsheet are
not rendered.
This revision adds the possibility to render the whole spreadsheet when
the user wants to print the document (either via a top menu button or
with the generic shortcut Ctrl+P).
closesodoo/odoo#140281
Task: 3575484
Related: odoo/enterprise#49829
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
This revision extends the caching introduced in [1] to cache the
Pivot cells of a `PivotTable` for every combination of `includeTotal`
and `includeColumnHeaders`. the conditions for the `clickableCell` of
`ODOO.PIVOT.TABLE` cells fetch the pivot cells a LOT, which becomes
problematic for big pivots.
For a spreadsheet with a formulat `ODOO.PIVOT.TABLE` that spreads over
2562 (122*21) cells:
| | Before | After |
|----------------------------------|---------|--------|
| `getPivotDomainArgsFromPosition` | 1227 ms | 124 ms |
| load spreadsheet as dashboard | 7.97 s | 2.4 s |
| | | |
[1] https://github.com/odoo/odoo/pull/138594closesodoo/odoo#141116
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
In order to identify an ODOO.PIVOT.TABLE formula cell, we set the
display name of the pivot as the evaluated value of the cell containing
the formula.
closesodoo/odoo#140674
Task: 3580153
Related: odoo/enterprise#50003
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Purpose
=======
This task answers two use cases making text filters more useful and easier to
use:
Always using the same few values
--------------------------------
The text filter allows to type any arbitrary text. However, some users will
always use the same few values. They will always again and again type the
same values, every time they want to set or change the filter value. That's
cumbersome. There's also a risk of making a typo while typing.
Parametric dashboards
---------------------
Some dashboards are built to be parametric (our business analysts do that a
lot). e.g. They put the measure field in a cell, then reference that cell in
PIVOT functions. If you want to have the same dashboard, but with another
measure: just update the cell with the new measure and that's it.
In read-only mode however, you can't update that cell :(
But you can mimic a variable parameter with a text filter. Create the text
filter, then get the filter value in a cell with the function
=ODOO.FILTER.VALUE("..."). Now you can update the cell value by setting
different values in the filter input.
However, you need to know exactly what value would be correct/valid for the
parameter. Typing any arbitrary text would lead to errors or unexpected
results. Business analysts can know that kind of technical stuff, but
lambda users don't. The solution is currently to duplicate the dashboard and
change the cell value with the exact parameter value you want.
Specification
=============
In the filter config side panel, allow the user to restrict the set of
possible values to values in a range of cells in the spreadsheet. Let's say
A1, A2, A3 contains Paris, Brussels, Berlin. If the user chooses A1:A3 in the
side panel, the text filter input is no longer a free text input, but becomes
a select with the 3 cities.
If a value from the range is selected, then the cell with this value is
changed to another value: keep the previous selected value selected.
display the values with their cell format but use their raw format for the
logic behind it (using the value as a cell value from ODOO.FILTER.VALUE)
closesodoo/odoo#139191
Task: 3554062
Related: odoo/enterprise#49204
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Change the global filter icon from the `fa-search` to something more
filter-like.
Also use the same icon in shared dashboard.
closesodoo/odoo#139164
Task: 3560817
Related: odoo/enterprise#49166
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Task Description
The aim of this PR is to be able to download a shared dashboard.
This is done by adding a "Download" button on the shared dashboard
(next to the frozen date), which allow to export the dashboard as
an .xlsx file.
Related Task
closesodoo/odoo#139426
Task: 3512907
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Task Description
o-spreadsheet now allows to insert images in a spreadsheet, and
we also allow to export them inside .xlsx file. However, while this
works as intended in a standalone o-spreadsheet server, it doens't
work correctly in Odoo as the data of the image are not found while
we try ton convert the spreadsheet to an xlsx file. This PR aims to
simplify the request made to get the binary data of the image file.
Related task
closesodoo/odoo#139549
Task: 3524473
X-original-commit: 301a98c
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
If a chart was linked to an odoo menu, but the odoo menu didn't have
an action, the user would get a traceback when clicking on the chart.
This commit:
- Improves dashboard validation. Now we test that the menu is linked
to an action, in addition to testing that the menu exists
- Send a "danger" notification when the user clicks on a chart with
a menu without an action linked to it, rather than a traceback
closesodoo/odoo#139324
Task: 3563450
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
In the goal of simplify assets loading, in this commit we create a new
assets bundle for chartJS and its luxon adapter.
With this, we can now use loadBundle instead of load these two libraries
with loadJS.
task-3562357
closesodoo/odoo#139544
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
In the dashboard action, when switching from dashboard to dashboard, the
size of the control panel flickers. That's because the Share button is not
displays while the dashboard is loading and it takes some place, making
the control panel taller when it's displayed.
With this commit, the Share button is always displayed (disabled when the model
isn't loaded). In addition to fix the size flickering issue, it's also less
things appearing/disappearing from the UI (less sapin de Noël)
closesodoo/odoo#138816
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Adds in date type global filters a new category
"From / To" allowing to define a domain between
two dates.
closesodoo/odoo#138507
Task: 3516362
Related: odoo/enterprise#48855
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Most tests that need the user id simply use `uid=7`, which will fail
if the default user id ever change in the tests. This commit replaces
it by `sessuin.user_context.uid`.
closesodoo/odoo#138733
Task: 3553122
Related: odoo/enterprise#48965
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Re-inserting a pivot that had a contextual domain would fail because
the data source would try to fetch the data with the domain as a string,
but the domain should be a list at this point.
Task: 3553122
Part-of: odoo/odoo#138733
When importing a pivot with a date field in week format, the date was
formatted as "W2023 40" instead of "W40 2023".
closesodoo/odoo#137682
Task: 3539629
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
There's no need to recompute the table structure
every time. The pivot model is never mutated, we can safely
store the table.
closesodoo/odoo#138594
Related: odoo/enterprise#48910
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Allows to "See records" or "Set matching filter" on ODOO.PIVOT.TABLE
cell results.
(from the context menu in "spreadsheet mode" or by clicking on cells
in dashboard mode)
Task: 3318865
Part-of: odoo/odoo#138594
This commit introduces a new pivot function:
ODOO.PIVOT.TABLE(<pivot_id>, [row_count], [include_total], [include_column_headers])
Purpose
-------
It answers several current limitations:
- The pivot in spreadsheet not being "dynamic" (growing as new groups/records
are created) is a *very* frequent feedback
- sorted pivots are very cumbersome (# syntax) and takes a lot of cells
- cannot easily compute arbitrary aggregates (max, avg). You only get the
total. ... as soon as new groups appears that are not reflected in the
spreadsheet, you can't guess data is missing and that it's not taken into
account.
Specification
-------------
Add a single and simple function =ODOO.PIVOT.TABLE(<pivot_id>) that would
display the entire table (dynamic, as more groups and records are added).
We can achieve almost everything we want:
- by combining with other functions (INDEX, CHOOSECOLS, CHOOSEROWS, XLOOKUP,
...) if we want to target a specific row or column.
- by using infinite ranges (e.g. =MAX(B2:B)) to account for a growing table
- we could remove all the positional PIVOT version of the function
(=ODOO.PIVOT.HEADER(7,"#country_id",1)). The implementation is a mess
(lots of ifs everywhere to account for the #). Just replace it by a single
function SORT(ODOO.PIVOT.TABLE(1), 1) (or with NSORT, or sorted from the
pivot view directly)
For some situations though, there would be the "Totals" in the way:
if you want =MAX(ODOO.PIVOT.TABLE(1)), you don't want to have totals in the
way (with infinite ranges). We add an optional parameter 'include_total'
(default to true)
For dashboards, we want to have custom header names, we don't want to use
the headers from the pivot. To only have data and not the headers:
new parameter 'include_column_headers' (default to true)
All in all: here is what it looks like:
ODOO.PIVOT.TABLE(<pivot_id>, [row_count], [include_total], [include_column_headers])
Task: 3318865
Part-of: odoo/odoo#138594
Co-authored-by: Lucas Lefèvre <lul@odoo.com>
Everytime `getFirstPivotFunction` is used, the returned
args are evaluated.
This commit adds a getter which factorizes this behavior
that was repeated several times.
This getter is also more robust to EMPTY args AST.
Part-of: odoo/odoo#138594
The PR https://github.com/odoo/odoo/pull/104741 have recently modify how the modifiers required, readonly,
invisible, and column_invisible are defined. They are now given by Python
expressions instead of domains. In this PR we introduce two main new
components ExpressionEditor and ExpressionEditorDialog that allow to
edit/view a Python expression in a way similar to what is done in the
DomainSelector/DomainSelectorDialog. For this we have extracted the main
logic found in DomainSelector and moved it to a new component TreeEditor
that is used by both ExpressionEditor and DomainSelector. For this we had
to add a new type of leaf we call "complex condition" that allows us to
represent indecomposable (sub)expressions, i.e. expressions we cannot
(or don't want) to express as conditions of the form (path, operator, value).
The main mappings allowing to transform trees, domains, expressions into
one another (when possible) are to be found in
@web/core/tree_editor/condition_tree.js.
closesodoo/odoo#136258
Related: odoo/enterprise#48512
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Carion <juca@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Pierre Pulinckx <pipu@odoo.com>
This commit removes the default exports from the spreadsheet module.
They don't bring anything except confusion when importing a mix of
default and named exports.
closesodoo/odoo#139071
Task: 3559536
Related: odoo/enterprise#49129
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Fixed cumulative attribute not passing from odoo and also added a checkbox to
the odooLineChart side panel, enabling users to easily switch between cumulative
and non-cumulative display modes.
the chart shows cumulative data, offering a comprehensive view of data progression.
Deselection displays regular non-cumulative data.
Task-3420844
closesodoo/odoo#138708
X-original-commit: 90eeb7318a6ac1b0d1a4a41715f3a895f3d5d8b6
Related: odoo/enterprise#48954
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
When the side panel of a pivot is opened while the side panel of
another pivot is already open, the datasource of the first pivot is
used instead of the datasource of the second pivot. This can lead to
tracebacks, or to wrong data being displayed.
closesodoo/odoo#138338
Task: 3463289
X-original-commit: b6df2d807f7ffe0f0f89d894307e31d779f138e2
Related: odoo/enterprise#48775
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Adrien Minne (adrm) <adrm@odoo.com>
This commit replaces the RecordsSelector component by the MultiRecordSelector
component in the global filters of the spreadsheet and the spreadsheet
dashboard. Thus, the RecordsSelector component is not used anymore and
can be removed.
Part of task-id 3433922
closesodoo/odoo#138464
Related: odoo/enterprise#48857
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
We improve various aspects of the domain selector:
- We make the domain selector be able to display all domains accepted by the class Domain (domain.js)
- We improve the edition/selection of values, e.g. for the operators in/not in
- We improve/simplify the style/dom
Task IDs: 3507123, 3508940
closesodoo/odoo#128680
Related: odoo/enterprise#48324
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Mathieu Notté <mano@odoo.com>
Currently, spreadsheet dashboards always display numbers with the en_US
format, no matter the user's lang.
That's because the locale is hardcoded in the spreadsheet source file, in
the source code (or it falls back to the default en_US locale if it's missing).
With this commit, we dynamically change the spreadsheet locale with the user's
locale when he loads a dashboard.
We can change the locale with every user because the dashboard is readonly.
It cannot create a giant mess with dates in various locales.
Limitation
----------
Since hardcoded date formats are not changed when the locale changes, dates
will keep the en_US format. However, most (if not all) dates in dashboards
are coming from ODOO.PIVOT and ODOO.LIST functions, which compute the formats
dynamically based on the current locale.
closesodoo/odoo#135119
Task: 3484002
Related: odoo/enterprise#47284
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit allows to reorder global filters via drag and drop. The
fact that global filters have a concept of order means that the
structure of the global filters in the core plugin need to change from
an Object<string, GlobalFilter> to an Array<GlobalFilter>.
closesodoo/odoo#135869
Task: 3502684
Related: odoo/enterprise#47583
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
The commands `ADD_GLOBAL_FILTER` and `EDIT_GLOBAL_FILTER` had the filter id
once in cmd.id, and once in cmd.filter.id. This made it possible to send
a command with 2 different ids, which can have arbitrary behaviour depending
on the implementation details of the command.
Changed it so we only use cmd.filter.id, and removed the cmd.id field. Also
simplified the commands helpers for the tests.
Task: 3502684
Part-of: odoo/odoo#135869
Task Description:
This PR aims to add the possibility to edit the evaluation domain of
an Odoo chart, the same way it can currently be done for other
datasources like `List` or `Pivot`. This revision ensures that the chart
datasources are properly reloaded their domain update.
closesodoo/odoo#135242
Task: 3384872
Related: odoo/enterprise#47336
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
PR [1] introduced the evaluation of ocntextual domain. However, this was
only evaluated once at the creation of the datasource. This revision
changes the flow to evaluate the context upon the datasource loading.
[1] https://github.com/odoo/odoo/pull/131874
Part-of: odoo/odoo#135242
In HBA's demo sheet, `markAsValueUsed` goes from more than 2% of the total
loading time to less than 1%
closesodoo/odoo#138166
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Instanciating an error is very slow.
In HBA's demo spreadsheet, `_assertDataIsLoaded` takes up to 17% of the total
spreadsheet loading time.
With this commit, it's reduced to less than 2%
Part-of: odoo/odoo#138166
`getReportMeasures` is called repeatedly for every pivot function.
In HBA's demo spreadsheet it takes up to 30% of the loading time.
Part-of: odoo/odoo#138166
On HBA's demo spreadsheet, `parseGroupField` takes more than 3% of the total
loading time.
This commit reduces to less than 1.5%
Part-of: odoo/odoo#138166
Previously, when users selected the month or quarter filter and saved
it, the filter would only return data from the current year. This issue
has been fixed in this commit.
Merge the month and quarter data filters into a single month/quarter
filter. This will allow users to select a year which behave as year filter.
If a user only selects a month or quarter, the filter will work accordingly.
The year filter will be removed, as the month/quarter filter can now
be used to filter data by year.
In addition, a checkbox will be added to the relation filter that will
allow users to automatically select the current user. This checkbox
will only be displayed if the model is res.users.
closesodoo/odoo#126935
Task: 3370627
Related: odoo/enterprise#43426
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Co-authored-by: Lucas Lefèvre <lul@odoo.com>
Purpose
-------
Currently, views with a contextual filter/domain are not well managed: e.g.
Today Activities
=> domain=[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]
My pipeline
=> domain=[('user_id', '=', uid)]
Currently, 'context_today().strftime('%Y-%m-%d')' or 'uid' would be replaced by
their values when the view is inserted into a spreadsheet.
If the view is inserted on the 1st June 2023, the date "01/06/2023" is
hard-coded in the spreadsheet.
Specification
-------------
Preserve the domain dynamic parts when inserted into a spreadsheet.
Implementation note: I force the readable format at export just to be sure it
exported that way, no matter the domain origin.
closesodoo/odoo#131874
Task: 3414027
Related: odoo/enterprise#45748
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commits hides a function in spreadsheet that are not supposed to be
used by end users: `_t`. It can only work with static strings in the source
code.
task 3102309
closesodoo/odoo#109863
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>