Commit Graph
246 Commits
Author SHA1 Message Date
Rémi Rahir (rar) d11845e322 [IMP] spreadsheet: Improve ODOO.PIVOT.TABLE hook value
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.

closes odoo/odoo#140674

Task: 3580153
Related: odoo/enterprise#50003
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-11-04 00:38:29 +00:00
Lucas Lefèvre (lul) 201445b2c2 [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/0887d5bb5 [REL] 17.0.1
https://github.com/odoo/o-spreadsheet/commit/88efb7049 [FIX] package: Export template file when publishing on npm
https://github.com/odoo/o-spreadsheet/commit/0678b7058 [FIX] SelectionInput: Unable to select range after confirm Task: 3493185
https://github.com/odoo/o-spreadsheet/commit/d8d943bb3 [IMP] history: reduce memory allocation
https://github.com/odoo/o-spreadsheet/commit/0170f5cad [IMP] range: order only if needed
https://github.com/odoo/o-spreadsheet/commit/05da23cbe [IMP] actions: don't create actions at each rending
https://github.com/odoo/o-spreadsheet/commit/1ce196dfb [IMP] viewport: find header with binary search
https://github.com/odoo/o-spreadsheet/commit/bb668d1d9 [IMP] locale: change date format with locale Task: 3575516
https://github.com/odoo/o-spreadsheet/commit/cc08fcf00 [FIX] XLSX: Exported image dimension Task: /
https://github.com/odoo/o-spreadsheet/commit/c0a34c295 [REL] 17.0
https://github.com/odoo/o-spreadsheet/commit/5080bc451 [REM] viewport: remove unused parameter
https://github.com/odoo/o-spreadsheet/commit/07999834b [REM] viewport: remove always falsy condition
https://github.com/odoo/o-spreadsheet/commit/f4583b226 [FIX] header_size: decouple added row from base row Task: 3510863
https://github.com/odoo/o-spreadsheet/commit/7be4d753f [FIX] evaluation: avoid .shift()
https://github.com/odoo/o-spreadsheet/commit/83aba22d4 [FIX] top_bar: force white background
https://github.com/odoo/o-spreadsheet/commit/f7fb70ee7 [IMP] headers: add header position UI plugin Task: 3563624
https://github.com/odoo/o-spreadsheet/commit/c58899b26 [IMP] selection: don't dispatch at `START` Task: 3563624
https://github.com/odoo/o-spreadsheet/commit/a4fe61669 [IMP] headers: add `getHeaderSize` getter Task: 3563624
https://github.com/odoo/o-spreadsheet/commit/2dd53005c [IMP] translations: Do not translate template strings Task: /
https://github.com/odoo/o-spreadsheet/commit/18a08b1de [REL] 16.5.0-alpha.13
https://github.com/odoo/o-spreadsheet/commit/bb48a4eda [FIX] border_editor, top_bar: dark-mode adaptations Task: 3201038
https://github.com/odoo/o-spreadsheet/commit/5176308f4 [FIX] evaluation: fix evaluateFormula getter typing
https://github.com/odoo/o-spreadsheet/commit/612f02623 [IMP] Functions: add SORT, SORTN and RANK Task: 3472980
https://github.com/odoo/o-spreadsheet/commit/ca56b0809 [FIX] Highlight: prevent default `mousedown` behaviour Task: /
https://github.com/odoo/o-spreadsheet/commit/10a42a475 [REF] ClientTag: use t-if instead of opacity Task: /
https://github.com/odoo/o-spreadsheet/commit/43692a6e5 [REF] tests: dispatch both input and change events
https://github.com/odoo/o-spreadsheet/commit/8dae28aed [REF] chart_test: improve test speed/readability
https://github.com/odoo/o-spreadsheet/commit/0f3b35682 [FIX] collaborative: display other users name

closes odoo/odoo#140649

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2023-11-03 10:46:07 +00:00
Lucas Lefèvre (lul) fb8c608e3d [IMP] spreadsheet: restrict text filter to range
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)

closes odoo/odoo#139191

Task: 3554062
Related: odoo/enterprise#49204
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-11-02 15:10:52 +00:00
Lucas Lefèvre (lul) b3369c42bb [FIX] spreadsheet: test invalid pivot expression detection
See https://github.com/odoo/odoo/pull/139871/files#r1377199846

