OCA / spreadsheet

GNU Affero General Public License v3.0
46 stars 47 forks source link

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

Closed chrisandrewmann closed 1 month ago

chrisandrewmann commented 5 months ago

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

Comments welcome.

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

pedrobaeza commented 4 months ago

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

pedrobaeza commented 4 months ago

Is this ready to be reviewed?

chrisandrewmann commented 4 months ago

Yes it is.

pedrobaeza commented 4 months ago

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 commented 4 months ago

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

chrisandrewmann commented 4 months ago

@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 commented 4 months ago

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.

pedrobaeza commented 1 month ago

Incorrect rebasing it seems