Commit Graph
181 Commits
Author SHA1 Message Date
Adrien Minne (adrm) c39c329d6b [IMP] spreadsheet: allow to reorder global filters
This commit allows to reorder global filters via drag and drop. The
fact that global filters have a concept of order means that the
structure of the global filters in the core plugin need to change from
an Object<string, GlobalFilter> to an Array<GlobalFilter>.

closes odoo/odoo#135869

Task: 3502684
Related: odoo/enterprise#47583
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-10 18:31:02 +00:00
Adrien Minne (adrm) 5063e2a1e5 [REF] spreadsheet: de-duplicate filter id in cmds
The commands `ADD_GLOBAL_FILTER` and `EDIT_GLOBAL_FILTER` had the filter id
once in cmd.id, and once in cmd.filter.id. This made it possible to send
a command with 2 different ids, which can have arbitrary behaviour depending
on the implementation details of the command.

Changed it so we only use cmd.filter.id, and removed the cmd.id field. Also
simplified the commands helpers for the tests.

Task: 3502684
Part-of: odoo/odoo#135869
2023-10-10 18:31:02 +00:00
anhe-odoo 5b29e2cd21 [IMP] spreadsheet: Allow Odoo Chart domain edition
Task Description:

This PR aims to add the possibility to edit the evaluation domain of
an Odoo chart, the same way it can currently be done for other
datasources like `List` or `Pivot`. This revision ensures that the chart
datasources are properly reloaded their domain update.

closes odoo/odoo#135242

Task: 3384872
Related: odoo/enterprise#47336
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-10 17:26:35 +00:00
Rémi Rahir (rar) bc15b92272 [FIX] spreadsheet: Datasource - evaluate domain on-the-fly
PR [1] introduced the evaluation of ocntextual domain. However, this was
only evaluated once at the creation of the datasource. This revision
changes the flow to evaluate the context upon  the datasource loading.

[1] https://github.com/odoo/odoo/pull/131874

Part-of: odoo/odoo#135242
2023-10-10 17:26:35 +00:00
Lucas Lefèvre (lul) 1bc0cea716 [FIX] spreadsheet: mark pivot cell faster
In HBA's demo sheet, `markAsValueUsed` goes from more than 2% of the total
loading time to less than 1%

closes odoo/odoo#138166

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-10-10 11:07:59 +00:00
Lucas Lefèvre (lul) 9579799cb7 [FIX] spreadsheet: reuse same error
Instanciating an error is very slow.
In HBA's demo spreadsheet, `_assertDataIsLoaded` takes up to 17% of the total
spreadsheet loading time.
With this commit, it's reduced to less than 2%

Part-of: odoo/odoo#138166
2023-10-10 11:07:59 +00:00
Lucas Lefèvre (lul) 3ef421c1d2 [FIX] spreadsheet: faster compute format
`getReportMeasures` is called repeatedly for every pivot function.
In HBA's demo spreadsheet it takes up to 30% of the loading time.

Part-of: odoo/odoo#138166
2023-10-10 11:07:59 +00:00
Lucas Lefèvre (lul) 568be9e7b8 [FIX] spreadsheet: parse group field faster
On HBA's demo spreadsheet, `parseGroupField` takes more than 3% of the total
loading time.
This commit reduces to less than 1.5%

Part-of: odoo/odoo#138166
2023-10-10 11:07:59 +00:00
jash-odooandLucas Lefèvre 25d5b98832 [IMP] global_filter: date filtering and automatic user selection
Previously, when users selected the month or quarter filter and saved
it, the filter would only return data from the current year. This issue
has been fixed in this commit.

Merge the month and quarter data filters into a single month/quarter
filter. This will allow users to select a year which behave as year filter.
If a user only selects a month or quarter, the filter will work accordingly.

The year filter will be removed, as the month/quarter filter can now
be used to filter data by year.

In addition, a checkbox will be added to the relation filter that will
allow users to automatically select the current user. This checkbox
will only be displayed if the model is res.users.

closes odoo/odoo#126935

Task: 3370627
Related: odoo/enterprise#43426
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Co-authored-by: Lucas Lefèvre <lul@odoo.com>
2023-10-09 21:43:48 +00:00
Lucas Lefèvre 25eec6820b [IMP] spreadsheet: export views with contextual domain
Purpose
-------
Currently, views with a contextual filter/domain are not well managed: e.g.

Today Activities
=> domain=[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]

My pipeline
=> domain=[('user_id', '=', uid)]