closes odoo/odoo#140418

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-31 10:33:57 +00:00
Adrien Minne (adrm) eba33ff004 [IMP] spreadsheet: change global filter icon
Change the global filter icon from the `fa-search` to something more
filter-like.

Also use the same icon in shared dashboard.

closes odoo/odoo#139164

Task: 3560817
Related: odoo/enterprise#49166
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-30 13:55:56 +00:00
Odoo Translation Bot 6739c317d1 [I18N] Update translation terms from Transifex 2023-10-29 00:07:17 +02:00
Louis (wil) 3f6f949fa5 [I18N] export sources
closes odoo/odoo#140002

Related: odoo/enterprise#49687
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-10-27 08:36:16 +00:00
anhe-odoo 33e00d1c13 [IMP] spreadsheet: allow to download a shared dashboard
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

closes odoo/odoo#139426

Task: 3512907
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-26 08:45:56 +00:00
Pierre Paridans 963842381e [IMP] web,*: replace ClipboardJS with Web API and homebrew polyfill
*: auth_totp_portal, mrp_subcontracting, project, survey, web_editor,
   website, website_links, website_sale_loyalty, website_slides, test_lint,
   spreadsheet

Implements missing `clipboard.write()` and `ClipboardItem` ; targets
only Firefox (which partially implements Clipboard API, features hidden
behind a preference flag).

Supported browsers: Chromium 76+, Safari 13.1+, Firefox 63+, Safari iOS
13.4+.

This allows to replace ClipboardJS by the native Clipboard Web API.

Reference:
https://caniuse.com/?search=clipboard
https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
https://w3c.github.io/clipboard-apis/

task-3439226

closes odoo/odoo#134881

Related: odoo/enterprise#47154
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-10-26 07:22:54 +00:00
anhe-odoo 02c4f52a9a [FIX] spreadsheet_edition: fixes image export in .xlsx
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

closes odoo/odoo#139549

Task: 3524473
X-original-commit: 301a98c
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-25 17:03:21 +00:00
Adrien Minne (adrm) 61d54527fc [IMP] spreadsheet: improve wrong linked menu handling
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

closes odoo/odoo#139324

Task: 3563450
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-25 11:37:33 +00:00
Pierre Pulinckx (pipu) 1d6f2da14a [REF] *: add chartjs assets bundle
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

closes odoo/odoo#139544

Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-10-24 15:23:30 +00:00
Rémi Rahir (rar) b2167e0a23 [IMP] spreadsheet: Add class props to SpreadsheetShareButton
Make the share button style parametric as we use it in different
contexts.

closes odoo/odoo#139302

Task: 3329419
Related: odoo/enterprise#49302
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-24 13:55:13 +00:00
Lucas Lefèvre (lul) 99d93872a3 [FIX] spreadsheet[_dashboard]: avoid flicker
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)

closes odoo/odoo#138816

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-24 12:38:27 +00:00
Alexis Lacroix c0bc8d9ea9 [IMP] spreadsheet: add date from_to global filter
Adds in date type global filters a new category
"From / To" allowing to define a domain between
two dates.

closes odoo/odoo#138507

