Commit Graph
100 Commits
Author SHA1 Message Date
Lucas Lefèvre (lul) 93e28ea102 [FIX] spreadsheet_account: fix no account match
Steps to reproduce:
- create an empty spreadsheet
- type in a cell '=ODOO.BALANCE("qsdfqsf", "02/2024")'
=> #ERROR

There's no account that match the given code.
The account.move.line domain ends up having a clause
`('account_id', 'in', [])`
The ORM detects the domain won't match anything and
early returns an empty list []

Our code expects a query object and not a list => boom

opw-3872445

closes odoo/odoo#163444

X-original-commit: 95de1332196fde7bfa5d178c6c0b7995cd892acb
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-04-26 06:49:58 +00:00
Lucas Lefèvre (lul) 4939846774 [FIX] spreadsheet_account: take correct date period
Steps to reproduce:
- in A1, type '02/2024'
- in A2, type '=ODOO.BALANCE("100", A1)'
=> the result you get come from account lines
for the day 2024/02/1 instead of the full
february month.

The value of A1 is detected as a number (first of february 2024)
When that number is given as the argument of ODOO.BALANCE,
the number falls back as being interpreted as a single day,
instead of a month period.

opw-3872445

closes odoo/odoo#163156

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2024-04-26 06:49:56 +00:00
Lucas Lefèvre (lul) 2a6f0b4252 [FIX] spreadsheet_account: compute value with format
This commit actually refactors the code of the accounting functions
to use `computeValueAndFormat` instead of `compute` which doesn't
receive the arguments format.

The goal is to make the actual fix in the next commit easier
to review/understant with minimal noise.

opw-3872445

Part-of: odoo/odoo#163156
2024-04-26 06:49:56 +00:00
Lucas Lefèvre (lul) 6d2f4222e4 [FIX] spreadsheet_account: take correct date period
Steps to reproduce:
- in A1, type '02/2024'
- in A2, type '=ODOO.BALANCE("100", A1)'
- right click on A2
- click the menu item "See record"
=> you end up with wrong records in the list view

The value of A1 is detected as a number (first of february 2024)
When that number is given as the argument of ODOO.BALANCE,
the number falls back as being interpreted as a single day,
instead of a month period.

opw-3872445

Part-of: odoo/odoo#163156
2024-04-26 06:49:56 +00:00
Lucas Lefèvre (lul) 7351f4241c [FIX] documents_spreadsheet: fix See record menu if not loaded
Steps to reproduce:

- wrap a pivot function inside a IFERROR e.g. =IFERROR(PIVOT("1", "probability"), 42)
- reload the spreadsheet
- before the pivot is loaded (throttle the network in the dev tools): right click the cell
- click on "See records" menu item
=> boom

closes odoo/odoo#162759