Currently, 'context_today().strftime('%Y-%m-%d')' or 'uid' would be replaced by
their values when the view is inserted into a spreadsheet.
If the view is inserted on the 1st June 2023, the date "01/06/2023" is
hard-coded in the spreadsheet.

Specification
-------------
Preserve the domain dynamic parts when inserted into a spreadsheet.

Implementation note: I force the readable format at export just to be sure it
exported that way, no matter the domain origin.

closes odoo/odoo#131874

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

closes odoo/odoo#137902

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

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

closes odoo/odoo#137440

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-05 08:08:59 +00:00
Chenyun Yang dd357f2f6a [IMP] spreadsheet: mark _t function to be hidden
This commits hides a function in spreadsheet that are not supposed to be
used by end users: `_t`. It can only work with static strings in the source
code.

task 3102309

closes odoo/odoo#109863

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

closes odoo/odoo#128232

Related: odoo/enterprise#43995
Related: odoo/upgrade#4929
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-27 17:40:55 +00:00
Lucas Lefèvre (lul) 72392426ec [FIX] spreadsheet: cast currency rate date
This commit fixes two issues with the ´date´ argument for
the ODOO.CURRENCY.RATE function.

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

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

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

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

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

opw-3498115

closes odoo/odoo#136411

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

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

closes odoo/odoo#136242

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

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

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

closes odoo/odoo#135841

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

closes odoo/odoo#134457

Task: 3495200
Related: odoo/enterprise#46977
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-09-18 22:16:59 +00:00
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
Pierre Pulinckx (pipu) 038169ee9f [REF] web: simplify assets loading
In this commit, the loadXML function has been removed. We use registry with
xml_templates to load XML templates for OWL Apps.
The goal of task is to remove loadXML and getBundle from assets to simplify
the understanding of assets api.

task-3266441

closes odoo/odoo#134520

Related: odoo/enterprise#47001
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-09-07 09:00:28 +00:00
Rémi Rahir (rar) 83eaa9b37b [FIX] spreadsheet*: fix o-spreadsheet dependencies
The recent upgrade to chart.js 4.3.0 has forced us to make our own
plugin to support gauge charts. The plugin was added inside the
o-spreadsheet library which means that we now require chart.js to be
loaded before o-spreadsheet.

Notice we created a `spreadsheet.dependencies` assets bundle but
we don't include it in `spreadsheet.o_spreadsheet` bundle not do we use
it in the webclient code.

That's because `Chart.js` cannot be reloaded after the spreadsheet bundle
is loaded and the plugin was added. Reloading it after would override
`Chart.js` and remove the plugin. To prevent such situation, we
use `loadJS("/web/static/lib/Chart/Chart.js");` which is memoized. The same
call elsewhere in the code base won't actually ovewrite `Chart.js`.

closes odoo/odoo#133369

Task: 3482480
Related: odoo/enterprise#46424
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-08-31 09:04:56 +00:00
Rémi Rahir (rar) 55e08f2269 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/7be84185 [REL] 16.5.0-alpha.6
https://github.com/odoo/o-spreadsheet/commit/3523c12b [IMP] bundle: raise if owl="1" found Task: /
https://github.com/odoo/o-spreadsheet/commit/148984ec [IMP] translation: accept number placeholder value Task: /
https://github.com/odoo/o-spreadsheet/commit/c67ed02b [REV] components: prevent mouse event defaults on drag-and-drop
https://github.com/odoo/o-spreadsheet/commit/fd4bb28f [IMP] package: update Typescript to version 5.1
https://github.com/odoo/o-spreadsheet/commit/a9162e9d [IMP] package: update rollup to version 3
https://github.com/odoo/o-spreadsheet/commit/3a49640b [IMP] package: convert to ES module
https://github.com/odoo/o-spreadsheet/commit/88815a2f [REF] o-spreadsheet: remove owl="1" from the templates Task: 3470126
https://github.com/odoo/o-spreadsheet/commit/3fbf77d4 [FIX] Menu: Hide the icon slot of the menu items when absent Task: 3476424
https://github.com/odoo/o-spreadsheet/commit/49e6f84d [FIX] LineChart: Do not store window.Chart at top level Task: 3476486
https://github.com/odoo/o-spreadsheet/commit/8f9cbdd5 [FIX] demo: console error messages
https://github.com/odoo/o-spreadsheet/commit/24ca9397 [REF] functions: simplify arguments types using type Maybe<T>
https://github.com/odoo/o-spreadsheet/commit/c3facade [IMP] index: export helpers to build menus
https://github.com/odoo/o-spreadsheet/commit/781b3e8d [IMP] Spreadsheet: prevent change of props model
https://github.com/odoo/o-spreadsheet/commit/96078972 [REF] module_database: remove useless map
https://github.com/odoo/o-spreadsheet/commit/f6dcb7f8 [REM] test: remove interactive env helper

