Comment 0 for bug 1238951

Lines 83-92 in stock_tracking.py:

  magento_picking_id = picking.magento_id
        if magento_picking_id is None:
            raise NoExternalId("No value found for the picking ID on "
                               "Magento side, the job will be retried later.")

        self._validate(picking)
        self._check_allowed_carrier(picking, magento_picking_id)
        tracking_args = self._get_tracking_args(picking)
        self.backend_adapter.add_tracking_number(magento_picking_id,
                                                 *tracking_args)

The call to _check_allowed_carrier hits the getCarrier API endpoint in Magento, which expects the increment id of the magento sale, rather than the delivery object. The add_tracking_number call seems correct in this case.