Putaway: show rainbow man when all the lines are putaway

This commit is contained in:
Guewen Baconnier
2020-07-03 10:28:13 +02:00
parent c16a5e308b
commit 3f68e5caaf
4 changed files with 22 additions and 18 deletions

View File

@@ -4,7 +4,7 @@
import logging
from collections import namedtuple
from odoo import api, fields, models
from odoo import _, api, fields, models
from odoo.addons.base_sparse_field.models.fields import Serialized
@@ -244,6 +244,18 @@ class VerticalLiftOperationBase(models.AbstractModel):
)
return sum(quants.mapped("quantity"))
def _rainbow_man(self, message=None):
if not message:
message = _("Congrats, you cleared the queue!")
return {
"effect": {
"fadeout": "slow",
"message": message,
"img_url": "/web/static/src/img/smile.svg",
"type": "rainbow_man",
}
}
def _send_notification_refresh(self):
"""Send a refresh notification

View File

@@ -1,7 +1,7 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.tools import float_compare
from odoo.addons.base_sparse_field.models.fields import Serialized
@@ -265,11 +265,4 @@ class VerticalLiftOperationInventory(models.Model):
self.next_step()
if self.step() == "noop":
# sorry not sorry
return {
"effect": {
"fadeout": "slow",
"message": _("Congrats, you cleared the queue!"),
"img_url": "/web/static/src/img/smile.svg",
"type": "rainbow_man",
}
}
return self._rainbow_man()

View File

@@ -83,11 +83,4 @@ class VerticalLiftOperationPick(models.Model):
super().button_release()
if self.step() == "noop":
# sorry not sorry
return {
"effect": {
"fadeout": "slow",
"message": _("Congrats, you cleared the queue!"),
"img_url": "/web/static/src/img/smile.svg",
"type": "rainbow_man",
}
}
return self._rainbow_man()

View File

@@ -170,3 +170,9 @@ class VerticalLiftOperationPut(models.Model):
def fetch_tray(self):
self.current_move_line_id.fetch_vertical_lift_tray_dest()
def button_release(self):
super().button_release()
if self.count_move_lines_to_do_all() == 0:
# sorry not sorry
return self._rainbow_man()