Task: 3847477
X-original-commit: aeadd065e869a5cd6b971d6d458ba9d8e1edcc1c
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-04-21 09:42:54 +00:00
Lucas Lefèvre (lul) f5d6a8c4f8 [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/33f09d7c4 [REL] 17.0.17
https://github.com/odoo/o-spreadsheet/commit/1767b3728 [FIX] chart: preserve label order when aggregate
https://github.com/odoo/o-spreadsheet/commit/6c96ded0b [PERF] helpers: faster default cell height Task: 3845472
https://github.com/odoo/o-spreadsheet/commit/b48eb1cf7 [IMP] package: update owl to version 2.2.10
https://github.com/odoo/o-spreadsheet/commit/c2f6da219 [FIX] *: Compute max/min on huge arrays Task: 3802691
https://github.com/odoo/o-spreadsheet/commit/06db89656 [FIX] Charts: format of negative values
https://github.com/odoo/o-spreadsheet/commit/c2eed35cb [FIX] EditionPlugin: data validation duplicate values
https://github.com/odoo/o-spreadsheet/commit/ed7d3fa63 [FIX] BottomBarSheet: Rename a sheet with style content on Firefox Task: 3754944
https://github.com/odoo/o-spreadsheet/commit/33ed353a9 [FIX] bottom_bar: disable sheet drag & drop in readonly Task: 3820888
https://github.com/odoo/o-spreadsheet/commit/261616dfa [FIX] menu: non-aligned menu items Task: 3814222

closes odoo/odoo#160740

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2024-04-05 15:52:06 +00:00
Lucas Lefèvre (lul) 8f0154c47e [FIX] spreadsheet: compute aggregates resulting to zero
When the aggregated value is 0 (9000 + -9000 = 0), it displays an empty cell
in spreadsheet, instead of zero.

closes odoo/odoo#159148

Task: 3827502
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-04-03 05:53:52 +00:00
Lucas Lefèvre (lul) 67f11ff350 [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/9b128f8c [REL] 17.0.16
https://github.com/odoo/o-spreadsheet/commit/389177f9 [FIX] Composer: weird behavior of autocomplete dropdown
https://github.com/odoo/o-spreadsheet/commit/7e7b0692 [FIX] formula assistant: localize argument separator Task: 3789860
https://github.com/odoo/o-spreadsheet/commit/2f96ca07 [FIX] TopBar: Remove hidden functions from the `insert` menu Task: 3810284
https://github.com/odoo/o-spreadsheet/commit/fa60ddf1 [FIX] Composer: force light mode of the formula assitant Task: 3806513
https://github.com/odoo/o-spreadsheet/commit/69ccee4f [FIX] cf_editor: remove broken css rule Task: 3806513
https://github.com/odoo/o-spreadsheet/commit/dd7584ec [FIX] Spreadsheet: split button style to form/color
https://github.com/odoo/o-spreadsheet/commit/fe4ffe1d [FIX] export: export non-Excel formulas as value
https://github.com/odoo/o-spreadsheet/commit/0be37a0d [FIX] FigureComponent: Undo/Redo broken after pasting figure
https://github.com/odoo/o-spreadsheet/commit/d1e41517 [FIX] evaluation: accept 1x1 result array in sub-formula

closes odoo/odoo#159066

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-03-25 13:08:03 +00:00
Lucas Lefèvre (lul) 2d7ed635e5 [FIX] spreadsheet: fetch currency field
Get to a list view where there's a monetary field AND the related currency
field in the same list.
Then insert the list in a spreadsheet.
=> Either the currency format is not fetched or the currency name, depending
on the order in the list.

Bug introduced by 8777973e

opw-3770057

closes odoo/odoo#157623

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-03-14 06:39:31 +00:00
Lucas Lefèvre (lul) 5118f0d7e4 [FIX] spreadsheet_dashboard_purchase_stock: remove hardcoded domain date
Replace the hardcoded date "09-15-2022" in the list domain by
`context_today().strftime(\"%Y-%m-%d\")`

The domain is now stringified since it contains a dynamic value
which is not valid in a json file.

closes odoo/odoo#156550

Task: 3756934
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2024-03-08 21:21:58 +00:00
Lucas Lefèvre (lul) 52c986ed19 [PERF] spreadsheet: avoid useless evaluation
Steps to reproduce:
- create a relational filter, let's say on `res.company`
- add a default value
- reference the filter in a cell with `=ODOO.FILTER.VALUE("my filter")`

=> every `ODOO.FILTER.VALUE` triggers an evaluation

With this commit, the re-evaluation after the data is fetched uses the
data source mechanism which only re-evaluates when all the data promises
are resolved, instead of evaluating after every resolved promise.

With this commit, the number of evaluations required when loading the
Timesheet report on our prod goes from 5 evaluations to only 3 (each evaluation
is 2-3s) because `ODOO.FILTER.VALUE("Company")` is present two times.

One issue this commit doesn't fix: there one RPC per `ODOO.FILTER.VALUE`
(can be fixed in master very easily because we refactored data fetching)

closes odoo/odoo#156495

Task: 3787125
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2024-03-05 18:06:25 +00:00
Lucas Lefèvre (lul) 73892f1d16 [FIX] spreadsheet: export shared non formatted value
Turn your odoo user's language to "French (BE) / Français (BE)".
Now, let's say you have a pivot function returning an amount in the one million
(e.g. 1 230 000). It's formatted to "1.230.000,00"
Reference that cell with `FORMAT.LARGE.NUMBER`. The result is "1.230k"

Now hit the share button and open the share link in an incognito tab.
=> the cell is now "123m"

That's because the string "1.230.000,00" is wrongly parsed to 123000000
(to fix in o-spreadsheet).

Besides that, the formatted value may not necessarily be parsable.
With this commit, we export the raw value, stringified.

opw 3720586

closes odoo/odoo#154712

X-original-commit: 7f8d705b216b392ce1249793a0b44dcec0ac536c
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-02-21 12:59:07 +00:00
Lucas Lefèvre (lul) 8777973edd [PERF] spreadsheet: use web_search_read to load list currency
With this commit, list data is loaded using `web_search_read`
instead of `search_read`.

The goal is to fetch the currency (symbol, decimal places, etc.) of monetary
fields in a single request, instead of 2 RPCs.

Pros:
- less code
- one evaluation saved
- one network request saved
- easier future refactoring (see below)

Cons:
- overhead of data transferred over network (from 4.5MB to 6.5MB, unzipped
  and from 711kB to 725kB gzipped to fetch a list of 20K crm leads).

Before this commit, here is what it looked like:

1. the list data is fetch (with the currency_field)
2. the cells are evaluated with the new data
3. we realize we want to format a currency amount. We already have the
   currency name but not the symbol, etc. So we fetch the currency data
4. evaluate the cells again with the new currency format

Now:
1. fetch the list data with everything we need for the currency
2. evaluate the cells

This commit also serves another goal for a future refactoring: in the hope
of avoiding throwing "loading errors", I'd like to have an easy way to know
if a data source is fully loaded or not (the data and the format).
With this commit, everything is centralized in the list data source with
a single RPC. The goal is therefore achieved with this commit.

closes odoo/odoo#153434

Task: 3730232
Related: odoo/enterprise#56253
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-02-20 18:22:03 +00:00
Lucas Lefèvre (lul) e3eca2a81d [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/8fa2bab99 [REL] 17.0.12
https://github.com/odoo/o-spreadsheet/commit/a975183c3 [IMP] cell: avoid useless UPDATE_CELL Task: 3716689
https://github.com/odoo/o-spreadsheet/commit/cce8d745f [FIX] cell_menu_registry: link cell displays 'Edit Link' in context menu
https://github.com/odoo/o-spreadsheet/commit/21316fa3f [PERF] export: reduce memory allocation Task: 3741429
https://github.com/odoo/o-spreadsheet/commit/22fea36f8 [PERF] model: reuse success dispatch result Task: 3741429
https://github.com/odoo/o-spreadsheet/commit/7e34a82ed [PERF] export: reduce deepEqual memory allocation Task: 3741429
https://github.com/odoo/o-spreadsheet/commit/bc1abee79 [PERF] export: reduce memory allocation Task: 3741429
https://github.com/odoo/o-spreadsheet/commit/647561217 [REF] borders: use helper to export Task: 3741429
https://github.com/odoo/o-spreadsheet/commit/f394133af [FIX] import: detect date format at import Task: 3729969
https://github.com/odoo/o-spreadsheet/commit/4ccfb11f1 [FIX] locale: accept thousands separator Task: 3720586
https://github.com/odoo/o-spreadsheet/commit/01d66c89f [FIX] locale: prevent identical decimal and thousands separator Task: 3720586
https://github.com/odoo/o-spreadsheet/commit/5aaa4cabb [FIX] performance: JetSet
https://github.com/odoo/o-spreadsheet/commit/377ac6f42 [FIX] performance: rtree comparer
https://github.com/odoo/o-spreadsheet/commit/fadc9a5d5 [FIX] composer: fix autocomplete shadow
https://github.com/odoo/o-spreadsheet/commit/e5571a91b [FIX] composer: limit autocomplete height Task: 3675171
https://github.com/odoo/o-spreadsheet/commit/2dc4c8b7b [FIX] Selection: Loop selection based on spreaded formula Task: 3709340

closes odoo/odoo#154430

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2024-02-17 00:26:03 +00:00
Lucas Lefèvre (lul) 49af4d6d9a [PERF] spreadsheet_dashboard: avoid currency RPC
Most (if not all) dashboards have monetary amounts. They are formatted
with the main company currency format.
Before this commit, a RPC was made to fetch the company currency.
With this commit, the dashboard is loaded with the currency.

It saves one network request and a full spreadsheet evaluation (which would
have occured after the request is done)

closes odoo/odoo#151725

Task: 3709466
Related: odoo/enterprise#55415
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-02-12 20:24:01 +00:00
Lucas Lefèvre (lul) fc032efc2d [PERF] spreadsheet: avoid company currency rpc
Pivot/list monetary fields needs the company currency to display
the value in the said currency format.
Until now, a RPC was made to fetch the currency.
However, since odoo/o-spreadsheet@8710839 and odoo/enterprise@8c0a785
the currency format is already in the model config.
There's no need for the RPC.

This saves one network request and one full spreadsheet evaluation (which
would have occured after the request is done)

Note: see next commit for dashboards.
Part-of: odoo/odoo#151725
2024-02-12 20:24:01 +00:00
Lucas Lefèvre (lul) 2b07d5f54b [FIX] spreadsheet: get ODOO.FILTER.VALUE with from/to filter
- create a from/to date filter with let's say "my filter"
  as its title.
- in the spreadsheet, `=ODOO.FILTER.VALUE("my filter")`
=> the function doesn't return anything

closes odoo/odoo#146213

Task: 3584650
Related: odoo/enterprise#52871
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-02-12 20:23:58 +00:00
Lucas Lefèvre (lul) 931fc29227 [REF] spreadsheet: factorize sheet filter export
The implementation to generate a sheet with the active filters
is (almost) duplicated for the Excel export and the sharing.

The next commit makes it more complex and in the goal of avoiding
to duplicate the changes, this commit factorizes the implementation

Task: 3584650
Part-of: odoo/odoo#146213
2024-02-12 20:23:58 +00:00
Lucas Lefèvre (lul) da043e9635 [FIX] spreadsheet: un-escape filter name
Steps to reproduce:

- insert a global filter with double quotes in its name (e.g. my "special"
  filter)
- reference that filter with ODOO.FILTER.VALUE (remember you have to escape
  the " in the formula with a backslash \
  =ODOO.FILTER.VALUE("my \"special\" filter")
=> the filter is not found

closes odoo/odoo#153337

Task: 3697855
X-original-commit: 83826d3546ff584c5ff22021370f572787d032bc
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-02-09 17:13:05 +00:00
Lucas Lefèvre (lul) 67521df040 [FIX] spreadsheet_dashboard: handle missing dashboard
How to reproduce
1. Log in as Mitchel and go to a Subscription dashboard
2. Copy the URL and paste in incognito
3. Log in as Marc (which does have access to the subscription dashboard)

--> Traceback

closes odoo/odoo#153143

Task: 3581647
X-original-commit: 1c4b6b0a491d63d1f1b6c7a21089a42d4bfd64ab
Related: odoo/enterprise#56107
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-02-08 15:07:57 +00:00
Lucas Lefèvre (lul) 7e6a02ac0f [FIX] spreadsheet: keep leading zeros of char fields
When a char field contains a value which represents a number (e.g. "00036"),
the value is inserted as a number in the formula instead of a string.
Because of this, the function value is not found.

actual:	​	=ODOO.PIVOT.HEADER(1,"x_studio_barcode",00003456799)
expected: 	​=ODOO.PIVOT.HEADER(1,"x_studio_barcode","00003456799")

closes odoo/odoo#152018

Opw: 3623662
Task: 3631998
X-original-commit: 9fedd9a5c3daacb71862864ede466d25420749bb
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-02-01 07:06:51 +00:00
Lucas Lefèvre (lul) 215b61f6b6 [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/3c1209a38 [REL] 17.0.9
https://github.com/odoo/o-spreadsheet/commit/fa95e4614 [FIX] BottomBarSheet: renaming a sheet with styled content
https://github.com/odoo/o-spreadsheet/commit/8df011627 [FIX] evaluation: behavior for invalid range arguments
https://github.com/odoo/o-spreadsheet/commit/190fd0457 [FIX] SelectionInput: Allow commands that target non focused input Task: 3689504
https://github.com/odoo/o-spreadsheet/commit/aaaf7fea0 [FIX] Edition: filter invalid references from edition highlights Task: 3378775
https://github.com/odoo/o-spreadsheet/commit/cbc3b91a0 [FIX] Composer: double click on composer gives traceback
https://github.com/odoo/o-spreadsheet/commit/6306302ae [FIX] demo: wrong App.mount arguments
https://github.com/odoo/o-spreadsheet/commit/13a3fd3c6 [FIX] icon: broken path for HIDE_COL icon
https://github.com/odoo/o-spreadsheet/commit/b2abf2362 [FIX] format: fix chaining of FORMAT.LARGE.NUMBER Task: 3633947
https://github.com/odoo/o-spreadsheet/commit/eb1492393 [IMP] github: add templates

closes odoo/odoo#151622

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-01-30 12:19:58 +00:00
Lucas Lefèvre (lul) 64e475dc7b [FIX] spreadsheet: improve perf by avoiding useless evaluation
In a spreadsheet with multiple data sources (2 pivots), each data source
initially loads and triggers a new evaluation upon loading.
This results in two evaluations, even if both data sources resolve in less
than 10ms apart. In such cases, the first re-evaluation becomes redundant,
as a new one is immediately triggered.

The issue is worse when more than 6 RPCs are required, as most browsers limit
network calls to 6 in parallel. Consequently, the 7th RPC will unnecessarily
wait after the evaluation triggered by the first RPC to resolve.

For spreadsheets with many many data sources, the accumulation of these
pointless evaluations significantly impacts performance.
In a real-life scenario with 18 data sources from our production database,
the spreadsheet took approximately ~33s to fully load and become reactive.
With this commit, the loading time is reduced to ~7s (only one evaluation
instead of 18) (tested in 17.0).

Note that this testing was conducted locally, with minimal latency, and with
a limited amount of data.

One consequence of this commit is that cells won't load incrementally as
each data source loads. Instead, all cells will display "Loading..." until
all data sources are loaded. Given the substantial speed improvement, we
consider this trade-off worthwhile.

This fix only impacts loadable datasources (pivot, lists, graphs),
it could also include data sources using individual RPCs (currency,
accounting). Maybe for master.

closes odoo/odoo#150015

X-original-commit: 70877d29cc2368298f8716f64c248a86ed0416ce
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-01-26 07:48:50 +00:00
Lucas Lefèvre (lul) aae6b72823 [IMP] spreadsheet: allow to sort month pivot headers
Currently, if you have a pivot grouped by a date field, aggregated by week
month or quarter, sorting all the pivot cells does not work as expected
when sorting based on the date header column.
"April 2023" would end up being before "March 2020" just because "A" is
before "M". Similarly, "W1 2023" is before "W2 2020" and "Q1 2023" is before
"Q2 2020"

With this commit, for months aggregates, the result of
`=ODOO.PIVOT.HEADER(1,"create_date:month","04/2023")` is currently the
string "April 2023".
The result now becomes a real date just like any other date value
in a spreadsheet. It's the number corresponding to the first day of the
month.

For week and quarter aggregates, we could move the year first ("W1 2023"
becomes "2023 W1"). However, we decided not to do it to keep consistency:
- with other places in odoo (pivot views)
- with the way we talk/think (quarter/week comes first)

closes odoo/odoo#139295

Task: 3570281
Related: odoo/enterprise#49300
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2024-01-23 22:51:48 +00:00
Lucas Lefèvre (lul) 06920e4176 [REM] spreadsheet: remove unused method
Task: 3570281
Part-of: odoo/odoo#139295
2024-01-23 22:51:48 +00:00
Lucas Lefèvre (lul) 943a2fb021 [FIX] spreadsheet: format pivot days header
This commit fixes 2 very similar issue.
See enterprise commit.

- Group a pivot by any date field, with the day aggregate
- insert it in spreadsheet
- autofill a pivot function
=> the autofill tooltip displays the day number instead
   of the day formatted as a date.

- on the same pivot
- click on menu "Data > Insert pivot > insert pivot cell > [you pivot]"
=> in the dialog, numbers appears for the headers.

Task: 3570281
Part-of: odoo/odoo#139295
2024-01-23 22:51:48 +00:00
Lucas Lefèvre (lul) e55dad2d30 [REF] spreadsheet: factorize pivot value format
This commit factorizes how the format is computed for ODOO.PIVOT and
ODOO.PIVOT.HEADER functions. It was essentially duplicated.

Also move the date(time) format responsibilty to each time adapters,
instead of handling the different aggregate cases separatly.

This commit also prepares the next commit which fixes a formatting bug.

Task: 3570281
Part-of: odoo/odoo#139295
2024-01-23 22:51:48 +00:00
Lucas Lefèvre (lul) 33b910fcfd [REF] spreadsheet: colocate special args in one place
For the ODOO.PIVOT.HEADER functions, "special" values such as measure and
total were managed in different places (total management  was also duplicated
 see enterprise commit).

Now the measure and total are managed in one place, in the high level method.
There's also now a dedicated method to get a measure display name. The method
`getGroupByDisplayLabel` was perverted at that purpose (see enterprise commit)

Task: 3570281
Part-of: odoo/odoo#139295
2024-01-23 22:51:48 +00:00
Lucas Lefèvre (lul) fbfc5b2d5d [REF] spreadsheet: clean method names
Method names in the pivot data source/model are not particularly clear
and self-explanatory.

To commit renames some methods (and their argument names) with hopefully
more meaningful names.

I'm also moving `getDisplayedPivotHeaderValue` (now
`computeOdooPivotHeaderValue`) from the model to the data source. It's
a high level function, the implementation can be in the data source.

Task: 3570281
Part-of: odoo/odoo#139295
2024-01-23 22:51:48 +00:00
Lucas Lefèvre (lul) 4f600ea6aa [FIX] spreadsheet: remove log
closes odoo/odoo#149884

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2024-01-18 10:28:47 +00:00
Lucas Lefèvre (lul) dd6e6bd384 [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/0f2d46e7a [REL] 17.0.8
https://github.com/odoo/o-spreadsheet/commit/518469ade [FIX] range: Support ranges with no `Rangeparts` Task: 3608941
https://github.com/odoo/o-spreadsheet/commit/676c3fb43 [FIX] config: remove latest tag
https://github.com/odoo/o-spreadsheet/commit/a0cb69a93 [FIX] Cell: Fix detection of markdown links Task: 3628780
https://github.com/odoo/o-spreadsheet/commit/82d2e774e [FIX] Datavalidation: fix checkbox style Task: 3650740

closes odoo/odoo#149726

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2024-01-18 09:04:47 +00:00
Lucas Lefèvre (lul) beaf1af8c5 [FIX] spreadsheet: avoid useless rpc
- define a relational global filter without any default value.
- reference that filter with `ODOO.FILTER.VALUE`
=> when loading the spreadsheet, a `read` RPC is triggered
with an empty list of ids.

This is:
- useless network call
- useless evaluation when the RPC resolves

closes odoo/odoo#149741

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2024-01-17 18:12:46 +00:00
Lucas Lefèvre (lul) 90ccffcc7d [FIX] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/cadb8174b [REL] 17.0.7
https://github.com/odoo/o-spreadsheet/commit/548c779ba [FIX] dates: use UTC to represent naive date times Task: 3666703
https://github.com/odoo/o-spreadsheet/commit/49f05a71c [REF] dates: introduce DateTime to wrap Date object Task: 3666703
https://github.com/odoo/o-spreadsheet/commit/9676b76b7 [FIX] date: properly type reference dates Task: 3666703
https://github.com/odoo/o-spreadsheet/commit/653a0900f [FIX] tests: enables type checking for binded functions
https://github.com/odoo/o-spreadsheet/commit/61780b4e4 [FIX] functions: name MID args

closes odoo/odoo#149240

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2024-01-16 08:23:11 +00:00
Lucas Lefèvre (lul) 0111317b75 [FIX] spreadsheet: accumulate starting with past data
- Inserting a cumulated graph view inside spreadsheet
  (e.g. cumulated subscription MRR breakdown),
- apply a global filter to filter, let's say on the current
  month
=> the first data point does not include data from before
the current month (the accumulation starts at 0, even though
there is data before)

You can also check the MRR evolution subscription dashboard,
"MRR over time" chart.

Note: with this fix, we assume all "cumulated" charts are also
"cumulated_start". Which is true in practice (only one cumulated
graph view in the entire codebase)

closes odoo/odoo#149084

Task: 3680601
Related: odoo/enterprise#54146
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-01-12 14:27:47 +00:00
Lucas Lefèvre (lul) 8a459f1859 [FIX] web: support False for selection in domain selector
The original issue (in saas-16.4) has been fixed in 17.0
by refactorings.

This commit only fw-ports the test

Steps to reproduce:
- Open the Subscription app
- click on the list cog wheel
- Spreadsheet > Insert list in spreadsheet
- Select the blank spreadsheet and insert the list
- right click any cell with a list function
- click on "See list properties"
=> boom `undefined is not iterable (cannot read property Symbol(Symbol.iterator))`

The list domain has the shape `["subscription_state", "not in", ["2_renewal", "5_renewed", false]]`
`false` makes the domain selector crash.

opw 3670344

closes odoo/odoo#148727

X-original-commit: cfdc9c6d62050e3aac4bf18f374e4772ce18a504
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-01-10 10:28:16 +00:00
Lucas Lefèvre (lul) 2fd6499c49 [FIX] spreadsheet: translate odoo links
Change your language and open any dashboard.
The table titles (e.g. "Top countries" of the Leads dashboard) are not
translated.

It was lost in commit odoo/o-spreadsheet@9616681
With this commit not all link labels are translated. Only odoo links.
I don't think other (regular) links should be translated.

closes odoo/odoo#146574

X-original-commit: a2e406db138d51e710caf61a2809cfa991ea6cb3
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-12-16 11:15:08 +00:00
Lucas Lefèvre (lul) 2b46bf26be [FIX] spreadsheet_dashboard: copy dashboard
This commit is the communitiy counter-part to allow copying a dashboard.

Yet another 'copy' overrride to add the same postfix!

closes odoo/odoo#144091

Task: 3588237
X-original-commit: b39f63b1509e6dc2149b1a09da5a877d45e36be3
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-11-30 11:44:59 +00:00
Lucas Lefèvre (lul) d27d9a4757 [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/7346d0af9 [REL] 17.0.4
https://github.com/odoo/o-spreadsheet/commit/661e290f4 [FIX] sheet: remove zombie code
https://github.com/odoo/o-spreadsheet/commit/7362fc105 [FIX] sheet: remove rows faster
https://github.com/odoo/o-spreadsheet/commit/dcaa1ab0c [FIX] tokenizer: faster current char lookup
https://github.com/odoo/o-spreadsheet/commit/0448b26f5 [FIX] tokenize: replace special chars faster
https://github.com/odoo/o-spreadsheet/commit/88a57c6be [FIX] icons: use correct comment syntax in xml files
https://github.com/odoo/o-spreadsheet/commit/cf8194df2 [FIX] clipboard: fix array formula copy
https://github.com/odoo/o-spreadsheet/commit/ca24d7e8c [FIX] evaluation: faster range matrix
https://github.com/odoo/o-spreadsheet/commit/a13ff80b3 [FIX] clipboard: traceback on paste from copy after deleting that sheet
https://github.com/odoo/o-spreadsheet/commit/eaa0dca12 [FIX] evaluation: cache range references values Task: 3588401
https://github.com/odoo/o-spreadsheet/commit/cdeb716c3 [REF] evaluation: group compilation parameters
https://github.com/odoo/o-spreadsheet/commit/943a7e7f8 [FIX] lookup: cache string normalization Task: 3588401
https://github.com/odoo/o-spreadsheet/commit/0330db03c [FIX] cells,borders: cancel useless commands Task: 3603259
https://github.com/odoo/o-spreadsheet/commit/38d77fe89 [FIX] cells: faster getter to get cell Task: 3588401
https://github.com/odoo/o-spreadsheet/commit/15bdafc80 [FIX] model: don't flatten command result

closes odoo/odoo#143587

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2023-11-25 05:41:44 +00:00
Lucas Lefèvre (lul) 63b1f4adcf [FIX] spreadsheet_dashboard: allow to change group
There's currently no way to move a dashboard from a section to another
You have to start again from a blank dashboard in the other group.

closes odoo/odoo#143505

Task: 3592986
X-original-commit: f7ba25afd5f1332b21a3d1631020ad9cd4b116fc
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-11-24 23:57:35 +00:00
Lucas Lefèvre (lul)andAdrien Minne 037e5b823b [FIX] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/8bd0fb2b4 [REL] 17.0.3
https://github.com/odoo/o-spreadsheet/commit/fe3ba2a88 [FIX] text_helper: strikethrough wrong positioning
https://github.com/odoo/o-spreadsheet/commit/742581e80 [IMP] demo: add demo data for data validation
https://github.com/odoo/o-spreadsheet/commit/0323dd37a [FIX] FiltersPlugin: removing row with data filter header Task: 3546012
https://github.com/odoo/o-spreadsheet/commit/fc2a17482 [FIX] FilterEvaluationPlugin: insert/remove rows on data filter header Task: 3546012
https://github.com/odoo/o-spreadsheet/commit/3c3bbe9a2 [MOV] tests: fix typo in test file name of context menu
https://github.com/odoo/o-spreadsheet/commit/c53528f7c [FIX] F&R: Fix css rule
https://github.com/odoo/o-spreadsheet/commit/b6fa9634f [FIX] Menus: Show Insert col/row menu when full sheet selected Task: 3450188
https://github.com/odoo/o-spreadsheet/commit/80bd3b30f [REV] Charts: Do not rely on history for the chartRuntimes Task: 3578417
https://github.com/odoo/o-spreadsheet/commit/3d6f4f954 [IMP] evaluation: improve perfs of `getCorrespondingFormulaCell` Task: 3584306
https://github.com/odoo/o-spreadsheet/commit/17ba12211 [FIX] cell: update cell tokens and dependencies Task: 3584306
https://github.com/odoo/o-spreadsheet/commit/c0cb4cf86 [FIX] find_and_replace: take array formula result into account Task: 3413999

[IMP] spreadsheet: remove useless tokenize calls

The pivot/list helpers were tokenizing the cell's content when trying
to find list/pivot formulas. But we can skip the tokenize call as we
already have the tokens in the cell's compiledFormula.

closes odoo/odoo#142323

Task: 3584306
Related: odoo/enterprise#50888
Signed-off-by: Adrien Minne (adrm) <adrm@odoo.com>
Co-authored-by: Adrien Minne <adrm@odoo.com>
2023-11-19 23:55:11 +00:00
Lucas Lefèvre (lul) c503d1895d [FIX] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/3184728ea [REL] 17.0.2
https://github.com/odoo/o-spreadsheet/commit/74e28e1c9 [FIX] evaluation: fix incorrect invalidation

closes odoo/odoo#140935

Signed-off-by: Adrien Minne (adrm) <adrm@odoo.com>
2023-11-04 06:43:11 +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
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
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
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
Lucas Lefèvre (lul) 838ee8d18d [FIX] spreadsheet_dashboard_*: set explicit en_US locale
The en_US default locale in o-spreadsheet is m/d/yyyy but it's mm/dd/yyyy in odoo.
Because of this mismatch, spreadsheets from the source code of odoo (dashboards,
templates) will have a small warning saying the spreadsheet locale and the user
locale mismatch.
That's because existing spreadsheet don't have any locale and the default one is
used.

This commit adds the locale to all o-spreadsheet json files.

Notes:
- we could have completely upgrade the json file format to the latest
  o-spreadsheet version (version: 14), but just adding the settings is enough

closes odoo/odoo#139133

X-original-commit: 76f77f0bca6852846079f1fe0de6080554f96ac2
Related: odoo/enterprise#49148
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-19 10:45:53 +00:00
Lucas Lefèvre (lul) 1a42011171 [FIX] spreadsheet_account: trim account codes
`=ODOO.BALANCE("100,200", "2022")` works but
`=ODOO.BALANCE("100, 200", "2022")` does not work (notice the extra space).

With this commit, the account codes are trimmed.

closes odoo/odoo#138850

X-original-commit: 7fd3fd60cc7cd207626f49ba1cf40232ced9d4ff
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-17 03:27:54 +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
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
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
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) f43f0c407c [REF] spreadsheet_dashboard: use web_search_read to load dashboards
Previously, the dashboard action needed two RPC calls to be ready:
1. load the dashboard groups (with the dashboards ids in the groups)
2. load the dashboard display names

Now, with the new `web_sear_read` we can load both at the same time,
saving one http request.

closes odoo/odoo#134984

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2023-09-25 15:20:16 +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
Lucas Lefèvre (lul) 65962d09c3 [FIX] spreadsheet_edition: autofill references in pivot functions
See enterprise PR

closes odoo/odoo#135024

Task: 3458637
X-original-commit: 8bfc188ca4fb9cd8d1e351c0e6d4adbf195405fb
Related: odoo/enterprise#47224
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-09-18 10:14:05 +00:00
Lucas Lefèvre (lul) 945b96378f [IMP] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/5dfa942c [REL] 16.5.0-alpha.7
https://github.com/odoo/o-spreadsheet/commit/1bf08cca [REM] selection: removed `types/selection.ts` file Task: 3272931
https://github.com/odoo/o-spreadsheet/commit/e7d85184 [IMP] spreadsheet: add header grouping feature Task: 3272931
https://github.com/odoo/o-spreadsheet/commit/a498b5a6 [FIX] sheet: fix add/remove headers allowDispatch Task: 3272931
https://github.com/odoo/o-spreadsheet/commit/decbd467 [FIX] grid: keyboard context menu position Task: 3272931
https://github.com/odoo/o-spreadsheet/commit/be351a83 [REF] ot: simplify grid-dependant command transform Task: 3272931
https://github.com/odoo/o-spreadsheet/commit/e4a64149 [IMP] remove duplicate: add the remove duplicate functionality Task: 2984935
https://github.com/odoo/o-spreadsheet/commit/20600cda [IMP] commands: modify enum of CommandResult
https://github.com/odoo/o-spreadsheet/commit/4b1be76c [IMP] LineChart: cumulative chart
https://github.com/odoo/o-spreadsheet/commit/513ffcaf [FIX] SheetPlugin: Prevent deletion of all non-frozen headers Task: 3414127
https://github.com/odoo/o-spreadsheet/commit/cc408d7b [FIX] find_and_replace: remove useless tab index Task: /
https://github.com/odoo/o-spreadsheet/commit/34d34a19 [IMP] chart: use locale in chart labels/tooltips

closes odoo/odoo#135184

Related: odoo/enterprise#47343
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-09-13 12:19:08 +00:00
Lucas Lefèvre (lul) 97d8f1d660 [FIX] spreadsheet: remove debug log
closes odoo/odoo#133514

X-original-commit: 51dbb52343ed0c0aa388c331cba43db4b9991356
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-08-29 15:47:46 +00:00
Lucas Lefèvre (lul) 9849161a7d [FIX] spreadsheet: force light theme on top bar
o-spreadsheet code isn't prepared to handle dark theme. At all.
There are hardcoded colors everywhere.

Until we have a proper way to handle dark theme (use overridable scss
variables, rely on bootstrap), we force light theme for all elements
inside o-spreadsheet.

The white background on the top bar was removed by commit
odoo/o-spreadsheet@4d93a99

Other changes probably from the new milk design

opw-3461191

closes odoo/odoo#132909

X-original-commit: aaa9ea5c6584a8f830d8313d2f26670bf5b34cef
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-08-23 22:22:54 +02:00
Lucas Lefèvre e7128d68ee [REF] spreadsheet: use helper to create currency format
closes odoo/odoo#126933

Task: 3458811
Related: odoo/enterprise#43425
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-08-22 18:58:15 +02:00
Lucas Lefèvre (lul) a27556a781 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/e0cb3aae [REL] 16.5.0-alpha.5
https://github.com/odoo/o-spreadsheet/commit/dd9b007f [FIX] translation: fix sprintf() for String objects
https://github.com/odoo/o-spreadsheet/commit/ad81d88e [REM] translation: remove _t from env Task: 3292454
https://github.com/odoo/o-spreadsheet/commit/61dd916a [FIX] chart panel: wrongly aligned ColorPicker Task: 3380585
https://github.com/odoo/o-spreadsheet/commit/08afd52c [IMP] side-panels: use `o-checkbox` for all checkboxes Task: 3380585
https://github.com/odoo/o-spreadsheet/commit/ff80be44 [FIX] worksheet: download issue with sheets containing array formulas
https://github.com/odoo/o-spreadsheet/commit/5d5fd2f2 [FIX] scorecard: measure text with bold/italic style Task: 3380613
https://github.com/odoo/o-spreadsheet/commit/c746b1c5 [REF] filters: rename 'values' in command
https://github.com/odoo/o-spreadsheet/commit/6d03710b [REF] formulas: replace Array.isArray by isMatrix
https://github.com/odoo/o-spreadsheet/commit/97a54980 [REF] formulas: simplify typing
https://github.com/odoo/o-spreadsheet/commit/589e11e3 [IMP] formulas: compute format
https://github.com/odoo/o-spreadsheet/commit/7dcd570a [REF] formulas: refactor helpers
https://github.com/odoo/o-spreadsheet/commit/ff1b96ff [REF] formulas: improve typing
https://github.com/odoo/o-spreadsheet/commit/29905892 [REF] formulas: clean matrix helpers
https://github.com/odoo/o-spreadsheet/commit/980b6a60 [IMP] formulas: Accept null values in the formula return
https://github.com/odoo/o-spreadsheet/commit/36f155d9 [IMP] formulas: compute value and format at the same time
https://github.com/odoo/o-spreadsheet/commit/92961ac5 [REF] formulas: improve typing
https://github.com/odoo/o-spreadsheet/commit/e60f4da9 [IMP] prettier: update version
https://github.com/odoo/o-spreadsheet/commit/cbd6ceee [FIX] Composer: formula autocomplete navigation with arrow keys Task: 3461828
https://github.com/odoo/o-spreadsheet/commit/09dd17fa [REF] *: Remove env._t

closes odoo/odoo#132183

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-08-17 18:43:23 +02:00
Lucas Lefèvre (lul) 2088384de6 [FIX] spreadsheet_edition: ignore property fields
See enterprise PR ;)

Property fields are not supported in spreadsheet.
In saas-16.2, it even completely ruins the entire list
if it contains one property field.

With this commit, until we support properly property fields[1],
we ignores property field when the list view is inserted
in spreadsheet

[1] in master, see task 3329490

opw-3284273
opw-3465243

closes odoo/odoo#132138

Task: 3329490
X-original-commit: ada541d6c4a8d0a5b515c4f1f7e9d71c54b992d5
Related: odoo/enterprise#45844
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-08-17 09:21:11 +02:00
Lucas Lefèvre (lul) 63480e6895 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/c8db0189 [REL] 16.5.0-alpha.4
https://github.com/odoo/o-spreadsheet/commit/405da6dc [IMP] packages: update chart.js to 4.3 Task: 3412671
https://github.com/odoo/o-spreadsheet/commit/830a144f [FIX] xlsx: use FormatAttributes to export filters Task: 3460544
https://github.com/odoo/o-spreadsheet/commit/63ef23ea [FIX] tests: avoid memory leak

Part-of: odoo/odoo#127259
2023-08-16 12:47:33 +02:00
Lucas Lefèvre (lul) 8ce5ae5d38 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/b0e8fd51 [REL] 16.5.0-alpha.3
https://github.com/odoo/o-spreadsheet/commit/4807e54e [IMP] Formulas: Add of INDEX formula Task: 2871406
https://github.com/odoo/o-spreadsheet/commit/3a5968f7 [FIX] Composer: formula assistant not updating with arrow keys Task: 3436604
https://github.com/odoo/o-spreadsheet/commit/ee4fffb1 [FIX] FilterEvaluationPlugin:  enable filtered rows when unhiding rows Task: 3435119
https://github.com/odoo/o-spreadsheet/commit/42bb09fa [IMP] notify: change behavior
https://github.com/odoo/o-spreadsheet/commit/292d20b8 [IMP] Translation: remove _lt function
https://github.com/odoo/o-spreadsheet/commit/e74f3efd [REL] 16.5.0-alpha.2
https://github.com/odoo/o-spreadsheet/commit/1ae3f21e [IMP] model: don't dispatch local commands to core plugins Task: 3184514
https://github.com/odoo/o-spreadsheet/commit/f7a7face [IMP] SelectionInput: Add move/resize highlight support Task: 3377781
https://github.com/odoo/o-spreadsheet/commit/e15c1a44 [REF] SelectionInputPlugin: Simplify plugin Task: 3377781
https://github.com/odoo/o-spreadsheet/commit/2976cf57 [IMP] Highlights: Use SelectionStreamProcessor Task: 3377781
https://github.com/odoo/o-spreadsheet/commit/3d94d6a7 [IMP] tests: add utility to add test plugins
https://github.com/odoo/o-spreadsheet/commit/436fbddc [REF] plugins: simplify plugin generics
https://github.com/odoo/o-spreadsheet/commit/6c2e49ef [FIX] HeaderSizePlugin: Prevent state desynchronization Task: 3450174
https://github.com/odoo/o-spreadsheet/commit/1280961e [FIX] GridOverlay: popovers not closing
https://github.com/odoo/o-spreadsheet/commit/013c9db3 [IMP] index: Make `addFunction` chainable
https://github.com/odoo/o-spreadsheet/commit/01d4159f [FIX] index: addFunction was badly typed
https://github.com/odoo/o-spreadsheet/commit/3682b63b [FIX] find_and_replace: hiding and unhiding rows/cols refresh search
https://github.com/odoo/o-spreadsheet/commit/cc628fa2 [IMP] conditionnal_formatting: use formula as value
https://github.com/odoo/o-spreadsheet/commit/bde0fcd1 [FIX] find_and_replace: wrong active cell on replaceAll
https://github.com/odoo/o-spreadsheet/commit/7e52d73f [FIX] TopBar: fix focus lost in grid
https://github.com/odoo/o-spreadsheet/commit/7fae6c32 [FIX] FiguresContainer: Restrict resizing if reaches header boundary Task: 3414127

closes odoo/odoo#131407

Related: odoo/enterprise#45558
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-08-10 09:11:59 +02:00
Lucas Lefèvre (lul) 5318e947bd [IMP] spreadsheet: interpret more months reprensentation
This commit improves the way months are recognized in pivot functions.
It also removes the use of `moment.js` which will be removed in the future
(see task 3391739)

Currently, months in a pivot function must follow a very specific
format.
It must be mm/yyyy

`ODOO.PIVOT(1, "amount", "date:month", "01/2020")`

Among other things: "1/2020" does not work, it must be prefixed by a
leading zeros.

Now, any date-like value would work:

month: "1/2020"
first of the month: "1/1/2020"
any day in the month: "1/2/2020"
using the DATE function: DATE(2020, 12, 1)
using NOW()

Future work: `PIVOT.HEADER` should return a the date as a number
when the date is a month. But it's currenctly quite a mess.
because we use the same method for a million things (`getGroupByDisplayLabel`).

Task 3413243

closes odoo/odoo#129782

Related: odoo/enterprise#44684
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-08-07 10:58:29 +02:00
Lucas Lefèvre (lul) 6ea05e844a [IMP] web: evaluate domain with user context
Currently, the domain editor dialog doesn't handle domains like
[('foo', '=', uid)] if you don't provide the (user) context in the
component props.

Since this kind of domain is expected to work everywhere, the component
now uses the user context by default to evaluate the domain.
There's no need to provide the context everytime the component is used.

closes odoo/odoo#127565

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-06 17:52:43 +02:00
Lucas Lefèvre (lul) b0fdb2b429 [REF] web: factorize makeDialogTestEnv helper
With this commit, the many identical implementation of
`makeDialogTestEnv` are removed in favor of a single
helper function.

Part-of: odoo/odoo#127565
2023-07-06 17:52:43 +02:00
Lucas Lefèvre (lul) 82ec77def7 [FIX] web: display contextual values in readonly domain
The domain component in readonly mode doesn't display dynamic/contextual
values.
For a domain `[('foo', '=', uid)]` the component displays "foo =" instead
of "foo = uid"

Part-of: odoo/odoo#127565
2023-07-06 17:52:42 +02:00
Lucas Lefèvre 1a71f8cff7 [REF] spreadsheet: remove useless match attribute
`isMatched` is always true, so it have little/no purpose and we can
remove this attribute.

closes odoo/odoo#127279

Signed-off-by: Adrien Minne (adrm) <adrm@odoo.com>
2023-07-05 17:34:10 +02:00
Lucas Lefèvre dffaf2b78f [REF] spreadsheet: find odoo functions with iterator helper
Part-of: odoo/odoo#127279
2023-07-05 17:34:10 +02:00
Lucas Lefèvre 647c6663f9 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/b04cf78c2 [REL] 16.4.0-alpha.7
https://github.com/odoo/o-spreadsheet/commit/37e6ebed5 [IMP] helpers: add ast iteration helper Task: 3360232
https://github.com/odoo/o-spreadsheet/commit/c44431ffa [IMP] TopBarComposer: allow selection in readonly mode Task: 3378521
https://github.com/odoo/o-spreadsheet/commit/44063ddaf [ADD] functions: add TRUE and FALSE boolean functions Task: 3360232
https://github.com/odoo/o-spreadsheet/commit/62a93f842 [REF] tokenizer: decouple tokenizer from functions Task: 3360232
https://github.com/odoo/o-spreadsheet/commit/153a50d23 [IMP] xlsx: import images

Part-of: odoo/odoo#127279
2023-07-05 17:34:09 +02:00
Lucas Lefèvre (lul) 1f704ecdb1 [IMP] spreadsheet: add Odoo function category
This commit adds an "Odoo" functions category in the top bar menu
"Insert > Function".

It allows to easily discover existing functions.

closes odoo/odoo#127372

Signed-off-by: Alexis Lacroix (laa) <laa@odoo.com>
2023-07-05 13:09:48 +02:00
Lucas Lefèvre e136b43e9b [FIX] spreadsheet: use localized week start
Steps to reproduce:
Go to CRM pivot view, group create_date by week, insert into spreadsheet.
=> week numbers are offset by one (W23 instead of W24)

Since 3a177c448, `read_group` returns week aggregates according to the
user's language first day (e.g Sunday for en_US, Monday for fr_FR).

Before the commit, it was always Monday (ISO week start).
This commit changes the moment formats from "W" (Week of Year (ISO)) to
"w" which is the localized week of year*.

Note there can still be some inconsistencies if the browser language is
different than the user's language. This hasn't changed and is a regular
known issue.

* https://momentjscom.readthedocs.io/en/latest/moment/04-displaying/01-format/

opw-3372581

closes odoo/odoo#127089

X-original-commit: c5738479dc1c1879a9ac0169e1ec87eb5098c525
Related: odoo/enterprise#43516
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-07-04 07:55:08 +02:00
Lucas Lefèvre (lul) fa5bce0f8f [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/3b0b6f16 [REL] 16.4.0-alpha.5
https://github.com/odoo/o-spreadsheet/commit/b90a1620 [FIX] Filters: fix filter id on sheet duplication Task: 3384840
https://github.com/odoo/o-spreadsheet/commit/d309d391 [REF] ot_tests: use TEST_COMMANDS for ot test files Task: 3383455
https://github.com/odoo/o-spreadsheet/commit/ed0141fd [FIX] sheet: duplicate sheet name problem when renaming
https://github.com/odoo/o-spreadsheet/commit/869050fc [FIX]  registries: inline non-shared registry actions
https://github.com/odoo/o-spreadsheet/commit/2c434b6e [IMP] functions: update XLOOKUP to return array Task: 3184778
https://github.com/odoo/o-spreadsheet/commit/214213eb [IMP] functions: add a bunch or array functions Task: 3184778
https://github.com/odoo/o-spreadsheet/commit/d74d48ae [FIX] autocomplete dropdown: mock functions for snapshot
https://github.com/odoo/o-spreadsheet/commit/3401c874 [FIX] toolbar: missing hover effect on font size editor Task: 3360143
https://github.com/odoo/o-spreadsheet/commit/f60f2ffe [IMP] composer: double click on range will select the whole range
https://github.com/odoo/o-spreadsheet/commit/187d4d2f [FIX] rendering: cache text width
https://github.com/odoo/o-spreadsheet/commit/c1f7d666 [FIX] clipboard: paste - onlyformat behaviour
https://github.com/odoo/o-spreadsheet/commit/9c0b8ff4 [FIX] clipboard: fix behaviour when selection is updated before the paste
https://github.com/odoo/o-spreadsheet/commit/534fc20a [FIX] Composer: Allow to unselect fully selected composer content
https://github.com/odoo/o-spreadsheet/commit/8e647aec [FIX] xlsx: space loss in XML when exporting hyperlink
https://github.com/odoo/o-spreadsheet/commit/8023bd0b [IMP] filter: select/clear all pre-filtered data
https://github.com/odoo/o-spreadsheet/commit/c4c1b165 [FIX] chart panel: title state in chart design panel
https://github.com/odoo/o-spreadsheet/commit/8ba67af4 [FIX] selection_input: add missing test
https://github.com/odoo/o-spreadsheet/commit/84d4eb47 [IMP] dependencies: update owl to 2.1.3
https://github.com/odoo/o-spreadsheet/commit/bb9192d9 [IMP] dependencies: update Typescript to 4.9
https://github.com/odoo/o-spreadsheet/commit/383ab479 [FIX] functions: translate argument description
https://github.com/odoo/o-spreadsheet/commit/4815a8b6 [FIX] filters: export xlsx of empty cells

closes odoo/odoo#126436

Related: odoo/enterprise#43200
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-06-27 00:31:30 +02:00
Lucas Lefèvre (lul) 9c0ca2ecf9 [FIX] spreadsheet_account: translate function arguments
closes odoo/odoo#126397

X-original-commit: 089547d1dfbfb66d20b14589df396a7955f4ef52
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-06-26 22:15:25 +02:00
Lucas Lefèvre 23ae2b2886 [FIX] spreadsheet: force light theme
Followup of #123320

Some things changed in saas-16.2

closes odoo/odoo#125706

X-original-commit: 82f79027deb8caa1e25e0ae8389f513db98cd6cd
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-06-20 09:11:06 +02:00
Lucas Lefèvre 66e875b031 [IMP] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/251a52e98 [REL] 16.4.0-alpha.4
https://github.com/odoo/o-spreadsheet/commit/73409d7eb [FIX] formatting: round floats with leading zeroes Task: 3327899
https://github.com/odoo/o-spreadsheet/commit/b98383f20 [FIX] misc: type of isCloneable interface
https://github.com/odoo/o-spreadsheet/commit/08492ae06 [IMP] ColorPicker: Extend the custom color selection Task: 3272474
https://github.com/odoo/o-spreadsheet/commit/891d82d9d [REF] xlsx: remove useless exported check
tqhttps://github.com/odoo/o-spreadsheet/commit/6f0ca54f1 [IMP] plugins: remove activeSheet from CoreViews Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/2ac86cdaa [IMP] cf evaluation: make cf evaluation lazy Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/6957579fa [FIX] style: fix dependencies of getCellComputedStyle Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/f035db27d [IMP] plugins: add Immutable type Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/735b3ced4 [IMP] plugins: add history to some CoreView plugins Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/f08900e7c [IMP] plugin: make CoreView plugins more core Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/5fbde7277 [FIX] ColorPicker: fix `+` sign position
https://github.com/odoo/o-spreadsheet/commit/565740d89 [IMP] doc: connecting to external API
https://github.com/odoo/o-spreadsheet/commit/2a92e2dfb [IMP] sheet_actions: removed french spacing
https://github.com/odoo/o-spreadsheet/commit/fbf076535 [IMP] charts: dynamic errors in side panel
https://github.com/odoo/o-spreadsheet/commit/5a7435320 [FIX] demoData: fix XSLX demo data
https://github.com/odoo/o-spreadsheet/commit/8b9c9887c [FIX] clipboard: Do not update viewport on `paste`
https://github.com/odoo/o-spreadsheet/commit/1c4aa507f [REF] Selection: Let caller control selection visibilty Task: 3348042
https://github.com/odoo/o-spreadsheet/commit/c7b0d544f [IMP] config: enables type checking for binded functions

closes odoo/odoo#124697

Related: odoo/enterprise#42444
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-06-13 12:49:33 +02:00
Lucas Lefèvre 7415f9bbbd [FIX] spreadsheet: force light theme
Currenlyt, when using dark theme, spreadsheet is a mess. It's mostly
light theme, with some dark theme elements (mostly coming from odoo
components). There's even inputs where the text is white on a white
background.

o-spreadsheet code isn't prepared to handle dark theme. At all.
There are hardcoded colors everywhere.

Until we have a proper way to handle dark theme (use overridable scss
variables, rely on bootstrap), we force light theme for all elements
inside o-spreadsheet, including odoo components.

The css rules aren't pretty, but at least the spreadsheet is usable.

opw-3329765

closes odoo/odoo#123359

X-original-commit: 37a5f6a5b4b8ecbacf7a8ce4be822c6f348eb5da
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-06-01 22:12:18 +02:00
Lucas Lefèvre 96669c74f8 [IMP] spreadsheet: share spreadsheet
This commit allows to share spreadsheets to other users (public, portal or
internal without the required access rights)

See Enterprise commit. This commit prepares the ground to sharing
`documents.document` spreadsheets.
(I expect dashboard spreadsheet sharing in the near future which will
use the same generic code)

The challenges of sharing odoo spreadsheets
-------------------------------------------

Odoo spreadsheets can have any data from the database.
ODOO.PIVOT and ODOO.LIST functions specifically can target *any model*
and *any field*.
The values are dynamically loaded with RPC calls when the
spreadsheet is open. Normal access rights apply to load this kind of
"embeded" data.

A user can open a spreadsheet if he can read the `documents.document` record,
but odoo specific functions might result in errors if the user doesn't have
the access rights on the underlying model.

That's obviously not what we want when sharing a spreadsheet to an external
person. We want this person to see the values and not a spreadsheet full
of errors.

Giving access to external user?
---------------------------------

Users must have a very clear understanding what they are "leaking" when
they share a spreadsheet. Sharing a spreadsheet should not open any door
the user wouldn't think of or wouldn't understand.

The best way is to be very strict with the data we are sharing.
That means: only the specific models, specific fields and specific records
visible in the spreadsheet by the user who is sharing (different users can
see different values for the same spreadsheet, depending on their access rights).

We also want to consider the following scenario:
Alice is a newcomer (with very limited access rights) and she shares a
spreadsheet to a customer. A few years later, she is manager and has a
lot more access rights (groups, ir.rules, etc.).
The forgotten spreadsheet shared years ago should not leak more data because
Alice now has access to all company data.

Specification
=============

With all those challenges in mind, here is a first approach of shared
spreadsheet:

Readonly freezed spreadsheet for external users
-----------------------------------------------

When sharing a spreadsheet, we actually copy and freeze the spreadsheet at that
time. Odoo formulas are replaced with their value. This is the easiest and safest
way to deal with access rights to other models: there's no access to other
models at all ^^
The spreadsheet is displayed in readonly since it would only be editing a copy.
If the external person wants data to be updated, he can ask a new sharing link.

Read/Write for internal users
-----------------------------

The situation for internal users is different. We can rely on their actual access
rights.
When an internal user opens a spreadsheet sharing link, he is redirected to the
regular spreadsheet client action. A token is used to read/write the
`documents.document` record (and other linked models such as `spreadsheet.revision`),
but the data for pivots, lists, etc. is loaded with the user's own access rights.
If the user doesn't have the rights to read a model or field, the function results in
an error and that's the expected behavior.
This sharing strategy is perfectly fine for all spreadsheets that doesn't contain
any odoo data (think of all the Google Sheets we receive internally by email to
register to an event or any other stuff).

Future work
-----------
From a functional point of view, the spec is far from perfect.
Users would probably expect the data to "update" itself (not freezed).
People will want write access for external users as well.
Given the complexity of getting it right (from a tecnical, security and functional POV),
this is left for a later work

closes odoo/odoo#114040

Task: 3045808
Related: odoo/enterprise#37687
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-05-15 13:58:59 +02:00
Lucas Lefèvre 421fd1baa6 [ADD] spreadsheet_dashboard_website_sale,website_sale: add eCommerce dashboard
The `sale.report `field `is_abandoned_cart` is moved from module
`website_sale_dashboard` to `website_sale`.
This allows to use it in the eCommerce dashboard in the community edition.

Task 3222991

closes odoo/odoo#121165

Related: odoo/enterprise#40979
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-05-15 11:41:31 +02:00
Lucas Lefèvreandanhe-odoo 65d2bb7618 [IMP] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/afee7d57 [REL] 16.3.0-alpha.8
https://github.com/odoo/o-spreadsheet/commit/3f5b6c41 [FIX] topbar: menu items are now sorted by sequence
https://github.com/odoo/o-spreadsheet/commit/88edc8b0 [IMP] core: add timestamp to remote revisions
https://github.com/odoo/o-spreadsheet/commit/289044a3 [FIX] sidepanel: switching from on sidepanel to another should trigger onCloseSidePanel
https://github.com/odoo/o-spreadsheet/commit/5848dcb7 [FIX] composer: fix placeholder scrollbar Task: 3258920
https://github.com/odoo/o-spreadsheet/commit/378bdd89 [FIX] menu items: text overflow not working
https://github.com/odoo/o-spreadsheet/commit/c7524c5a [FIX] evaluation: compute format from empty cell
https://github.com/odoo/o-spreadsheet/commit/bca6ad64 [IMP] TopBar: Add missing icons an gray disabled icons
https://github.com/odoo/o-spreadsheet/commit/e672e183 [FIX] menus: mark automatic format as active
https://github.com/odoo/o-spreadsheet/commit/fac211e1 [FIX] SelectionInput: Fix cross symbol
https://github.com/odoo/o-spreadsheet/commit/53ce0f02 [FIX] SelectionInputPlugin: prevent multiple range in 'singleRange' input Task: 3237798
https://github.com/odoo/o-spreadsheet/commit/4aa957bd [FIX] topbar: fix borderEditor props
https://github.com/odoo/o-spreadsheet/commit/803bc1a8 [FIX] topbar: active item color
https://github.com/odoo/o-spreadsheet/commit/f6705fa4 [FIX] ContentEditableHelper: fix getCurrentSelection for Firefox Task: 3071026
https://github.com/odoo/o-spreadsheet/commit/61766daa [REF] css: move hoverable-button to spreadsheet
https://github.com/odoo/o-spreadsheet/commit/34fd1982 [IMP] borders: add support for different line styles Task: 2714331
https://github.com/odoo/o-spreadsheet/commit/5539367a [FIX] lookup: horizontal search in LOOKUP function Task: 3277145
https://github.com/odoo/o-spreadsheet/commit/a7d7c0e5 [IMP] menu: disable insertion via menus when separate cols/rows selected
https://github.com/odoo/o-spreadsheet/commit/605ae100 [REF] selective_history: name constructor arguments Task: 3301044
https://github.com/odoo/o-spreadsheet/commit/23ec1c47 [FIX] collaborative: ignore bad snapshot revision
https://github.com/odoo/o-spreadsheet/commit/ed9ee1f3 [IMP] model: dispatch initial revision to core only
https://github.com/odoo/o-spreadsheet/commit/8dbd4801 [FIX] chart: no dataset with single cell

closes odoo/odoo#121273

Related: odoo/enterprise#41001
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Co-authored-by: anhe-odoo <anhe@odoo.com>
2023-05-15 08:34:45 +02:00
Lucas Lefèvre 2fde5b47d1 [FIX] spreadsheet_dashboard_sale: display number of quotations
Database: Runbot 16

Exact steps (or video) to reproduce the issue (on runbot):
Dashboard
Sales
Select Last seven days
The figures do not include today
Remove the filter
The Order now shows but the Quotations is at zero. In the Top Quotations and Top Sales Orders sections we can see there is one of each, but the quotation
doesn't show

opw-3251869

closes odoo/odoo#120740

X-original-commit: 6ca41c4266f63ae629307330241aad810bbc950f
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-05-09 00:40:59 +02:00
Lucas Lefèvre bb6428825b [FIX] spreadsheet: support properties field in lists
Steps to reproduce the issue:
1. Project> select Project > Task> List view
2. Studio list view > Add existing properties field
3. Go back to list view > Favorites > add to spreadsheet
4. New Spreadsheet > Will receive error

opw-3284273

closes odoo/odoo#120473

X-original-commit: 5eb80e34db2e54b56164ea4b98bea3cebb09312b
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-05-03 20:08:59 +02:00
Lucas Lefèvre 91f4b4a2e1 [FIX] spreadsheet_dashboard_account: count individual invoices
In the Invoicing dashboard, the "Average Invoice" scorecoard displays
the wrong amount of invoices. It displays the number of
"account.invoice.report" lines.

This commit fixes the issue by displaying the count_unique measure
of "move_id"

task 3180524

closes odoo/odoo#120322

X-original-commit: 6232896fe06640de6d461e645811673fe27481aa
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-05-02 19:07:09 +02:00
Lucas Lefèvre 352c28b995 [FIX] spreadsheet: evaluate new ODOO.LIST functions
Steps to reproduce:

- Open any listview (e.g Sales order listview)
- select records from the listview, go to Favorites, and click on 'Insert list in spreadsheet' option
- Once the spreadsheet is created, Reload your browser.

Current behavior:
- Spreadsheet goes to an infinite loading.

opw-3284058

closes odoo/odoo#119561

X-original-commit: 6993d3e36d2f2540100e1bd248b629cc9e191659
Related: odoo/enterprise#40234
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-04-25 08:35:42 +02:00
Lucas Lefèvre 34edfdd290 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/6304f41c [REL] 16.3.0-alpha.5
https://github.com/odoo/o-spreadsheet/commit/5d6d39ff [IMP] history: add the possibility to repeat commands at redo Task: 2508693
https://github.com/odoo/o-spreadsheet/commit/f48587de [IMP] grid: add F4 shortcut to redo Task: 2508693
https://github.com/odoo/o-spreadsheet/commit/6ada2a17 [REF] history: transform history into a UI plugin Task: 2508693
https://github.com/odoo/o-spreadsheet/commit/f8490e90 [IMP] *: use deepCopy instead of JSON.parse(JSON.stringify) Task: 3272878
https://github.com/odoo/o-spreadsheet/commit/65387405 [IMP] model: store handler arrays Task: 3272878
https://github.com/odoo/o-spreadsheet/commit/5ebc4e30 [IMP] formats: performance of `splitNumber()` Task: 3272878
https://github.com/odoo/o-spreadsheet/commit/a4b68944 [IMP] sheet: move cells methods performance Task: 3272878
https://github.com/odoo/o-spreadsheet/commit/0b4b8ab0 [IMP] header_visibility: improve perfs of `findVisibleHeader` Task: 3272878
https://github.com/odoo/o-spreadsheet/commit/4178abad [FIX] grid: don't focus input if it's unmounted
https://github.com/odoo/o-spreadsheet/commit/9c801ee0 [IMP] xml_bundle: make bundling xml templates sync
https://github.com/odoo/o-spreadsheet/commit/58a15c79 [IMP] FilterIconsOverlay: vertical align for filter icon Task: 3162258
https://github.com/odoo/o-spreadsheet/commit/76141f75 [FIX] test: jest.setTimeout() pushed by error

closes odoo/odoo#119314

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-04-22 05:52:02 +02:00
Lucas Lefèvre e5d11fa7a5 [FIX] spreadsheet_dashboard_hr_expense: don't mix currencies
In the Dashboard app, expenses KPI amounts are currently expressed in the
currency they were made in, but with the currency symbol of the company
currency. It also means amounts with different currencies are aggregated.

We want the KPI to be expressed in the company currency and not in the
expense currency.

Note that even with this commit, the amounts are still mixing different
currencies if multiple companies are active

Task 3266092

closes odoo/odoo#119264

X-original-commit: e579ec5b3794d545676accdd23428557b75d05fa
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-04-20 22:09:57 +02:00
Lucas LefèvreandAlexis Lacroix 7a1ae006eb [IMP] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/6824b8a1 [REL] 16.3.0-alpha.4
https://github.com/odoo/o-spreadsheet/commit/9b911f61 [FIX] tests: fix indeterministic ui sheet
https://github.com/odoo/o-spreadsheet/commit/f20b7be5 [FIX] demo: Align font family with Odoo Task: 3269724
https://github.com/odoo/o-spreadsheet/commit/49a5ee0e [FIX] ColorPicker: Fix checkmark symbol Task: 3269724
https://github.com/odoo/o-spreadsheet/commit/4f2ecfec [REM] menu: remove icons on menu items
https://github.com/odoo/o-spreadsheet/commit/54fca81f [REF] *: rename 'menuItem' files to 'action' files
https://github.com/odoo/o-spreadsheet/commit/5c23e084 [REF] *: Change names of type 'MenuItem' to 'Action'
https://github.com/odoo/o-spreadsheet/commit/e5007fd1 [REF] replace xml tool bar in the xml top bar by menu item buttons
https://github.com/odoo/o-spreadsheet/commit/950abc45 [REF] menu registry: factorize menu registries by menu items
https://github.com/odoo/o-spreadsheet/commit/c02a7e96 [IMP] topbar menu: add icons for conditional menu items
https://github.com/odoo/o-spreadsheet/commit/a19d9cac [IMP] topbar menu: add icons for static menu items
https://github.com/odoo/o-spreadsheet/commit/7825124c [IMP] menu: replace right text icon by left icon
https://github.com/odoo/o-spreadsheet/commit/be3c3d6f [FIX] viewport: infinite loop with hidden headers
https://github.com/odoo/o-spreadsheet/commit/c05be1de [FIX] github: update release-action to latest version
https://github.com/odoo/o-spreadsheet/commit/9fdbdab2 [FIX] sheetview: correctly auto-size spreadsheet
https://github.com/odoo/o-spreadsheet/commit/7d18b589 [IMP] bottom_bar: hide add sheet button in readonly mode
https://github.com/odoo/o-spreadsheet/commit/108b89bd [FIX] menus: don't open submenu is not readonly
https://github.com/odoo/o-spreadsheet/commit/1edbc157 [FIX] top bar: remove useless "Save" menu item

closes odoo/odoo#118624

Related: odoo/enterprise#39801
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Co-authored-by: Alexis Lacroix <laa@odoo.com>
2023-04-17 09:27:58 +02:00
Lucas Lefèvre 0651424113 [FIX] documents_spreadsheet: list dates with correct format
Commit odoo/enterprise@4bbf70f was fixing a timezone issue. Datetimes coming
from lists inserted in a spreadsheet were always displayed in UTC.

However, this commit also changed the formatting behavior.
Before the fix: date/datetimes were dispalyed with the server format
After: they are displayed with the local format (FR if the user lang
is French)

This can lead to issues because spreadsheet only understands a
handfull of date(time) format.
For example, it doesn't understand dd/mm/yyyy format but only
the other way around (mm/dd/yyyy)

This commit restores the previous format (server format), while
preserving the timezone conversion.

opw-3251586

Manual forward-port of odoo/enterprise#39438

closes odoo/odoo#118285

X-original-commit: bf84195bce4fbea55d1a4e6a6cd9f17d9be86b73
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-04-12 12:26:26 +02:00
Lucas Lefèvre fccbc91cc8 [FIX] spreadsheet_dashboard_account: display unpaid amount absolute value
In the Invoicing dashboard, the upper-left most scorecard displays the total
invoiced amount.
The baseline "X unpaid" is wrong. It was displaying the difference between
the key value (total invoiced amount) and the unpaid amount.
That means if not a single invoice was paid (everything unpaid), it would
display "0 unpaid". That obviously not correct.

opw-3248761

closes odoo/odoo#118030

X-original-commit: 2b795ee59ef063b5b7298382008ebd61c51de36e
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-04-07 17:46:42 +02:00
Lucas Lefèvre 9eda122f7c [FIX] spreadsheet_account: set fiscal day in tests
Install `l10n_au_keypay` on a fresh database, run the tests:
two tests in `spreadsheet_account` fail.

They wrongly assumed the last fiscal day of the main company is always 31th December.
This is not true with the module mentioned above installed since
https://github.com/odoo/odoo/commit/65dacfc17bec5feba1216354c71ca542c1b762b2

(look at `chart_template.py`)

Runbot build errors: 19796, 19797

closes odoo/odoo#117419

X-original-commit: a8d28ef16318df7d42c93265580a8e5dbc75cb1d
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-04-01 18:01:49 +02:00
Lucas Lefèvre 052dadfc5b [REF] spreadsheet: introduce @odoo/o-spreadsheet module
Using o-spreadsheet features and functions is done using
the same import module as if it was installed from npm.

Additionaly, by adding the library as dev dependency in package.json[1], IDEs can
now leverage Typescript types for autocomplete and type checking.
The "alpha" release tag is always the lastest master version.

[1] enable web tooling `addons/web/tooling/enable.sh` ;)

closes odoo/odoo#115972

Related: odoo/enterprise#38471
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-03-30 17:57:44 +02:00