Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] spreadsheet_oca: Add ability to delete pivots and lists via button, set name on new pivots #34

Closed
wants to merge 45 commits into from

Conversation

chrisandrewmann
Copy link
Contributor

@chrisandrewmann chrisandrewmann commented Jun 3, 2024

Currently there is no way to delete pivots or lists in the GUI after creation. Pivots are also created with name "undefined".

  • I added a button and relevant methods to delete, but couldn't find a way to programmatically close the sidepanel without causing it to crash due to OWL lifecycle error, when using closeSidePanel()
    Only solution I found was to force the "filter" sidebar to load in place after deletion of pivot /list using: this.env.openSidePanel("FilterPanel", {});
    Otherwise it works, but maybe someone with more OWL knowledge can improve.

  • Also added a name for newly created pivots, using the title.

Comments welcome.

Future note: I noticed that community is missing a way to rename Pivots, something Enterprise has. Maybe good for future?

@pedrobaeza
Copy link
Member

Please rebase instead of doing pull for avoiding merge commits here in the PR.

@chrisandrewmann chrisandrewmann force-pushed the 16.0 branch 2 times, most recently from fb1d611 to 0671a14 Compare June 24, 2024 14:38
@pedrobaeza pedrobaeza added this to the 16.0 milestone Jun 24, 2024
@pedrobaeza
Copy link
Member

Is this ready to be reviewed?

@chrisandrewmann
Copy link
Contributor Author

Yes it is.

@pedrobaeza
Copy link
Member

Trying on runboat, I get this error trying to add a pivot to an spreadsheet:

OwlError: The following error occurred in onWillStart: "subTreeKeys.forEach is not a function"
    OwlError@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:16490:5 (/web/static/lib/owl/owl.js:87)
    wrapError@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:19008:23 (/web/static/lib/owl/owl.js:2605)
    onWillStart@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:19051:29 (/web/static/lib/owl/owl.js:2648)
    setup@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:53565:20 (/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_renderer.esm.js:92)
    ComponentNode@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18760:28 (/web/static/lib/owl/owl.js:2357)
    createComponent/<@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:22172:28 (/web/static/lib/owl/owl.js:5769)
    template@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js line 21943 > Function:16:21 (/web/static/lib/owl/owl.js:5540)
    _render@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18125:38 (/web/static/lib/owl/owl.js:1722)
    render@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18117:18 (/web/static/lib/owl/owl.js:1714)
    initiateRender@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18782:23 (/web/static/lib/owl/owl.js:2379)

Caused by: TypeError: subTreeKeys.forEach is not a function
    _getSpreadsheetRows@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:51191:21 (/spreadsheet/static/src/pivot/pivot_model.js:589)
    getTableStructure@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:50983:27 (/spreadsheet/static/src/pivot/pivot_model.js:381)
    getTableStructure@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:50234:28 (/spreadsheet/static/src/pivot/pivot_data_source.js:121)
    importDataPivot@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:53871:51 (/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js:196)

@chrisandrewmann
Copy link
Contributor Author

Trying on runboat, I get this error trying to add a pivot to an spreadsheet:

OwlError: The following error occurred in onWillStart: "subTreeKeys.forEach is not a function"
    OwlError@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:16490:5 (/web/static/lib/owl/owl.js:87)
    wrapError@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:19008:23 (/web/static/lib/owl/owl.js:2605)
    onWillStart@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:19051:29 (/web/static/lib/owl/owl.js:2648)
    setup@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:53565:20 (/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_renderer.esm.js:92)
    ComponentNode@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18760:28 (/web/static/lib/owl/owl.js:2357)
    createComponent/<@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:22172:28 (/web/static/lib/owl/owl.js:5769)
    template@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js line 21943 > Function:16:21 (/web/static/lib/owl/owl.js:5540)
    _render@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18125:38 (/web/static/lib/owl/owl.js:1722)
    render@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18117:18 (/web/static/lib/owl/owl.js:1714)
    initiateRender@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/web.assets_common.js:18782:23 (/web/static/lib/owl/owl.js:2379)

Caused by: TypeError: subTreeKeys.forEach is not a function
    _getSpreadsheetRows@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:51191:21 (/spreadsheet/static/src/pivot/pivot_model.js:589)
    getTableStructure@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:50983:27 (/spreadsheet/static/src/pivot/pivot_model.js:381)
    getTableStructure@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:50234:28 (/spreadsheet/static/src/pivot/pivot_data_source.js:121)
    importDataPivot@http://oca-spreadsheet-16-0-pr34-0671a140d9e4.runboat.odoo-community.org/web/assets/debug/spreadsheet.o_spreadsheet.js:53871:51 (/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js:196)

