(self)
Toggle between holding and releasing the DHL Parcel shipment
Toggle between holding and releasing the DHL Parcel shipment
Toggle between holding and releasing the DHL Parcel shipment
def dhl_parcel_toggle_hold_shipment(self):
        """Toggle between holding and releasing the DHL Parcel shipment"""
        self.ensure_one()
        tracking_ref = self.carrier_tracking_ref
        if self.delivery_type != "dhl_parcel" or not tracking_ref:
            return
        message = ""
        carrier = self.carrier_id
        if self.dhl_parcel_shipment_held:
            self.dhl_parcel_shipment_held = not carrier.dhl_parcel_release_shipment(
                tracking_ref
            )
            message = _("Released shipment for {}").format(tracking_ref)
        else:
            self.dhl_parcel_shipment_held = carrier.dhl_parcel_hold_shipment(
                tracking_ref
            )
            message = _("Held shipment for {}").format(tracking_ref)
        self.message_post(body=message)
def dhl_parcel_toggle_hold_shipment ( self ) : self . ensure_one ( ) tracking_ref = self . carrier_tracking_ref if self . delivery_type != "dhl_parcel" or not tracking_ref : return message = "" carrier = self . carrier_id if self . dhl_parcel_shipment_held : self . dhl_parcel_shipment_held = not carrier . dhl_parcel_release_shipment ( tracking_ref ) message = _ ( "Released shipment for {}" ) . format ( tracking_ref ) else : self . dhl_parcel_shipment_held = carrier . dhl_parcel_hold_shipment ( tracking_ref ) message = _ ( "Held shipment for {}" ) . format ( tracking_ref ) self . message_post ( body = message )