Task: 3516362
Related: odoo/enterprise#48855
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-24 12:38:25 +00:00
Adrien Minne (adrm) 783a1dfeba [FIX] spreadsheet: don't use constant uid in tests
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`.

closes odoo/odoo#138733

Task: 3553122
Related: odoo/enterprise#48965
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-23 20:07:26 +00:00
Adrien Minne (adrm) 0d9e4804b1 [FIX] spreadsheet: re-insert pivot w/ contextual domain
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
2023-10-23 20:07:26 +00:00
Rémi Rahir (rar) 8a608a66ed [IMP] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/430f0907 [REL] 16.5.0-alpha.12
https://github.com/odoo/o-spreadsheet/commit/ca347935 [FIX] scorecard: fix baseline arrow
https://github.com/odoo/o-spreadsheet/commit/07863006 [IMP]  grid: add custom paste shortcuts
https://github.com/odoo/o-spreadsheet/commit/8c94a5a6 [FIX] Selection: exclude hidden rows/cols in selection statistics Task: 3508872
https://github.com/odoo/o-spreadsheet/commit/383f5344 [FIX] Figure: Pass figure as child component props Task: /
https://github.com/odoo/o-spreadsheet/commit/4b42059d [REL] 16.5.0-alpha.11
https://github.com/odoo/o-spreadsheet/commit/8635acf7 [FIX] charts: export gauge and scorecard charts in .xlsx Task: 3524473
https://github.com/odoo/o-spreadsheet/commit/a825627d [IMP] chart: Scorecard are now drawn on a canvas Task: 3524473
https://github.com/odoo/o-spreadsheet/commit/cb493613 [IMP] index: expose SelectionInput and toUnboundedZone Task: 3554062
https://github.com/odoo/o-spreadsheet/commit/8282716d [FIX] xlsx export: remove unsupported characters Task: 3552957
https://github.com/odoo/o-spreadsheet/commit/031593c2 [IMP] index: expose lettersToNumber
https://github.com/odoo/o-spreadsheet/commit/450a4eae [REF] ot: extract and expose range transformation helper Task: 3554062
https://github.com/odoo/o-spreadsheet/commit/8da5fb29 [IMP] types: shorter getters declaration
https://github.com/odoo/o-spreadsheet/commit/7e3bed67 [FIX] clipboard: cut/paste whole CF across sheets Task: 3502777
https://github.com/odoo/o-spreadsheet/commit/4e5f15f7 [FIX] icons: Fix icon svg's
https://github.com/odoo/o-spreadsheet/commit/c81dce7e [IMP] evaluation: expose getCorrespondingFormulaCell Task: 3318865
https://github.com/odoo/o-spreadsheet/commit/854f2d74 [FIX] ChartPanel: traceback on deleting chart while editing data series Task: 3523882
https://github.com/odoo/o-spreadsheet/commit/d39ded8c [IMP] edition: cancel edition when setting format Task: 3515610
https://github.com/odoo/o-spreadsheet/commit/b742ae0e [IMP] formats: add more date and number formats Task: 3515610
https://github.com/odoo/o-spreadsheet/commit/5641af62 [REF] formats: use helper to create format action Task: 3515610
https://github.com/odoo/o-spreadsheet/commit/025ee4db [FIX] menu: truncate menu description Task: 3515610
https://github.com/odoo/o-spreadsheet/commit/278c019a [FIX] core: typo
https://github.com/odoo/o-spreadsheet/commit/e6cad253 [MOV] tests: split tests files by category
https://github.com/odoo/o-spreadsheet/commit/34d96c72 [FIX] headers_overlay: reselect full column or row as dataseries range Task: 3481617

closes odoo/odoo#139383

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-20 23:37:50 +00:00
Adrien Minne (adrm) bb4216b950 [FIX] spreadshet: wrong date format for week in pivot
When importing a pivot with a date field in week format, the date was
formatted as "W2023 40" instead of "W40 2023".

closes odoo/odoo#137682

Task: 3539629
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-20 20:52:41 +00:00
Lucas Lefèvre (lul) 68ff6fe9ce [IMP] spreadsheet: store pivot table structure
There's no need to recompute the table structure
every time. The pivot model is never mutated, we can safely
store the table.

closes odoo/odoo#138594

Related: odoo/enterprise#48910
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-20 14:59:19 +00:00
Lucas Lefèvre (lul) d1313ff85e [IMP] spreadsheet: see records and set filter from ODOO.PIVOT.TABLE
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
2023-10-20 14:59:19 +00:00
Adrien MinneandLucas Lefèvre 442e8a23ae [IMP] spreadsheet: add ODOO.PIVOT.TABLE function
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>
2023-10-20 14:59:19 +00:00
Lucas Lefèvre (lul) 824324dd9a [REF] spreadsheet: introduce getters to get pivot args
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
2023-10-20 14:59:19 +00:00
71c81e605b [IMP] *: expression edition
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.

closes odoo/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>
2023-10-20 11:22:05 +00:00
Adrien Minne (adrm) 8535e4d8b7 [IMP] spreadsheet: remove default exports
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.

closes odoo/odoo#139071

Task: 3559536
Related: odoo/enterprise#49129
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-19 14:47:31 +00:00
aath-odoo 4dbb6b2c31 [FIX] spreadsheet: added cumulative mode for odoo line chart
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

closes odoo/odoo#138708

X-original-commit: 90eeb7318a6ac1b0d1a4a41715f3a895f3d5d8b6
Related: odoo/enterprise#48954
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-17 08:53:09 +00:00
Adrien Minne (adrm) e0b739168d [FIX] spreadsheet: wrong datasource in pivot side panel
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.

closes odoo/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>
2023-10-17 01:48:08 +00:00
Pierre Rousseau cb5d5fe15a [REF] spreadsheet, spreadsheet_dashboard: use MultiRecordSelector
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

closes odoo/odoo#138464

Related: odoo/enterprise#48857
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-13 11:46:21 +00:00
Mathieu Duckerts-AntoineandMathieu Notté 6428aef678 [IMP] *: improve domain selector edition, dom, and style
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

closes odoo/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>
2023-10-13 06:27:42 +00:00
Lucas Lefèvre (lul) 8600d5d363 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/4dc340fc [REL] 16.5.0-alpha.10
https://github.com/odoo/o-spreadsheet/commit/c6e5d58e [IMP] dates: cache date parsing
https://github.com/odoo/o-spreadsheet/commit/38e44577 [IMP] range: don't spend time building a zone
https://github.com/odoo/o-spreadsheet/commit/7e491948 [IMP] cell: faster formula string
https://github.com/odoo/o-spreadsheet/commit/d6a498b4 [FIX] evaluation: don't build formula content for errors
https://github.com/odoo/o-spreadsheet/commit/5e2a7640 [IMP] evaluation: don't create useless Errors
https://github.com/odoo/o-spreadsheet/commit/d5ff0843 [IMP] Composer: highlight fuzzy matched letters in autocomplete dropdown
https://github.com/odoo/o-spreadsheet/commit/3562883e [IMP] Composer: always sort autocomplete elements
https://github.com/odoo/o-spreadsheet/commit/e8d76dd3 [IMP] Composer: Select autocomplete results on mouseover Task: 3387413
https://github.com/odoo/o-spreadsheet/commit/b6dc8877 [IMP] evaluation: don't spend time building formula string
https://github.com/odoo/o-spreadsheet/commit/078e888d [FIX] evaluation: compute cell only once

closes odoo/odoo#138145

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-11 17:02:10 +00:00
Lucas Lefèvre (lul) aa118d7dc0 [IMP] spreadsheet_dashboard_edition: load dashboard with user locale
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.

closes odoo/odoo#135119

Task: 3484002
Related: odoo/enterprise#47284
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-11 17:01:57 +00:00
Adrien Minne (adrm) c39c329d6b [IMP] spreadsheet: allow to reorder global filters
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>.

closes odoo/odoo#135869

Task: 3502684
Related: odoo/enterprise#47583
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-10 18:31:02 +00:00
Adrien Minne (adrm) 5063e2a1e5 [REF] spreadsheet: de-duplicate filter id in cmds
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
2023-10-10 18:31:02 +00:00
anhe-odoo 5b29e2cd21 [IMP] spreadsheet: Allow Odoo Chart domain edition
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.

closes odoo/odoo#135242

Task: 3384872
Related: odoo/enterprise#47336
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-10 17:26:35 +00:00
Rémi Rahir (rar) bc15b92272 [FIX] spreadsheet: Datasource - evaluate domain on-the-fly
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
2023-10-10 17:26:35 +00:00
Lucas Lefèvre (lul) 1bc0cea716 [FIX] spreadsheet: mark pivot cell faster
In HBA's demo sheet, `markAsValueUsed` goes from more than 2% of the total
loading time to less than 1%

closes odoo/odoo#138166

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-10 11:07:59 +00:00
Lucas Lefèvre (lul) 9579799cb7 [FIX] spreadsheet: reuse same error
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
2023-10-10 11:07:59 +00:00
Lucas Lefèvre (lul) 3ef421c1d2 [FIX] spreadsheet: faster compute format
`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
2023-10-10 11:07:59 +00:00
Lucas Lefèvre (lul) 568be9e7b8 [FIX] spreadsheet: parse group field faster
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
2023-10-10 11:07:59 +00:00
jash-odooandLucas Lefèvre 25d5b98832 [IMP] global_filter: date filtering and automatic user selection
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.