Strange, just tried it and can't reproduce on Runboat. Maybe try again and clear cache as I rebased and force pushed

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a problem of my Firefox browser. Trying on Chrome, it's working. Tried the new option. It works, although the cells get with #ERROR after deleting the pivot. Shouldn't they be emptied?

@pedrobaeza pedrobaeza requested a review from etobella June 25, 2024 07:30
@chrisandrewmann
Copy link
Contributor Author

chrisandrewmann commented Jun 25, 2024

@pedrobaeza
OK I'll test in Firefox too.
Regards deleting the cells, I'm not sure how to but figured it's not bad to leave them in place for manual deletion as it behaves the same as enterprise when deleting.

@chrisandrewmann
Copy link
Contributor Author

chrisandrewmann commented Jun 25, 2024

Have tested in Firefox locally with no issues. Just rebased again as automated translations meant it was behind again.

Also i've made a small amendment by setting the Pivot name, otherwise it was "Undefined" which makes no sense as it's hard to identify them apart.

@chrisandrewmann chrisandrewmann changed the title [IMP] spreadsheet_oca: Add ability to delete pivots and lists via button [IMP] spreadsheet_oca: Add ability to delete pivots and lists via button, set name on new pivots Jun 25, 2024
CarlosRoca13 and others added 12 commits September 25, 2024 14:59
When adding a pivot table to a spreadsheet, it
does not maintain the specified order because the
sortedColumn option is not being completed.

Steps to reproduce the issue:

1. Go to a pivot table
2. Change the default order
3. Add to the spreadsheet

The added table will not have preserved the order.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/
The error is happening because the dashboard where
the data has to be added is not being showed.

With this changes the field to define the
dashboard is required and is showed.

Added a way to limit the search to the dashboards
that can be edited
On dashboards exists tables that are updated dynamically,
with this changes we have the option to generate this
dynamic tables using the pivot inserter.

Added a button to duplicate and change to dynamic
table the selected table on spreadsheet editor.

If a table with multiple row goups generated, the
way to generate the dynamic table will be set the
number of rows for each level of indentation.

Example:
2 rowGroupBys
3 number of rows
- val1
    - subval1.1
    - subval1.2
    - subval1.3
- val2
    - subval2.1
    - subval2.2
    - subval2.3
- val3
    - subval3.1
    - subval3.2
    - subval3.3
Since this changes the field datasource_name does not work with
tree and graph. Now the datasource_name is set as data name for the
created data.

Furthermore, the capability to create dynamic tables has no sense on
tree and graph, so it has been limited for pivots.
mymage and others added 28 commits September 25, 2024 15:00
Currently translated at 100.0% (16 of 16 strings)

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_dashboard_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_dashboard_oca/it/
Currently translated at 100.0% (95 of 95 strings)

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/it/
Currently translated at 100.0% (16 of 16 strings)

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_dashboard_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_dashboard_oca/pt/
Currently translated at 100.0% (95 of 95 strings)

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/pt/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/
With these changes, we have added the ability to make the columns
dynamic, just as is done with the rows.

To add this type of table, we will need to select the dynamic columns
option and choose the number of columns to insert. Keep in mind that if
multiple column levels are selected, the chosen number will apply to
each of these levels.

In addition to this, the wizard that opens with the spreadsheet button
has been updated to allow us to choose the type of dynamism we expect in
the inserted table.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/
Currently translated at 100.0% (99 of 99 strings)

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/it/
Currently translated at 63.6% (63 of 99 strings)

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/fr/
If any module males a primary template from the ones where the button is
added, the button wasn't be shown previously.

That's because the inheritance and load order works in OWL. The way to
fix this is to make this load order deterministic specifying to be
loaded after the corresponding template for being taken into account for
primary views. This also required to split the templates file into
several ones.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/
Steps to reproduce the error:

1. Go to a pivot
2. Remove all groups of columns to set only the measure
3. Add the pivot to a spreadsheet with dynamic columns and a number of columns

An error will be thrown
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/
Currently translated at 100.0% (101 of 101 strings)

Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/it/
@pedrobaeza
Copy link
Member

Incorrect rebasing it seems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants