summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Widart <awt@odoo.com>2020-11-20 08:40:06 +0000
committerAdrien Widart <awt@odoo.com>2020-11-25 07:40:40 +0000
commit8eb422cd39d8f001068f3b7409b0862b3727e66d (patch)
tree86d266f49bf0b0a1e98901629ffcf1a0976f0a28
parent7b9545387962981b5729318e2bbc5714dcbac68c (diff)
[FIX] delivery: shipping cost free if above amount
A based on rules shipping method with the "Free if order amount is above" field enabled is not correctly applied. To reproduce the error: (Need website_sale) 1. Go to Settings > Website 2. Enable "Shipping Costs" 3. Go to Website > Configuration > eCommerce > Shipping Methods 4. Create a new one - Select "Based on Rules" - Enable "Free if order amount is above" - Set the corresponding amount - In pricing, add a line 5. Save & Publish (Click on "Unpublished") 6. Go to website's shop 7. Add the product set in the shipping method to your cart - Select an amount sufficient to exceed the threshold amount set in step 4 8. Process Checkout => The shipping method is shown, but the associated amount is "No price rule matching this order[...]" The shipping method price should be 0. (This error also happens when creating a SO) OPW-2383258 closes odoo/odoo#62288 X-original-commit: 393b7ad7b7dff1cbf830374c76ef0a681a71be6a Signed-off-by: adwid <adwid@users.noreply.github.com>
-rw-r--r--addons/delivery/models/delivery_grid.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/addons/delivery/models/delivery_grid.py b/addons/delivery/models/delivery_grid.py
index 9df02ea297c..cee239daec4 100644
--- a/addons/delivery/models/delivery_grid.py
+++ b/addons/delivery/models/delivery_grid.py
@@ -97,6 +97,8 @@ class ProviderGrid(models.Model):
price = 0.0
criteria_found = False
price_dict = {'price': total, 'volume': volume, 'weight': weight, 'wv': volume * weight, 'quantity': quantity}
+ if self.free_over and total >= self.amount:
+ return 0
for line in self.price_rule_ids:
test = safe_eval(line.variable + line.operator + str(line.max_value), price_dict)
if test: