Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Delivery Costs

Entity: delivery.price.rule

Compute Method: _compute_name

View 19.0 View 20.0
Inputs Method Outputs
  • variable
  • operator
  • max_value
  • currency_id
  • list_base_price
  • list_price
  • variable_factor
  • variable_unit
for rule in self:
-             name = 'if %s %s %.02f then' % (rule.variable, rule.operator, rule.max_value)
+             name = "if %s %s %.02f %s then" % (
+                 rule.variable,
+                 rule.operator,
+                 rule.max_value,
+                 rule.variable_unit or "",
+             )
            if rule.currency_id:
                base_price = format_amount(self.env, rule.list_base_price, rule.currency_id)
                price = format_amount(self.env, rule.list_price, rule.currency_id)
            else:
                base_price = "%.2f" % rule.list_base_price
                price = "%.2f" % rule.list_price
            if rule.list_base_price and not rule.list_price:
-                 name = '%s fixed price %s' % (name, base_price)
+                 name = "%s fixed price %s" % (name, base_price)
            elif rule.list_price and not rule.list_base_price:
-                 name = '%s %s times %s' % (name, price, rule.variable_factor)
+                 name = "%s %s times %s" % (name, price, rule.variable_factor)
            else:
-                 name = '%s fixed price %s plus %s times %s' % (
-                     name, base_price, price, rule.variable_factor
+                 name = "%s fixed price %s plus %s times %s" % (
+                     name,
+                     base_price,
+                     price,
+                     rule.variable_factor,
                )
            rule.name = name
  • name

Back to entity