[FIX] delivery: send the expected carrier name to Amazon

A modification made by Amazon on October 1st restricts the allowed
values for the carrier name. Since it now expects it in a formatted
state, this commit will allow Odoo to send the delivery type of the
carrier rather than its name, which can be customized by the user.

opw-2665099

closes odoo/odoo#84291

X-original-commit: 0b4530b124d4ac86dad34907c6d6b6e9ea69c7b6
Related: odoo/enterprise#24204
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
This commit is contained in:
pedrambiria
2022-02-11 09:47:50 +00:00
committed by Demesmaeker
parent 1c9dff27e0
commit 55e98db012
@@ -144,6 +144,15 @@ class DeliveryCarrier(models.Model):
def onchange_countries(self):
self.state_ids = [(6, 0, self.state_ids.filtered(lambda state: state.id in self.country_ids.mapped('state_ids').ids).ids)]
def _get_delivery_type(self):
"""Return the delivery type.
This method needs to be overridden by a delivery carrier module if the delivery type is not
stored on the field `delivery_type`.
"""
self.ensure_one()
return self.delivery_type
# -------------------------- #
# API for external providers #
# -------------------------- #