closes odoo/odoo#133576

Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-08-30 11:49:04 +00:00
Michael (mcm) 629a046e03 [IMP] web,*: empty services/core.js
This commit removes almost all exports of the module services/core.js
(only the bus is left) and adapts the module that imported it.

task 3439226

Part-of: odoo/odoo#133153
2023-08-29 11:10:47 +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
Pierre Pulinckx (pipu) c07181b20b [REF] *: Replace env._t() by _t()
In this commit, all usages of env._t() are replaced by _t().
In templates files, env._t() didn't work because terms used
in attributes where not extracted into the translation files.
Only string are exported from .xml files to translation files.
So, to make it works, we set a variable that is then used
in attributes.
For example :

<t t-set="string_to_translate">String to translate</t>
<Dialog title="string_to_translate>...</Dialog>

task-3292454

closes odoo/odoo#131390

Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-18 19:17:16 +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
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
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
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
Jorge Pinna Puissant e338487028 [REF] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:30 +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
Adrien Minne (adrm) 17d54eff72 [REF] spreadsheet: refactor insert pivot methods
The goal here is to simplify the code of the insertion of a pivot in the
pivot core plugin. Now the domain/style for each cell of the pivot is computed
in the `SpreadsheetPivotTable` class, which simplifies the plugin a lot.

Also take the opportunity to convert all `anchor` array arguments
to `{ col, row }` objects since it's the direction we've taken every
where else: `position.col` is much more readable than `anchor[0]`

closes odoo/odoo#128981

Task: 3318865
Related: odoo/enterprise#44326
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-08-08 22:41:04 +02:00
Adrien Minne (adrm) 77c758fe8b [REF] spreadsheet: define function in constants
Ths commit change the pivot/list function to defined them in a constant,
and add this constant in the function registry, rather than define the
function directly in the registry.

This allow for re-using the functions code and call it from other
functions.

Task 3318865

Part-of: odoo/odoo#128981
2023-08-08 22:41:04 +02:00
Chenyun Yang 0587f914b8 [FIX] spreadsheet: fix global filter display name
This commit fixes the bug of undefined filter display name.

A few weeks ago the property names of record when updating record selector have been modified. Previously it's `name` but now it's `display_name`. This is the root cause of the bug.

task 3453374

closes odoo/odoo#130724

Related: odoo/enterprise#45349
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-08-07 17:35:48 +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
Rmi Rahir (rar) b6f2087bf8 [IMP] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/91607311 [REL] 16.5.0-alpha.1
https://github.com/odoo/o-spreadsheet/commit/b9db2a6f [FIX] find_and_replace: update search undo/redo & add/delete header
https://github.com/odoo/o-spreadsheet/commit/c701edb0 [FIX] find_and_replace: disabled button css and shorten the debounce Task: 3432224
https://github.com/odoo/o-spreadsheet/commit/52e98921 [IMP] Demo: Add an uncaught error catcher Task: 3392372
https://github.com/odoo/o-spreadsheet/commit/5aef9dd4 [FIX] find_and_replace: show formula checkbox not updating properly
https://github.com/odoo/o-spreadsheet/commit/6ace3df7 [FIX] find_and_replace: updating the cell will update the search
https://github.com/odoo/o-spreadsheet/commit/ee0506d2 [FIX] find_and_replace: hidden cell should not be considered
https://github.com/odoo/o-spreadsheet/commit/e1f68c2b [IMP] dates: detect mm/yyyy strings as dates Task: 3413243
https://github.com/odoo/o-spreadsheet/commit/3ba2c3c0 [REL] Bump master version to 16.5.0-alpha.0
https://github.com/odoo/o-spreadsheet/commit/39a37866 [IMP] jest: update jest to 29.5.0 Task: 3047642
https://github.com/odoo/o-spreadsheet/commit/500997ef [FIX] SortPlugin: fix crash whith empty-ish cells
https://github.com/odoo/o-spreadsheet/commit/69051ea5 [FIX] *: unify to strict equality operator
https://github.com/odoo/o-spreadsheet/commit/8a9914a2 [FIX] ActionButton: update SVG icon to display current style in top bar
https://github.com/odoo/o-spreadsheet/commit/9ba05e3a [FIX] dashboard: Fixed filter icon position
https://github.com/odoo/o-spreadsheet/commit/80aec0bc [IMP] topbar: allow double clicking on paint format
https://github.com/odoo/o-spreadsheet/commit/49554975 [FIX] currency: display localized custom format preview Task: 3389619
https://github.com/odoo/o-spreadsheet/commit/87108395 [IMP] format: config default currency
https://github.com/odoo/o-spreadsheet/commit/01823df7 [IMP] menus: localize number format preview Task: 3389619
https://github.com/odoo/o-spreadsheet/commit/599003a3 [IMP] header_size: resize row based on wrapped text Task: 3240138
https://github.com/odoo/o-spreadsheet/commit/fabc8449 [REF] ui_sheet: extract getters into helpers Task: 3240138
https://github.com/odoo/o-spreadsheet/commit/f044ec98 [MOV] helpers: move text helpers to a separate file Task: 3240138
https://github.com/odoo/o-spreadsheet/commit/71cc9589 [FIX] menus: dynamically add all functions
https://github.com/odoo/o-spreadsheet/commit/bd7271e9 [IMP] pr_template: match template with commit format
https://github.com/odoo/o-spreadsheet/commit/dc81d48c [IMP] Figure: add icons to figures context menu Task: 3391903

