Skip to content

Commit bf8b359

Browse files
smetlqdp-odoo
authored andcommitted
[FIX] delivery: fix bad Exception handling
When get_price() is called during tests, a ValidationError was returned but not catched correctly due to the unavailability of delivery service. Because this method is called during the creation of new sale order, it leads to some operational error (broken cursor).
1 parent 961b731 commit bf8b359

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

addons/delivery/models/delivery_carrier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def get_price(self):
120120
try:
121121
computed_price = self.get_shipping_price_from_so(order)[0]
122122
self.available = True
123-
except UserError as e:
123+
except ValidationError as e:
124124
# No suitable delivery method found, probably configuration error
125125
_logger.info("Carrier %s: %s, not found", self.name, e.name)
126126
computed_price = 0.0

0 commit comments

Comments
 (0)