Skip to content

Commit 7cc9992

Browse files
[FIX] delivery_price_product_domain: fix bug when rules is not set
1 parent 67538f2 commit 7cc9992

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

delivery_price_product_domain/models/delivery_carrier.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
import ast
55

6-
from odoo import fields, models
6+
from odoo import _, fields, models
7+
from odoo.exceptions import UserError
78
from odoo.tools.safe_eval import safe_eval
89

910

@@ -52,12 +53,13 @@ def recompute_price_available(self, apply_product, price_dict, untaxed_in_dict):
5253

5354
def _get_price_from_picking(self, total, weight, volume, quantity):
5455
"Find price rule matching SO base on apply_product_domain"
55-
if (self.free_over and total >= self.amount) or not self.price_rule_ids:
56+
if self.free_over and total >= self.amount:
5657
return 0.0
5758
price_dict = self._get_price_dict(total, weight, volume, quantity)
5859
untaxed_in_dict = "untaxed_price" in price_dict
5960
test = False
60-
61+
if not self.price_rule_ids:
62+
raise UserError(_("No price rule defined for this carrier!"))
6163
rule_line = self.price_rule_ids[0]
6264
for line in self.price_rule_ids:
6365
apply_product_domain_char = line.apply_product_domain

0 commit comments

Comments
 (0)