stock_measuring_device: Auto-refresh zipcube wiz when measurement is done

This commit is contained in:
Matthieu Méquignon
2021-04-28 13:14:27 +02:00
committed by Hai Lang
parent 740f5bde84
commit 1e1236776e
2 changed files with 5 additions and 6 deletions

View File

@@ -28,21 +28,19 @@ odoo.define("stock_measuring_device.measuring_wizard", function(require) {
var channel = notification[0];
var message = notification[1];
if (channel === "notify_measuring_wizard_screen") {
switch (message.action) {
case "refresh":
self.measuring_wizard_bus_action_refresh(message.params);
break;
if (message.action === "refresh") {
self.measuring_wizard_bus_action_refresh(message.params);
}
}
});
},
measuring_wizard_bus_action_refresh: function(params) {
var selectedIds = this.getSelectedIds();
if (!selectedIds.length) {
if (!selectedIds.length || params.model !== this.modelName) {
return;
}
var currentId = selectedIds[0];
if (params.id === currentId && params.model === this.modelName) {
if (params.id === currentId) {
this.reload();
}
},

View File

@@ -167,6 +167,7 @@ class MeasuringWizard(models.TransientModel):
def _send_notification_refresh(self):
"""Send a refresh notification on the wizard.
Other notifications can be implemented, they have to be
added in static/src/js/measuring_wizard.js and the message
must contain an "action" and "params".