Commit Graph
100 Commits
Author SHA1 Message Date
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
Khushi 905d8565ad [FIX] spreadsheet: traceback while inserting chart from other model
Steps to reproduce:
- Insert a list/pivot in a blank spreadsheet from a module (say Sales).
- Apply a global filter on it.
- Insert an odoo chart in the same sheet but from a different module (eg. CRM)

This works just fine when chart is inserted from the same model because it matches
the existing filter (from the pivot/list), and directly returns that field matching
without check the field matching from charts.

However in case of different model, the issue is that when there are no charts in the
sheet, the existing code of `getOdooChartIds` retrieves the incorrect chart ids
(`getChartIds` getter returns all chart ids, including the id of chart being inserted).
This leads to a traceback as the code tries to fetch fieldMatchings for a non-existent
chart within the sheet.

This commit resolves the issue by modifying the `getOdooChartIds` method to now utilize
`this.charts` instead of `getChartIds` getter, which correctly provides the ids of
charts already present in the sheet.

Task ID: 3573402

closes odoo/odoo#140700

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-11-16 08:57:45 +00:00
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) 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) 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
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) 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) 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
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
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
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) 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
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
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) 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
Pierre Pulinckx (pipu) 7e3c1ecdb8 [REF] *: Update Chart.js to V4.3
Change version of Chart.js from V2.9.3 to V4.3.0
You can find changelog on
https://www.chartjs.org/docs/latest/migration/v4-migration.html

Version 4.3.0 of chart.js no longer uses moment.js. This task is a
prerequisite to completely remove the use of moment.js (task 3391739)

Why add aspectRatio : 2 ? => Canvas aspect ratio (i.e. width / height,
a value of 1 representing a square canvas). Note that this option
is ignored if the height is explicitly defined either as attribute
or via the style. The default value varies by chart type; Radial charts
(doughnut, pie, polarArea, radar) default to 1 and others default to 2.

Why no more Chart.animationService.advance(); ?
There is no longer an equivalent in this version.
However, we have verified that the problem is no longer present in this
version.

Why use now getElementsAtEventForMode ?
It's clearly noted in the changelog. follow the link above.

task-3392075

Part-of: odoo/odoo#127259
2023-08-16 12:47:34 +02:00
Chenyun YangandLucas Lefèvre dbdb7c9a7c [IMP] spreadsheet, spreadsheet_dashboard: share dashboard
This commit introduces models related to sharing dashboard, and
implements the sharing from dashboard view.
The basic idea is the same as sharing normal spreadsheet. The major
difference is that sharing a dashboard will direct to the dashboard view
instead of read-only spreadsheet view. A button and a side panel which
shows the global filters show up only in the dashboard view.

task 3378150

closes odoo/odoo#127370

Related: odoo/enterprise#43664
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Co-authored-by: Lucas Lefèvre <lul@odoo.com>
2023-08-14 14:52:02 +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
Adrien Minne (adrm) 4c13f4f08c [IMP] spreadsheet: detect mismatch in user/spreadsheet locale
This commit add a small indicator in the spreadsheet's control panel
to indicate if the user's locale is different from the spreadsheet's.

closes odoo/odoo#129857

Task: 3389491
X-original-commit: 5c776994f7bd230816369be3899989e7ab780906
Related: odoo/enterprise#44665
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-07-27 14:47:32 +02:00
Pierre Pulinckx (pipu) 504b4a7178 [REF] *:Replace moment usages with luxon
luxon and moment are both used in the solution, but
these two libraries facilitate the manipulation of dates.
It was decided to replace all uses of moment with
luxon so we can then remove moment.js from the
code and lighten the assets.

task-3391739

