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.carrier

Compute Method: _compute_delivery_cost

Inputs Method Outputs
"""Provide Cost column for the list view for carriers from SO selection"""
carrier_prices_dumped = self.env.context.get("carrier_prices_dumped")
if not carrier_prices_dumped:
            for carrier in self:
                carrier.delivery_cost = None
            return
carrier_prices = json.loads(carrier_prices_dumped)
for carrier in self:
            if not carrier.delivery_currency_id:
                continue

            delivery_vals = carrier_prices.get(str(carrier.id), {})
            carrier.delivery_cost = delivery_vals.get("display_price", 0.0)

Back to entity