diff --git a/web_refresher/static/src/js/refresher.esm.js b/web_refresher/static/src/js/refresher.esm.js
index 60c570ad9..4a519eba5 100644
--- a/web_refresher/static/src/js/refresher.esm.js
+++ b/web_refresher/static/src/js/refresher.esm.js
@@ -6,6 +6,7 @@
import {Component} from "@odoo/owl";
import {useDebounced} from "@web/core/utils/timing";
+import {useService} from "@web/core/utils/hooks";
export function useRefreshAnimation(timeout) {
const refreshClass = "o_content__refresh";
@@ -41,6 +42,7 @@ export function useRefreshAnimation(timeout) {
export class Refresher extends Component {
setup() {
super.setup();
+ this.action = useService("action");
this.refreshAnimation = useRefreshAnimation(1000);
this.onClickRefresh = useDebounced(this.onClickRefresh, 200);
}
@@ -49,9 +51,11 @@ export class Refresher extends Component {
* @returns {Boolean}
*/
get displayButton() {
- const {searchModel, pagerProps} = this.props;
+ const {searchModel, pagerProps, refresherReport} = this.props;
const hasSearchModel = searchModel && searchModel.search;
- return Boolean(hasSearchModel || (pagerProps && pagerProps.onUpdate));
+ return Boolean(
+ refresherReport || hasSearchModel || (pagerProps && pagerProps.onUpdate)
+ );
}
/**
@@ -92,7 +96,27 @@ export class Refresher extends Component {
return updated;
}
+ /**
+ * Function to refresh the views that has not the props
+ * required by the refresher, like ir.actions.report or
+ * ir.actions.client.
+ */
+ async refreshReport() {
+ const viewAction = this.action.currentController.action;
+ const options = {};
+ if (this.env.config.breadcrumbs.length > 1) {
+ const breadcrumb = this.env.config.breadcrumbs.slice(-1);
+ await this.action.restore(breadcrumb.jsId);
+ } else {
+ options.clearBreadcrumbs = true;
+ }
+ this.action.doAction(viewAction, options);
+ }
+
async onClickRefresh() {
+ if (this.props.refresherReport) {
+ return this.refreshReport();
+ }
const updated = await this.refresh();
if (updated) {
this.refreshAnimation();
@@ -105,5 +129,6 @@ Object.assign(Refresher, {
props: {
searchModel: {type: Object, optional: true},
pagerProps: {type: Object, optional: true},
+ refresherReport: {type: Boolean, optional: true},
},
});
diff --git a/web_refresher/static/src/xml/control_panel.xml b/web_refresher/static/src/xml/control_panel.xml
index 88c1d99d4..0fb096f7c 100644
--- a/web_refresher/static/src/xml/control_panel.xml
+++ b/web_refresher/static/src/xml/control_panel.xml
@@ -13,6 +13,16 @@
+
+
+
+
+
+
+
+
+