Skip to content

Commit

Permalink
shopfloor_mobile_base: force nav item counter update
Browse files Browse the repository at this point in the history
  • Loading branch information
JuMiSanAr committed Dec 6, 2023
1 parent c114af4 commit 28f0700
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions shopfloor_mobile_base/static/wms/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ new Vue({
global_state_key: "",
loading: false,
loading_msg_custom: "",
loadingMenu: false,
appconfig: null,
};
_.merge(data, config_registry.generare_data_keys());
Expand Down Expand Up @@ -122,6 +123,9 @@ new Vue({
});
event_hub.$emit("app:mounted", self, false);
},
beforeUpdate: function () {
this.loadMenu(true);
},
computed: {
...config_registry.generate_computed_properties(),
app_info: function () {
Expand Down Expand Up @@ -231,9 +235,20 @@ new Vue({
"SERVICE-CTX-PROFILE-ID": this.profile.id,
},
});
return odoo.call("menu").then(function (result) {
self.appmenu = result.data;
});
if (!this.loadingMenu) {
// TODO: this is added to make sure to always have
// up-to-date counter in the navigation drawer items.
// It is not an ideal solution though, as it will be called
// whenever the component is updated (there's no easy way
// to refresh the counters only when needed,
// as each scenario has a different implementation).
// That being said, this call is very small so it's not that costly.
this.loadingMenu = true;
return odoo.call("menu").then((result) => {
self.appmenu = result.data;
this.loadingMenu = false;
});
}
},
login: function (evt, data) {
evt.preventDefault();
Expand Down

0 comments on commit 28f0700

Please sign in to comment.