closes odoo/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>
2023-10-09 21:43:48 +00:00
Lucas Lefèvre 25eec6820b [IMP] spreadsheet: export views with contextual domain
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.

closes odoo/odoo#131874

Task: 3414027
Related: odoo/enterprise#45748
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-09 13:25:23 +00:00
Lucas Lefèvre (lul) ad5c1e7370 [REF] spreadsheet: rename button class
Commit odoo/o-spreadsheet@adcda84 renamed the button
class.

closes odoo/odoo#137902

Related: odoo/enterprise#48560
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-06 18:18:32 +00:00
Lucas Lefèvre (lul) b86ab422a1 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/c46de914 [REL] 16.5.0-alpha.9
https://github.com/odoo/o-spreadsheet/commit/1438e657 [FIX] side panels: fix link button style Task: /
https://github.com/odoo/o-spreadsheet/commit/f66c9ab4 [FIX] components: fix some button styles Task: /
https://github.com/odoo/o-spreadsheet/commit/62718580 [IMP] CF: reorder preview list with drag and drop Task: 3504521
https://github.com/odoo/o-spreadsheet/commit/d214df23 [REF] CF: split side panel into multiple components Task: 3504521
https://github.com/odoo/o-spreadsheet/commit/f954de50 [IMP] PieChart: percentage visualization for tooltip
https://github.com/odoo/o-spreadsheet/commit/6bc519e0 [IMP] SidePanel: remove unused css rule
https://github.com/odoo/o-spreadsheet/commit/6b9927b6 [MOV] side panel: rename `SidePanelErrors` to `ValidationMessages`
https://github.com/odoo/o-spreadsheet/commit/adcda849 [IMP] grid: add specific # of rows at the end of sheet
https://github.com/odoo/o-spreadsheet/commit/c8289169 [FIX] sheetview: performance issue for too many rows/cols Task: /
https://github.com/odoo/o-spreadsheet/commit/36d3a47e [IMP] spreadsheet: Add Data Validation feature Task: 3422042
https://github.com/odoo/o-spreadsheet/commit/d701460b [REF] filter: create GridCellIcon component Task: 3422042
https://github.com/odoo/o-spreadsheet/commit/953ad1d2 [MOV] error_tooltip: add dedicated test file Task: 3422042
https://github.com/odoo/o-spreadsheet/commit/d61cbee2 [IMP] edition: add CANCEL_EDITION command Task: 3422042
https://github.com/odoo/o-spreadsheet/commit/aad55661 [FIX] Find & Replace: Clear search debounce at unmount Task: /
https://github.com/odoo/o-spreadsheet/commit/f91bf8b6 [IMP] SelectionInput: remove useless ternary expression Task: /
https://github.com/odoo/o-spreadsheet/commit/a5be6827 [IMP] SelectionInput: add missing release on selectionProcessor Task: /
https://github.com/odoo/o-spreadsheet/commit/f94eed58 [FIX] filters: hide sort buttons in readonly mode Task: 3475613
https://github.com/odoo/o-spreadsheet/commit/02436b16 [FIX] locale: string dates in CF aren't (un)localized Task: 3481670
https://github.com/odoo/o-spreadsheet/commit/f7b9b9a5 [FIX] clipboard: cut/paste filter table in another sheet Task: 3498592
https://github.com/odoo/o-spreadsheet/commit/0c8782bd [IMP] EventStream: Observers register only once Task: 3142006
https://github.com/odoo/o-spreadsheet/commit/e008fe2b [FIX] test: undeterministic test in spreadsheet.test.ts
https://github.com/odoo/o-spreadsheet/commit/f2cd5abf [REV] find & replace: shorten the debounce on find search Task: 3510813
https://github.com/odoo/o-spreadsheet/commit/549142d4 [FIX] Find&Replace: purge duplicated handler Task: /

