summaryrefslogtreecommitdiff
path: root/addons/delivery/models
diff options
context:
space:
mode:
authorPedro M. Baeza <pedro.baeza@tecnativa.com>2020-10-21 13:54:59 +0000
committerNicolas Martinelli <nim@odoo.com>2020-10-28 09:43:35 +0000
commit2c5ab1ea4c12d92c4821ce65b808a55946de7dc9 (patch)
tree3e8236f4b2adb95455451d8a4f3dbfd3358fd003 /addons/delivery/models
parentc62acb48ac3ae11180a6817321664fb01833d3bd (diff)
[FIX] delivery: Fallback to commercial partner's delivery method
Fine-tune of #59524. If the delivery address doesn't have any delivery method assigned, you get an undesired change of behavior: no delivery method is populated in that cases. Note that the delivery method is not a commercial field that is propagated from parent to children. With this patch, we get a very similar behavior, which is fallbacking to the commercial partner's delivery method if there's no delivery method in the delivery address. The only different behavior will be if the order partner is different from the commercial partner of the delivery address. closes odoo/odoo#60879 X-original-commit: 682b2e6c214b73f67e849df927bd4bda0af31d5a Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons/delivery/models')
-rw-r--r--addons/delivery/models/sale_order.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/delivery/models/sale_order.py b/addons/delivery/models/sale_order.py
index d1100ecbde9..3deac3f4c5f 100644
--- a/addons/delivery/models/sale_order.py
+++ b/addons/delivery/models/sale_order.py
@@ -56,7 +56,10 @@ class SaleOrder(models.Model):
carrier = self.carrier_id
else:
name = _('Add a shipping method')
- carrier = self.with_company(self.company_id).partner_shipping_id.property_delivery_carrier_id
+ carrier = (
+ self.with_company(self.company_id).partner_shipping_id.property_delivery_carrier_id
+ or self.with_company(self.company_id).partner_shipping_id.commercial_partner_id.property_delivery_carrier_id
+ )
return {
'name': name,
'type': 'ir.actions.act_window',