[FIX] spreadsheet: reset selected datasource upon its deletion
closes odoo/odoo#140355 Task: 3551443 X-original-commit: e68f9fd312f0eeac45530920974c417db2098cb0 Related: odoo/enterprise#49866 Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com> Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit is contained in:
@@ -66,6 +66,11 @@ export class ListUIPlugin extends spreadsheet.UIPlugin {
|
||||
case "SELECT_ODOO_LIST":
|
||||
this._selectList(cmd.listId);
|
||||
break;
|
||||
case "REMOVE_ODOO_LIST":
|
||||
if (cmd.listId === this.selectedListId) {
|
||||
this.selectedListId = undefined;
|
||||
}
|
||||
break;
|
||||
case "REFRESH_ODOO_LIST":
|
||||
this._refreshOdooList(cmd.listId);
|
||||
break;
|
||||
@@ -121,6 +126,10 @@ export class ListUIPlugin extends spreadsheet.UIPlugin {
|
||||
const dataSourceId = this._getListDataSourceId(cmd.listId);
|
||||
this.dataSources.add(dataSourceId, ListDataSource, listDefinition);
|
||||
}
|
||||
|
||||
if (!this.getters.getListIds().length) {
|
||||
this.selectedListId = undefined;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,11 @@ export class PivotUIPlugin extends spreadsheet.UIPlugin {
|
||||
case "SELECT_PIVOT":
|
||||
this.selectedPivotId = cmd.pivotId;
|
||||
break;
|
||||
case "REMOVE_PIVOT":
|
||||
if (this.selectedPivotId === cmd.pivotId) {
|
||||
this.selectedPivotId = undefined;
|
||||
}
|
||||
break;
|
||||
case "REFRESH_PIVOT":
|
||||
this._refreshOdooPivot(cmd.id);
|
||||
break;
|
||||
@@ -159,6 +164,10 @@ export class PivotUIPlugin extends spreadsheet.UIPlugin {
|
||||
const dataSourceId = this.getPivotDataSourceId(cmd.pivotId);
|
||||
this.dataSources.add(dataSourceId, PivotDataSource, pivotDefinition);
|
||||
}
|
||||
|
||||
if (!this.getters.getPivotIds().length) {
|
||||
this.selectedPivotId = undefined;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user