(self, picking)
Tracking state update
Tracking state update
Tracking state update
def dhl_parcel_tracking_state_update(self, picking):
        """Tracking state update"""
        self.ensure_one()
        if not picking.carrier_tracking_ref:
            return
        dhl_parcel_request = DhlParcelRequest(self)
        tracking_events = dhl_parcel_request.track_shipment(
            picking.carrier_tracking_ref, "events"
        )
        if not tracking_events:
            return
        picking.tracking_state_history = "\n".join(
            [
                "{} {} - [{}] {}".format(
                    t.get("DateTime"),
                    t.get("Ubication"),
                    t.get("Code"),
                    t.get("Status"),
                )
                for t in tracking_events
            ]
        )
        tracking = tracking_events.pop()
        picking.tracking_state = "[{}] {}".format(
            tracking.get("Code"), tracking.get("Status")
        )
        picking.delivery_state = DHL_PARCEL_DELIVERY_STATES_STATIC.get(
            tracking.get("Code"), "incidence"
        )
def dhl_parcel_tracking_state_update ( self , picking ) : self . ensure_one ( ) if not picking . carrier_tracking_ref : return dhl_parcel_request = DhlParcelRequest ( self ) tracking_events = dhl_parcel_request . track_shipment ( picking . carrier_tracking_ref , "events" ) if not tracking_events : return picking . tracking_state_history = "\n" . join ( [ "{} {} - [{}] {}" . format ( t . get ( "DateTime" ) , t . get ( "Ubication" ) , t . get ( "Code" ) , t . get ( "Status" ) , ) for t in tracking_events ] ) tracking = tracking_events . pop ( ) picking . tracking_state = "[{}] {}" . format ( tracking . get ( "Code" ) , tracking . get ( "Status" ) ) picking . delivery_state = DHL_PARCEL_DELIVERY_STATES_STATIC . get ( tracking . get ( "Code" ) , "incidence" )