From afddb1fcebfd0b2ae612b13ce63ddf0ee94be408 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Mon, 26 Oct 2020 08:17:11 +0100 Subject: [PATCH] Fix error with message being a dict, not str Traceback (most recent call last): File "/odoo/external-src/wms-shopfloor/setup/shopfloor/odoo/addons/shopfloor/services/service.py", line 69, in _dispatch_with_db_logging result = super().dispatch(method_name, _id=_id, params=params) File "/odoo/external-src/rest-framework/setup/base_rest/odoo/addons/base_rest/components/service.py", line 199, in dispatch res = func(**secure_params) File "/odoo/external-src/wms-shopfloor/setup/shopfloor/odoo/addons/shopfloor/services/delivery.py", line 123, in scan_deliver return self._deliver_package(picking, package) File "/odoo/external-src/wms-shopfloor/setup/shopfloor/odoo/addons/shopfloor/services/delivery.py", line 170, in _deliver_package message, TypeError: sequence item 1: expected str instance, dict found The result of _check_picking_status is the full dict for a message (message_type, body), so we have to update its body. --- shopfloor/services/delivery.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shopfloor/services/delivery.py b/shopfloor/services/delivery.py index 74cf09bce6..476d97073a 100644 --- a/shopfloor/services/delivery.py +++ b/shopfloor/services/delivery.py @@ -164,12 +164,12 @@ def _deliver_package(self, picking, package): # State of the picking might change while we reach this point: check again! message = self._check_picking_status(lines.mapped("picking_id")) if message: - message = "\n".join( + message["body"] = "\n".join( [ _("Package {} belongs to a picking without a valid state.").format( package.name ), - message, + message["body"], ] ) return self._response_for_deliver(message=message) @@ -228,12 +228,12 @@ def _deliver_product(self, picking, product): # State of the picking might change while we reach this point: check again! message = self._check_picking_status(lines.mapped("picking_id")) if message: - message = "\n".join( + message["body"] = "\n".join( [ _("Product {} belongs to a picking without a valid state.").format( product.name ), - message, + message["body"], ] ) return self._response_for_deliver(message=message) @@ -277,12 +277,12 @@ def _deliver_lot(self, picking, lot): # State of the picking might change while we reach this point: check again! message = self._check_picking_status(lines.mapped("picking_id")) if message: - message = "\n".join( + message["body"] = "\n".join( [ _("Lot {} belongs to a picking without a valid state.").format( lot.name ), - message, + message["body"], ] ) return self._response_for_deliver(message=message)