(self, pickings)
Cancel the expedition
Cancel the expedition
Cancel the expedition
def dhl_parcel_cancel_shipment(self, pickings):
        """Cancel the expedition"""
        dhl_parcel_request = DhlParcelRequest(self)
        for picking in pickings.filtered("carrier_tracking_ref"):
            response = dhl_parcel_request.cancel_shipment(picking.carrier_tracking_ref)
            if not response:
                msg = _(
                    "DHL Parcel Cancellation failed with reason: %s"
                ) % response.get("Message", "Connection Error")
                picking.message_post(body=msg)
                continue
            picking.carrier_tracking_ref = False
            picking.message_post(
                body=_("DHL Parcel Expedition with reference %s cancelled")
                % picking.carrier_tracking_ref
            )
def dhl_parcel_cancel_shipment ( self , pickings ) : dhl_parcel_request = DhlParcelRequest ( self ) for picking in pickings . filtered ( "carrier_tracking_ref" ) : response = dhl_parcel_request . cancel_shipment ( picking . carrier_tracking_ref ) if not response : msg = _ ( "DHL Parcel Cancellation failed with reason: %s" ) % response . get ( "Message" , "Connection Error" ) picking . message_post ( body = msg ) continue picking . carrier_tracking_ref = False picking . message_post ( body = _ ( "DHL Parcel Expedition with reference %s cancelled" ) % picking . carrier_tracking_ref )