Skip to content

Commit

Permalink
[IMP] spreadsheet_oca: Add ability to delete pivots and lists via button
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisandrewmann committed Jun 24, 2024
1 parent 2e1c759 commit 0671a14
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ export class PivotPanelDisplay extends Component {
});
this.env.model.dispatch("REFRESH_PIVOT", {id: this.props.pivotId});
}
deletePivot() {
this.env.askConfirmation(
_t("Are you sure you want to delete this pivot ?"),
() => {
this.env.model.dispatch("REMOVE_PIVOT", {pivotId: this.props.pivotId});
this.env.openSidePanel("FilterPanel", {});
}
);
}
}

PivotPanelDisplay.template = "spreadsheet_oca.PivotPanelDisplay";
Expand Down Expand Up @@ -186,6 +195,17 @@ export class ListPanelDisplay extends Component {
domain: new Domain(domain).toList(),
});
}
deleteList() {
this.env.askConfirmation(
_t("Are you sure you want to delete this list ?"),
() => {
this.env.model.dispatch("REMOVE_ODOO_LIST", {
listId: this.props.listId,
});
this.env.openSidePanel("FilterPanel", {});
}
);
}
}

ListPanelDisplay.template = "spreadsheet_oca.ListPanelDisplay";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@
<div class="o_spreadsheet_oca_pivot_panel_info">
Last updated at <t t-esc="lastUpdate" />
</div>
<div class="o_spreadsheet_oca_datasource_panel_field">
<div class="o-SidePanelButtons">
<button
t-on-click="insertPivot"
class="btn btn-info"
>Insert pivot</button>
<button t-on-click="deletePivot" class="btn btn-danger">Delete</button>
</div>
</div>

Expand Down Expand Up @@ -113,6 +114,9 @@
<div class="o_spreadsheet_oca_pivot_panel_info">
Last updated at <t t-esc="lastUpdate" />
</div>
<div class="o-SidePanelButtons">
<button t-on-click="deleteList" class="btn btn-danger">Delete</button>
</div>
</div>

</t>
Expand Down

0 comments on commit 0671a14

Please sign in to comment.