(self, label_format="pdf")
return label
Get DHL Parcel Label for this picking expedition
Get DHL Parcel Label for this picking expedition
Get DHL Parcel Label for this picking expedition
def dhl_parcel_get_label(self, label_format="pdf"):
        """Get DHL Parcel Label for this picking expedition"""
        self.ensure_one()
        tracking_ref = self.carrier_tracking_ref
        if self.delivery_type != "dhl_parcel" or not tracking_ref:
            return
        label = base64.b64decode(
            self.carrier_id.dhl_parcel_get_label(
                tracking_ref, label_format=label_format
            )
        )
        label_name = "dhl_parcel_{}.{}".format(
            tracking_ref, "txt" if label_format == "zpl" else "pdf"
        )
        self.message_post(
            body=(_("DHL Parcel label for %s") % tracking_ref),
            attachments=[(label_name, label)],
        )
        # We return label in case it wants to be printed in an inheritance
        return label
def dhl_parcel_get_label ( self , label_format = "pdf" ) : self . ensure_one ( ) tracking_ref = self . carrier_tracking_ref if self . delivery_type != "dhl_parcel" or not tracking_ref : return label = base64 . b64decode ( self . carrier_id . dhl_parcel_get_label ( tracking_ref , label_format = label_format ) ) label_name = "dhl_parcel_{}.{}" . format ( tracking_ref , "txt" if label_format == "zpl" else "pdf" ) self . message_post ( body = ( _ ( "DHL Parcel label for %s" ) % tracking_ref ) , attachments = [ ( label_name , label ) ] , ) # We return label in case it wants to be printed in an inheritance return label