closes odoo/odoo#137440

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-05 08:08:59 +00:00
Chenyun Yang dd357f2f6a [IMP] spreadsheet: mark _t function to be hidden
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

closes odoo/odoo#109863

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-02 12:58:46 +00:00
Thibault Delavallée 617a4aef2c [FIX] various: fix ot !
Fix ot that should nto be.

closes odoo/odoo#128232

Related: odoo/enterprise#43995
Related: odoo/upgrade#4929
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-27 17:40:55 +00:00
Lucas Lefèvre (lul) a8c6f26912 [IMP] spreadsheet: remove unused public method
The method is no longer used by the web client:
=> it should be private

See enterprise commit

closes odoo/odoo#133500

Task: 3483938
Related: odoo/enterprise#46460
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-09-27 14:57:00 +00:00
Lucas Lefèvre (lul) 72392426ec [FIX] spreadsheet: cast currency rate date
This commit fixes two issues with the ´date´ argument for
the ODOO.CURRENCY.RATE function.

First, the helper to cast the date is `toJsDate`, not `toJSDate`. Using
the wrong function name obviously crashes.

Second, the date was actually given to the server as a full ISO datetime
string, including timezone (UTC).

For function `ODOO.CURRENCY.RATE("EUR","USD", "12-31-2020 00:00:00")`, we
actually sent to the server "2020-12-30T23:00:00.000Z" (Brussels local time)
Notice that it's the previous day!

