From 5317ea86b15cefc68d5dce54da9d7a61f996de5d Mon Sep 17 00:00:00 2001 From: Zahra Velasco Date: Mon, 30 Sep 2024 17:11:40 +0200 Subject: [PATCH] =?UTF-8?q?[FIX]delivery=5Fdeliverea:modificando=20etiquet?= =?UTF-8?q?a=20devoluci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- delivery_deliverea/models/delivery_carrier.py | 19 ++++++++++--------- delivery_deliverea/models/stock_picking.py | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/delivery_deliverea/models/delivery_carrier.py b/delivery_deliverea/models/delivery_carrier.py index aefb9be9a6..3dc2725107 100644 --- a/delivery_deliverea/models/delivery_carrier.py +++ b/delivery_deliverea/models/delivery_carrier.py @@ -458,15 +458,16 @@ def _deliverea_check_response(self, response): def deliverea_return_shipping(self, pickings): deliverea_request = DelivereaRequest(self) for picking in pickings: - vals = self._prepare_deliverea_order(picking) - response = deliverea_request.create_return(vals) - self._deliverea_check_response(response) - picking.write( - { - "carrier_tracking_ref": response.get("carrierReference", ""), - "deliverea_reference": response.get("delivereaReference", ""), - } - ) + if picking.picking_type_code == "incoming": + vals = self._prepare_deliverea_order(picking) + response = deliverea_request.create_return(vals) + self._deliverea_check_response(response) + picking.write( + { + "carrier_tracking_ref": response.get("carrierReference", ""), + "deliverea_reference": response.get("delivereaReference", ""), + } + ) return True def deliverea_cancel_shipment(self, pickings): diff --git a/delivery_deliverea/models/stock_picking.py b/delivery_deliverea/models/stock_picking.py index ffc42b4ab4..ae13019598 100644 --- a/delivery_deliverea/models/stock_picking.py +++ b/delivery_deliverea/models/stock_picking.py @@ -21,7 +21,7 @@ def deliverea_get_label(self): def send_to_shipper(self): self.ensure_one() - if self.delivery_type == "deliverea": + if self.delivery_type == "deliverea" and self.carrier_id.deliverea_return_label: self.carrier_id.deliverea_return_shipping(self) self.carrier_id.deliverea_get_return_label(self) return super().send_to_shipper()