Skip to content
Snippets Groups Projects
Commit d448849b authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] delivery: Error message for unavailable delivery methods

With a fixed price delivery method, the error message was not displayed when
the address doesn't match.

Inspired from function base_on_rule_rate_shipment

The error message was not clear enough.

opw:1879204
parent 5700f960
No related branches found
No related tags found
No related merge requests found
......@@ -355,6 +355,13 @@ msgstr ""
msgid "Error: no matching grid."
msgstr ""
#. module: delivery
#: code:addons/delivery/models/delivery_carrier.py:206
#: code:addons/delivery/models/delivery_grid.py:50
#, python-format
msgid "Error: this delivery method is not available for this address."
msgstr ""
#. module: delivery
#: model:ir.model.fields,field_description:delivery.field_sale_order_delivery_price
msgid "Estimated Delivery Price"
......
......@@ -199,6 +199,12 @@ class DeliveryCarrier(models.Model):
carrier.product_id.list_price = carrier.fixed_price
def fixed_rate_shipment(self, order):
carrier = self._match_address(order.partner_shipping_id)
if not carrier:
return {'success': False,
'price': 0.0,
'error_message': _('Error: this delivery method is not available for this address.'),
'warning_message': False}
price = self.fixed_price
if self.company_id.currency_id.id != order.currency_id.id:
price = self.env['res.currency']._compute(self.company_id.currency_id, order.currency_id, price)
......
......@@ -47,7 +47,7 @@ class ProviderGrid(models.Model):
if not carrier:
return {'success': False,
'price': 0.0,
'error_message': _('Error: no matching grid.'),
'error_message': _('Error: this delivery method is not available for this address.'),
'warning_message': False}
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment