Skip to content

Commit 5ef4eed

Browse files
committed
Merge PR #49 into 16.0
Signed-off-by pedrobaeza
2 parents 1db44b8 + a1d1892 commit 5ef4eed

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,25 @@ export class ActionSpreadsheetOca extends Component {
5252
this.router.pushState({spreadsheet_id: this.spreadsheetId});
5353
}
5454
}
55-
55+
/**
56+
* Clean SearchParams of conflictive keys.
57+
*
58+
* 1. Removed from context pivot conflictive keys.
59+
* 2. Removed from context graph conflictive keys.
60+
*
61+
* @returns {Object} Formated searchParams.
62+
*/
63+
cleanSearchParams() {
64+
const searchParams = this.import_data.searchParams;
65+
const context = {};
66+
for (var key of Object.keys(searchParams.context)) {
67+
if (key.startsWith("pivot_") || key.startsWith("graph_")) {
68+
continue;
69+
}
70+
context[key] = searchParams.context[key];
71+
}
72+
return {...searchParams, context};
73+
}
5674
async importDataGraph(spreadsheet_model) {
5775
var sheetId = spreadsheet_model.getters.getActiveSheetId();
5876
var y = 0;
@@ -78,7 +96,7 @@ export class ActionSpreadsheetOca extends Component {
7896
background: "#FFFFFF",
7997
stacked: this.import_data.metaData.stacked,
8098
metaData: this.import_data.metaData,
81-
searchParams: this.import_data.searchParams,
99+
searchParams: this.cleanSearchParams(),
82100
dataSourceId: dataSourceId,
83101
legendPosition: "top",
84102
verticalAxisPosition: "left",
@@ -187,7 +205,7 @@ export class ActionSpreadsheetOca extends Component {
187205
resModel: this.import_data.metaData.resModel,
188206
sortedColumn: this.import_data.metaData.sortedColumn,
189207
},
190-
searchParams: this.import_data.searchParams,
208+
searchParams: this.cleanSearchParams(),
191209
name: this.import_data.name,
192210
};
193211
const dataSource = spreadsheet_model.config.dataSources.add(

0 commit comments

Comments
 (0)