Skip to content

Commit

Permalink
Merge pull request #1216 from OCA/15.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/web (15.0)
  • Loading branch information
bt-admin authored Feb 9, 2024
2 parents 3e61517 + 44e18eb commit eeaad15
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ addon | version | maintainers | summary
[web_notify](web_notify/) | 15.0.1.1.0 | | Send notification messages to user
[web_pivot_computed_measure](web_pivot_computed_measure/) | 15.0.1.0.3 | | Web Pivot Computed Measure
[web_pwa_oca](web_pwa_oca/) | 15.0.1.0.0 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Make Odoo a PWA
[web_refresher](web_refresher/) | 15.0.2.0.0 | | Web Refresher
[web_refresher](web_refresher/) | 15.0.2.0.1 | | Web Refresher
[web_remember_tree_column_width](web_remember_tree_column_width/) | 15.0.1.0.1 | [![frahikLV](https://github.com/frahikLV.png?size=30px)](https://github.com/frahikLV) [![luisg123v](https://github.com/luisg123v.png?size=30px)](https://github.com/luisg123v) | Remember the tree columns' widths across sessions.
[web_responsive](web_responsive/) | 15.0.1.1.12 | [![Yajo](https://github.com/Yajo.png?size=30px)](https://github.com/Yajo) [![Tardo](https://github.com/Tardo.png?size=30px)](https://github.com/Tardo) [![SplashS](https://github.com/SplashS.png?size=30px)](https://github.com/SplashS) | Responsive web client, community-supported
[web_search_with_and](web_search_with_and/) | 15.0.1.0.2 | | Use AND conditions on omnibar search
Expand Down
2 changes: 1 addition & 1 deletion web_refresher/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Web Refresher
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:88fce35323996a71b86623ff97b9a099bd381b6c37a3cb2ca6ba41179c04926d
!! source digest: sha256:5860a7342143843bc06026fa0c7bf845ca54226a000717248122ffd62df6c88c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
3 changes: 2 additions & 1 deletion web_refresher/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Web Refresher",
"version": "15.0.2.0.0",
"version": "15.0.2.0.1",
"author": "Compassion Switzerland, Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/web",
Expand All @@ -10,6 +10,7 @@
"assets": {
"web.assets_backend": [
"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/control_panel.esm.js",
],
Expand Down
3 changes: 1 addition & 2 deletions web_refresher/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down Expand Up @@ -367,7 +366,7 @@ <h1 class="title">Web Refresher</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:88fce35323996a71b86623ff97b9a099bd381b6c37a3cb2ca6ba41179c04926d
!! source digest: sha256:5860a7342143843bc06026fa0c7bf845ca54226a000717248122ffd62df6c88c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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&amp;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>
Expand Down
28 changes: 28 additions & 0 deletions web_refresher/static/src/js/client_action_adapter.esm.js
Original file line number Diff line number Diff line change
@@ -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);
}
},
});
17 changes: 15 additions & 2 deletions web_refresher/static/src/js/refresher.esm.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
/** @odoo-module **/
/* 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). */

const {Component} = owl;

export class Refresher extends Component {
_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
const {limit, currentMinimum} = this.props;
this.trigger("pager-changed", {currentMinimum, limit});
return this.trigger("pager-changed", {currentMinimum, limit});
}
}

Expand Down

0 comments on commit eeaad15

Please sign in to comment.