[IMP] spreadsheet: store pivot table structure

There's no need to recompute the table structure
every time. The pivot model is never mutated, we can safely
store the table.

closes odoo/odoo#138594

Related: odoo/enterprise#48910
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit is contained in:
Lucas Lefèvre (lul)
2023-10-20 14:59:19 +00:00
parent d1313ff85e
commit 68ff6fe9ce
@@ -376,10 +376,18 @@ export class SpreadsheetPivotModel extends PivotModel {
return domains ? domains[0] : Domain.FALSE.toList();
}
getTableStructure() {
if (this._tableStructure === undefined) {
// lazy build the structure
this._tableStructure = this._buildTableStructure();
}
return this._tableStructure;
}
/**
* @returns {SpreadsheetPivotTable}
*/
getTableStructure() {
_buildTableStructure() {
const cols = this._getSpreadsheetCols();
const rows = this._getSpreadsheetRows(this.data.rowGroupTree);
rows.push(rows.shift()); //Put the Total row at the end.