Part-of: odoo/odoo#129782
2023-08-07 10:58:29 +02:00
Michael (mcm) 9d6b380a24 [REF] *: adapt patches after new patch function
In the commit [1], the patch has been refactored to support the
native keyword `super`. The current commit just adapts the codebase
to that change.

task 3410198

[1]: 19ea1ac08043e22a811630968e44715cc3bfc495

Part-of: odoo/odoo#125716
2023-08-02 17:29:05 +02:00
Adrien Minne (adrm) 5c37116a99 [FIX] spreadsheet: fix list context menu traceback
There was a traceback when right clicking on a spreaded cell beacause
of the list "see record" context menu item. Fixed it.

closes odoo/odoo#130289

Task: 3425493
X-original-commit: 330381dbeac9a4783d7cef8130471d81be214504
Related: odoo/enterprise#44892
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-08-02 01:15:56 +02:00
Pierre Pulinckx (pipu) 60fe2e9b17 [REF] *: remove _lt()
In a previous commit 8bfa76a, _lt() returns _t().
So, in this commit, all usages of _lt() are replaced by _t().

task-3292454

closes odoo/odoo#130179

Related: odoo/enterprise#44906
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-08-01 13:51:17 +02:00
Bastien PIERRE 65242e31e9 [IMP] *: Remove alias in JS files
Rename all imports with alias old system to the new js module system
Task ID: 3266759

closes odoo/odoo#127414

Related: odoo/design-themes#671
Related: odoo/enterprise#43716
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-07-27 11:58:34 +02:00
218ad8456a [REF] *: adapt codebase to new RelationalModel
This commit adapts the code in addons w.r.t. the introduction of
the RelationalModel.

Main changes that were requested are:
 - record datapoints no longer always have an "id" key in their
 data (they still do if the id field is in the view), so we use
 record.resId instead
 - the new model is based on fined-grained reactivity, so several
 components that previously relied on onWillUpdateProps to update
 their internal state no longer worked. Typically, using the hook
 "observeRecord" is the way to go now.
 - specialdata are no longer handled in the model, so the components
 needing specialData can use the hook "useSpecialData"
 - more generally, all overrides of models (RelationalModel or
 KanbanModel) needed to be reworked.

Part of task~3179751

Part-of: odoo/odoo#114024
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: FrancoisGe <fge@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: Pierre Rousseau <pro@odoo.com>
2023-07-24 20:17:50 +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
Mathieu Duckerts-Antoine b72791f05b [REF] web: remove unused props in TagsList
Some props like className were declared as optional in TagsList while
they are not used by the component. We remove them from the props
declaration.

Part-of: odoo/odoo#126350
2023-07-03 16:58:55 +02:00
Elisabeth Dickinson d70da05100 [FIX] spreadsheet_dashboard: fix lost margins on dropdowns
During the Milk revamp, the dropdown items in the Dashboard's header
lost their horizontal margins. These have been put back by setting a gap
property to the parent.
When in the dashboard view under Sales > Product, the dropdowns had an
awkward spacing between them despite the fix. Another fix was to set
`w-100` to the `.o_field_tags` element. And finally a `.gap-1` is also
added to the latter to give its children some space when multiple tags
are selected.

It was noticed that some CSS, specifically the `.o-filter-value` class,
was not targeting anything. This has been fixed by moving the selector
into its correct parent element.

task-3326566
part of task-3326263

closes odoo/odoo#127010

X-original-commit: bd456bc89f896de6b3d8c040706dc02ab3799e6e
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-07-01 09:52:59 +02:00