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_variable_unit

View 20.0
Inputs Method Outputs
  • carrier_id
  • variable
  • currency_id
  • currency_id.symbol
  • currency_id.name
+ for rule in self:
+             carrier_id = rule.carrier_id
+             match rule.variable:
+                 case "weight":
+                     rule.variable_unit = carrier_id.weight_uom_name
+                 case "volume":
+                     rule.variable_unit = carrier_id.volume_uom_name
+                 case "wv":
+                     rule.variable_unit = (
+                         f"{carrier_id.weight_uom_name} * {carrier_id.volume_uom_name}"
+                     )
+                 case "price":
+                     rule.variable_unit = rule.currency_id.symbol or rule.currency_id.name or ""
+                 case _:
+                     rule.variable_unit = False
  • variable_unit

Back to entity