closes odoo/odoo#127406

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-13 14:47:41 +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
Adrien Minne (adrm) c31032f415 [IMP] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/7d15d3c7 [REL] 16.4.0-alpha.6
https://github.com/odoo/o-spreadsheet/commit/56f3b593 [IMP] spreadsheet: add locale handling Task: 3222401
https://github.com/odoo/o-spreadsheet/commit/5aec70d4 [IMP] cell: store date string as value + format Task: 3222401
https://github.com/odoo/o-spreadsheet/commit/eeaf0083 [IMP] icons: add display header icon
https://github.com/odoo/o-spreadsheet/commit/3f1e970c [FIX] SelectionInput: fix position of exclamation mark icon Task: 3355063
https://github.com/odoo/o-spreadsheet/commit/a46bf04e [FIX] LineBarPieConfigPanel: charts data series invalid input Task: 3355063

closes odoo/odoo#126679

Related: odoo/enterprise#43291
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-06-29 18:20:37 +02:00
Rémy Voet (ryv) 3c62ca1eb9 [REM] core: remove name_get API
Rationale
=========

Since v8, the `display_name` field is present on all models. By default,
`display_name` uses `name_get` which has pretty much the same purpose
(return record name used by the web client). Gradually, many (backend)
developers (and the ORM: https://github.com/odoo/odoo/commit/6da1c3ac4c036eac289597602976538e243cb939)
started using `display_name` (more convenient than
`record.name_get()[0][1]`) but it still had the `name_get` override.
It becomes more complex than necessary and poeple start to misunderstand
the two (and sometimes override both, leading to inconstiencies between
`display_name`/`name_get`).

To simplify the ORM and the API, we decided to keep only one of them,
the `display_name` field:
- It is much more convenient from a backend point of view
(`record.name_get()[0][1]` vs `record.display_name`)
- It is cached during the same transaction (and invalidated if
its dependencies change)
- It can be overridden like any other compute field (override
`_compute_display_name` with any extra dependencies)
- `name_get` is replaced by `read(['display_name'])`
(API perceptive), which can actually be more efficient
(if `display_name`'s depends are correct, the ORM will only fetch the
fields it needs instead of every prefetchable field)

Changes
=======

- Deprecates `name_get` for the v17 and based the method on
`display_name` (the opposite of before)
- Converts all usage of `name_get`
- Overrides of `name_get` are now overrides of `_compute_display_name`
- For `res.partner`, rename the field store `display_name` into
`complete_name` because `display_name` context-dependent and it makes
no sense to have a compute store that is context-dependent.
- Previously, it was possible to return multiple names for the same
record with `name_get`, but it was tricky and most of the usage of
this `name_get` didn't take this into account. The only example of
this is the `name_get` of `product.product`
(now use `", ".join(<names>)`).

Part-of: odoo/odoo#122085
2023-06-28 17:41:19 +02:00
Rmi Rahir (rar) 7b5f1df3d1 [FIX] spreadsheet: Fix bad serverData in js tests
The menus added in the server data which are used in mockServer did not
reflect a realistic menu configuration. This was brought to light when
trying to fix the addition of links to ir.ui.menu inside a spreadsheet.
See task 2821480

Related ENT pr: https://github.com/odoo/enterprise/pull/42885

closes odoo/odoo#126497

X-original-commit: 128475e8c29f8493b01710342179a5c468897c61
Related: odoo/enterprise#43209
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-06-27 13:44:25 +02:00
anhe-odoo f47f1278f3 [IMP] spreadsheet: autofill from pivot/list propagate the format
Task Description

When autofilling a pivot/list cell from another pivot/list cell,
the format of the target wasn't overwritten. This can lead to some
strange behaviour where the user set the desired format to a cell
then autofill the remaning cell of the column/row to apply the same
format once and nothing happen.
We now propagate the set format with the pivot/list autofill, but
we still don't propagate the style and border definition, as it
could break the currently defined pivot/list style.

Related Task
task-3252442

closes odoo/odoo#124984

X-original-commit: 8678b716a9fe2b38e9ed5d399d89df2343ee239c
Related: odoo/enterprise#42542
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Hendrickx Anthony (anhe) <anhe@odoo.com>
2023-06-15 00:12:47 +02:00
Mathieu Duckerts-AntoineandLucas Lefevre dacb31aa85 [REF] spreadsheet: use name service in DisplayNameRepository
We make the class DisplayNameRepository use the name service instead of
BatchEndpoint. This makes the code simpler and allow to avoid a lot of
rpcs (in some occasions) when fetching display names.

closes odoo/odoo#124090

Related: odoo/enterprise#42124
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Lucas Lefevre <lul@odoo.com>
2023-06-09 17:00:48 +02:00
Rmi Rahir (rar) 86eb916bf2 [IMP] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/82328ad7 [REL] 16.4.0-alpha.2
https://github.com/odoo/o-spreadsheet/commit/fc9f6263 [FIX] index.ts: export `invalidateXCommand` sets
https://github.com/odoo/o-spreadsheet/commit/dca78e38 [IMP] Charts: improve side-pannel clarity
https://github.com/odoo/o-spreadsheet/commit/60e55d6c [REF] core: remove range plugin attribute
https://github.com/odoo/o-spreadsheet/commit/564c094f [REL] 16.4.0-alpha.1
https://github.com/odoo/o-spreadsheet/commit/d01251d0 [IMP] evaluation: lazy build dependency graph
https://github.com/odoo/o-spreadsheet/commit/0a6a786e [IMP] evaluation: introduce array formulas
https://github.com/odoo/o-spreadsheet/commit/54eea364 [MOV] evaluation: move file in its own folder
https://github.com/odoo/o-spreadsheet/commit/c11a642d [IMP] icons: add unfreeze icon
https://github.com/odoo/o-spreadsheet/commit/3632c629 [FIX] viewport: warning message on resized viewport size
https://github.com/odoo/o-spreadsheet/commit/3169b5c9 [REF] cells: use class instead of closure
https://github.com/odoo/o-spreadsheet/commit/0d6a3904 [FIX] ColorPicker: Fix style issue
https://github.com/odoo/o-spreadsheet/commit/6a12501a [FIX] SheetUIPlugin: set column height for multi line content
https://github.com/odoo/o-spreadsheet/commit/fffba67c [FIX] ColorPicker: modified add custom color icon Task: 3258627
https://github.com/odoo/o-spreadsheet/commit/2d158b55 [FIX] ContentEditableHelper: do not throw on missing node
https://github.com/odoo/o-spreadsheet/commit/40b37030 [IMP] components: use a hook to register/clean up event listeners
https://github.com/odoo/o-spreadsheet/commit/3a3aab7b [REL] 16.4.0.alpha
https://github.com/odoo/o-spreadsheet/commit/d70dcebe [FIX] ChartFigure: chart/image menu options in readonly mode Task: 3284659
https://github.com/odoo/o-spreadsheet/commit/fcc0d723 [IMP] commands: introduce reserved keywords Task: 3276541
https://github.com/odoo/o-spreadsheet/commit/da9f553e [IMP] commands: generic check for position Task: 3276541
https://github.com/odoo/o-spreadsheet/commit/930ac3a0 [IMP] model: core allowDispatch for local commands Task: 3276541
https://github.com/odoo/o-spreadsheet/commit/9f067cfe [FIX] Topbar: fix data menu items order
https://github.com/odoo/o-spreadsheet/commit/2ce92d3c [FIX] TopBar: fix icon's CSS
https://github.com/odoo/o-spreadsheet/commit/2be1518c [IMP] tests: add helper triggerTouchEvent Task: 3302326
https://github.com/odoo/o-spreadsheet/commit/e91b2b89 [IMP] tests: use keyUp/keyDown helper everywhere Task: 3302326
https://github.com/odoo/o-spreadsheet/commit/d63c2be2 [IMP] tests: add a triggerWheelEvent helper Task: 3302326

closes odoo/odoo#122677

Related: odoo/enterprise#41587
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-05-26 18:41:35 +02:00
Rmi Rahir (rar) 1259e60877 [FIX] spreadsheet: raise error for json fields in lists
The json fields are not supported in lists at the moment because they
require additional RPC to fetch the display value as long as its
formatting.

closes odoo/odoo#122074

Task: 3324679
X-original-commit: 9e6d598e6a96434c68634149ecf1acf3e714ca03
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-05-23 16:32:19 +02:00
FrancoisGe ddf67f83be [FIX] *: tests: utility to mock RPCError
In this commit we add the makeServerError utility which allows you
to easily create a valid RPCError in the tests.

We have added this utility to prevent the use of invalid or incomplete
errors. We will give default values for all the parameters needed for
a valid RPCError.

For example, in some tests, we only check the presence of an error
dialog and not the expected one. So there was a set of tests that were
green because the failure was in the RPCError handling. So we had an
error dialog but it was not the right one. In general, the crash occurred
because the RPCError contained no data.

closes odoo/odoo#121932

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-05-23 16:32:04 +02:00
Chenyun Yang 085fd873d6 [IMP] spreadsheet[_dashboard]: delete relation filter values using backspace key
This commit implements the functionality of using backspace key to
delete values in relation filter.

task 3324738

closes odoo/odoo#121513

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-05-16 18:08:07 +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
Adrien Minne (adrm) bc56084355 [REF] spreadsheet: move pivot dataSources to UI
Before this commit, the pivot's dataSources were managed by the core plugin
`PivotCorePlugin`. This didn't make sense since dataSources aren't core data:

- they are neither exported nor imported
- they can be different for each user (their ids were generated via uuidv4
at import)
- managing them required to handle local command in the core plugin

Moved the dataSources management to the UI plugin `PivotUIPlugin` and moved
the relevant getters inside this plugin. Changed the ids of the dataSources
to be the same as the pivot's id + a prefix, to avoid having to maintain a
mapping `pivotId` <=> `dataSourceId` .

This commit also removes the dataSourceId from the `INSERT_PIVOT`
command, which have no place here since this is a core command and the
dataSources are now a pure UI concept.

This is slighly more tricky than for lists, because the datasource need to
be loaded before the `INSERT_PIVOT` command to fetch the table structure.
The component dispatching the command need to make sure it creates a
dataSource with the id given by the getter `getPivotDataSourceId`,
or else the dataSource will be loaded twice.

Task: 3293491
Part-of: odoo/odoo#120136
2023-05-05 17:06:45 +02:00
Adrien Minne (adrm) d70da3f734 [REF] spreadsheet: move list dataSources to UI
Before this commit, the list's dataSources were managed by the core plugin
`ListCorePlugin`. This didn't make sense since dataSources aren't core data:

- they are neither exported nor imported
- they can be different for each user (their ids were generated via uuidv4
at import)
- managing them required to handle local command in the core plugin

Moved the dataSources management to the UI plugin `ListUIPlugin` and moved
the relevant getters inside this plugin. Changed the ids of the dataSources
to be the same as the list's id + a prefix, to avoid having to maintain a
mapping `listId` <=> `dataSourceId` .

This commit also removes the dataSourceId from the INSERT_ODOO_LIST
command, which have no place here since this is a core command and the
dataSources are now a pure UI concept.

Task: 3293491
Part-of: odoo/odoo#120136
2023-05-05 17:06:45 +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
Chenyun Yang de607a7296 [IMP] spreadsheet: add YTD in period filters
This commit adds YTD (year to date) filter to global period filters in
dashboard.

YTD filter gets the data from Jan 1st of the current year to
today (included). The unit of its offset is year.

task 3215947

closes odoo/odoo#118466

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-04-25 00:52:47 +02:00
Florian Charlier 9942eb3dcc [IMP] spreadsheet: add document test model field
See the added field in documents in ENT PR.

Task-3209385

closes odoo/odoo#119299

Related: odoo/enterprise#38171
Related: odoo/upgrade#4579
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-04-22 00:52:07 +02:00
Chenyun Yang 378954a486 [IMP] spreadsheet: include ongoing day in period filters
This commit includes the ongoing day in the current period filters.

Now the start date (time) of each period filter is the start of next day,
and the end date (time) is the end of today.

task 3267525

closes odoo/odoo#118326

Related: odoo/enterprise#39641
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-04-17 14:14:10 +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
Rémi Rahir (rar) 33b39eef80 [IMP] spreadsheet: update o_spreadsheet to latest version
https://github.com/odoo/o-spreadsheet/commit/573e6791 [REL] 16.3.0-alpha.3
https://github.com/odoo/o-spreadsheet/commit/3cf6910c [IMP] spreadsheet: global `o-disabled` CSS class
https://github.com/odoo/o-spreadsheet/commit/18dcf13f [IMP] model: add canDispatch method
https://github.com/odoo/o-spreadsheet/commit/ca3b3d9d [IMP] figure: reposition figure upon row/col deletion Task: 3171141
https://github.com/odoo/o-spreadsheet/commit/2a814dce [FIX] viewport: viewport maxSize should consider the client size Task: 3204720
https://github.com/odoo/o-spreadsheet/commit/bc96d257 [IMP] menu: display separator of hidden items
https://github.com/odoo/o-spreadsheet/commit/1cba1222 [FIX] header_size: prevent row resize caused by multiline formulas
https://github.com/odoo/o-spreadsheet/commit/cfa3b530 [IMP] test: make test tsconfig work in vscode
https://github.com/odoo/o-spreadsheet/commit/133656d6 [FIX] *: use `Color` alias wherever we work with color strings
https://github.com/odoo/o-spreadsheet/commit/bff461d0 [FIX] *: standardization of color representation Task: 3193882
https://github.com/odoo/o-spreadsheet/commit/7445938f [FIX] type: Fix the Alias type
https://github.com/odoo/o-spreadsheet/commit/e96eef5b [IMP] Chart: use first row as header
https://github.com/odoo/o-spreadsheet/commit/91734b7d [MOV] filter: rename fitler_icons_overlay file
https://github.com/odoo/o-spreadsheet/commit/d3234a56 [IMP] color_picker : added accessibility to custom color picker
https://github.com/odoo/o-spreadsheet/commit/bbf4f484 [IMP] xlsx_import: support more date formats
https://github.com/odoo/o-spreadsheet/commit/2e02cfcc [IMP] tests: improve readability of new Model() in tests
https://github.com/odoo/o-spreadsheet/commit/d3036999 [FIX] tests: Bypass useless `drawGrid` Task: 3254822
https://github.com/odoo/o-spreadsheet/commit/96d5e44e [FIX] model: prevent UI plugins to refuse core commands
https://github.com/odoo/o-spreadsheet/commit/21333f9c [FIX] tokenizer: detect xc with sheet name starting with a number Task: 3215464
https://github.com/odoo/o-spreadsheet/commit/654d22fc [FIX] clipboard: don't open composer on firefox
https://github.com/odoo/o-spreadsheet/commit/b14ef0fc [FIX] demo: optional askConfirmation cancel argument
https://github.com/odoo/o-spreadsheet/commit/bf6c3b6a [IMP] spreadsheet: inherit font family
https://github.com/odoo/o-spreadsheet/commit/c20ecd57 [IMP] edition: remove `getEditionSheet` for redundancy Task: 3229919

closes odoo/odoo#118429

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-04-13 16:40:30 +02:00
Pierre Rousseau 70a2a62ec9 [FIX] spreadsheet: correctly format date/datetime values of list
Before this revision, a date/datetime field was displayed in UTC instead
of in the user timezone.
This revision fixes this issue.

opw 3127742

closes odoo/odoo#117623

X-original-commit: c07b450594f7e3e1f093d0b5a5a083f915f75310
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-04-04 14:46:09 +02:00