[FIX] delivery: Ensure carrier availability iteration after a fail

With a UPS delivery type carrier,
`ups_get_shipping_price_from_so` can return a `ValidationError`,
making the carrier unavailable for this order.
Nevertheless, the iteration checking the availability of the remaining
carriers must be ensured.

opw-657161
This commit is contained in:
Denis Ledoux
2015-12-10 18:28:17 +01:00
parent 35a390daf1
commit da563bcf5c
+4 -1
View File
@@ -21,7 +21,7 @@
import logging
from openerp import models, fields, api
from openerp.exceptions import UserError
from openerp.exceptions import UserError, ValidationError
_logger = logging.getLogger(__name__)
@@ -72,6 +72,9 @@ class DeliveryCarrier(models.Model):
# no suitable delivery method found, probably configuration error
_logger.info("Carrier %s: %s, not found", self.name, e.name)
self.price = 0.0
except ValidationError as e:
_logger.info("Carrier %s: %s, not available: %s", self.name, e.name, e.message)
self.price = 0.0
else:
res = super(DeliveryCarrier, self).get_price('price', [])
self.available = res[self.id]['available']