Merge PR #2889 into 16.0

Signed-off-by pedrobaeza
pull/2891/head
OCA-git-bot 2024-07-23 08:23:12 +00:00
commit e99023910a
4 changed files with 23 additions and 16 deletions

View File

@ -12,16 +12,23 @@ ControlPanel.components = Object.assign({}, ControlPanel.components, {
Refresher,
});
/**
* @property {String[]} forbiddenSubTypes
* @property {Object<String, *>} refresherProps
*/
patch(ControlPanel.prototype, "web_refresher.ControlPanel", {
setup() {
this._super(...arguments);
const {config, searchModel} = this.env;
const forbiddenSubType = ["base_settings"];
if (!forbiddenSubType.includes(config.viewSubType)) {
this.refresherProps = {
searchModel: searchModel,
pagerProps: this.pagerProps,
};
}
this.forbiddenSubTypes = ["base_settings"];
this.refresherProps = {
searchModel: this.env.searchModel,
pagerProps: this.pagerProps,
};
},
/**
* @returns {Boolean}
*/
get displayRefresher() {
return !this.forbiddenSubTypes.includes(this.env.config.viewSubType);
},
});

View File

@ -89,9 +89,9 @@ export class Refresher extends Component {
* @returns {Promise<Boolean>}
*/
async refresh() {
let updated = this._searchModelRefresh();
let updated = await this._pagerRefresh();
if (!updated) {
updated = await this._pagerRefresh();
updated = this._searchModelRefresh();
}
return updated;
}

View File

@ -10,7 +10,7 @@
>
<xpath expr="//div[hasclass('o_cp_pager')]" position="before">
<div class="oe_cp_refresher" role="search" t-ref="refresher">
<Refresher t-props="refresherProps" />
<Refresher t-if="displayRefresher" t-props="refresherProps" />
</div>
</xpath>
<xpath expr="//div[hasclass('o_cp_bottom_right')]" position="before">
@ -19,7 +19,7 @@
class="o_cp_bottom_right d-flex flex-row-reverse"
>
<div class="oe_cp_refresher" role="search" t-ref="refresher">
<Refresher refresherReport="true" />
<Refresher t-if="displayRefresher" refresherReport="true" />
</div>
</div>
</xpath>
@ -32,7 +32,7 @@
>
<xpath expr="//div[hasclass('o_cp_pager')]" position="before">
<div class="oe_cp_refresher" role="search" t-ref="refresher">
<Refresher t-props="refresherProps" />
<Refresher t-if="displayRefresher" t-props="refresherProps" />
</div>
</xpath>
<xpath expr="//div[hasclass('o_cp_bottom_right')]" position="before">
@ -41,7 +41,7 @@
class="o_cp_bottom_right d-flex flex-row-reverse"
>
<div class="oe_cp_refresher" role="search" t-ref="refresher">
<Refresher refresherReport="true" />
<Refresher t-if="displayRefresher" refresherReport="true" />
</div>
</div>
</xpath>

View File

@ -10,7 +10,7 @@
>
<xpath expr="//div[hasclass('o_cp_pager')]" position="before">
<div class="oe_cp_refresher" role="search" t-ref="refresher">
<Refresher t-props="refresherProps" />
<Refresher t-if="displayRefresher" t-props="refresherProps" />
</div>
</xpath>
<xpath expr="//div[hasclass('o_cp_bottom_right')]" position="before">
@ -19,7 +19,7 @@
class="o_cp_bottom_right d-flex flex-row-reverse"
>
<div class="oe_cp_refresher" role="search" t-ref="refresher">
<Refresher refresherReport="true" />
<Refresher t-if="displayRefresher" refresherReport="true" />
</div>
</div>
</xpath>