[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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user