The field of `res.currency.date` is a date field, so it doesn't make sense
to send a datetime.

Now, only the date is sent ("2020-12-31")

opw-3498115

closes odoo/odoo#136411

X-original-commit: 6a4b7e7f216dc9a6372f5cc382262ff09cb317f3
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-09-25 11:30:16 +00:00
Lucas Lefèvre (lul) f60be08753 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/0b7527d5 [REL] 16.5.0-alpha.8
https://github.com/odoo/o-spreadsheet/commit/f8de9ab6 [IMP] Formulas: Add new statistics formulas
https://github.com/odoo/o-spreadsheet/commit/1a685a08 [IMP] data: add the trim whitespace feature Task: 3356367
https://github.com/odoo/o-spreadsheet/commit/1f5bb485 [REM] spreadsheet_edition: remove dead edit text
https://github.com/odoo/o-spreadsheet/commit/7956f571 [REF] drag&drop: stop using CUT/PASTE commands Task: 3502194
https://github.com/odoo/o-spreadsheet/commit/e26eee16 [FIX] GridOverlay: Hovering over a figure should not open popovers Task: 3475001
https://github.com/odoo/o-spreadsheet/commit/33b04fb0 [FIX] deepEquals: fix simple type comparison Task: 3479451
https://github.com/odoo/o-spreadsheet/commit/f7e58774 [FIX] clipboard: copy/paste of CF in another sheet Task: 3479451
https://github.com/odoo/o-spreadsheet/commit/be185413 [IMP] demo: disable HTML quirks mode Task: 3506565
https://github.com/odoo/o-spreadsheet/commit/a529d61b [IMP] export: do not export defaulf style values Task: /
https://github.com/odoo/o-spreadsheet/commit/4fe9e1a6 [IMP] build: add banner
https://github.com/odoo/o-spreadsheet/commit/dd52c9b0 [FIX] build: restore commit hash
https://github.com/odoo/o-spreadsheet/commit/c2640de1 [FIX] ErrorToolTip: fix error tooltip long text Task: 3328557

closes odoo/odoo#136242

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-09-22 11:56:04 +00:00
jash-odoo 3911a69bbb [IMP] spreadsheet_edition: field matching for extend filters
- When a new pivot is added, and if the user has already defined
field matching in a previous pivot, the new pivot will inherit the
field matching from the previous pivot as default values.

- If multiple pivots are added from different models, will check the
model of the new pivot against previous pivots. If the model matches,
the field matching from the matching previous pivot will be used. If
no matching model is found, the field matching will be left empty.

- Same will also done in case of list and odoo chart.

closes odoo/odoo#135841

Taskid: 3373163
Related: odoo/enterprise#47570
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-09-21 23:54:23 +00:00
Adrien Minne (adrm) feae29c4bb [FIX] spreadsheet: add missing icon for download button
The icon was missing in the download menu item for portal users that access
a shared spreadsheet.

closes odoo/odoo#134457

Task: 3495200
Related: odoo/enterprise#46977
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-09-18 22:16:59 +00:00