mirror of https://github.com/OCA/web.git
commit
4d3274a42a
|
@ -7,7 +7,7 @@ Web Refresher
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:88fce35323996a71b86623ff97b9a099bd381b6c37a3cb2ca6ba41179c04926d
|
!! source digest: sha256:f8d8ed8f9762830a5153097507a407ee9523c05093d1b424ae19dc30ccef9486
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"assets": {
|
"assets": {
|
||||||
"web.assets_backend": [
|
"web.assets_backend": [
|
||||||
"web_refresher/static/src/scss/refresher.scss",
|
"web_refresher/static/src/scss/refresher.scss",
|
||||||
|
"web_refresher/static/src/js/client_action_adapter.esm.js",
|
||||||
"web_refresher/static/src/js/refresher.esm.js",
|
"web_refresher/static/src/js/refresher.esm.js",
|
||||||
"web_refresher/static/src/js/control_panel.esm.js",
|
"web_refresher/static/src/js/control_panel.esm.js",
|
||||||
],
|
],
|
||||||
|
|
|
@ -367,7 +367,7 @@ ul.auto-toc {
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:88fce35323996a71b86623ff97b9a099bd381b6c37a3cb2ca6ba41179c04926d
|
!! source digest: sha256:f8d8ed8f9762830a5153097507a407ee9523c05093d1b424ae19dc30ccef9486
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/15.0/web_refresher"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_refresher"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/15.0/web_refresher"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_refresher"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>Adds a button next to the pager (in trees/kanban views) to refresh the displayed list.</p>
|
<p>Adds a button next to the pager (in trees/kanban views) to refresh the displayed list.</p>
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
/* Copyright 2024 Tecnativa - Carlos Roca
|
||||||
|
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||||
|
import {ClientActionAdapter} from "@web/legacy/action_adapters";
|
||||||
|
import Context from "web.Context";
|
||||||
|
import {mapDoActionOptionAPI} from "@web/legacy/backend_utils";
|
||||||
|
import {patch} from "@web/core/utils/patch";
|
||||||
|
import {wrapSuccessOrFail} from "@web/legacy/utils";
|
||||||
|
|
||||||
|
patch(ClientActionAdapter.prototype, "web_refresher.ClientActionAdapter", {
|
||||||
|
_trigger_up(ev) {
|
||||||
|
const payload = ev.data;
|
||||||
|
if (ev.name === "refresh_report") {
|
||||||
|
this.actionService.restore(payload.controllerID).then(() => {
|
||||||
|
if (payload.action.context) {
|
||||||
|
payload.action.context = new Context(payload.action.context).eval();
|
||||||
|
}
|
||||||
|
const legacyOptions = mapDoActionOptionAPI(payload.options);
|
||||||
|
wrapSuccessOrFail(
|
||||||
|
this.actionService.doAction(payload.action, legacyOptions),
|
||||||
|
payload
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this._super(...arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
|
@ -1,15 +1,28 @@
|
||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
/* Copyright 2022 Tecnativa - Alexandre D. Díaz
|
/* Copyright 2022 Tecnativa - Alexandre D. Díaz
|
||||||
* Copyright 2022 Tecnativa - Carlos Roca
|
* Copyright 2022-2024 Tecnativa - Carlos Roca
|
||||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||||
|
|
||||||
const {Component} = owl;
|
const {Component} = owl;
|
||||||
|
|
||||||
export class Refresher extends Component {
|
export class Refresher extends Component {
|
||||||
_doRefresh() {
|
_doRefresh() {
|
||||||
|
// Allow refresh reports
|
||||||
|
if (["ir.actions.report", "ir.actions.client"].includes(this.env.action.type)) {
|
||||||
|
const options = {};
|
||||||
|
const breadcrumbs = this.__owl__.parent.props.breadcrumbs;
|
||||||
|
if (breadcrumbs.length) {
|
||||||
|
return this.trigger("refresh-report", {
|
||||||
|
action: this.env.action,
|
||||||
|
controllerID: breadcrumbs.slice(-1).controllerID,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
options.clear_breadcrumbs = true;
|
||||||
|
return this.trigger("do-action", {action: this.env.action, options});
|
||||||
|
}
|
||||||
// Note: here we use the pager props, see xml
|
// Note: here we use the pager props, see xml
|
||||||
const {limit, currentMinimum} = this.props;
|
const {limit, currentMinimum} = this.props;
|
||||||
this.trigger("pager-changed", {currentMinimum, limit});
|
return this.trigger("pager-changed", {currentMinimum, limit});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue