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

Module: Sales

Entity: sale.order.line

Compute Method: _compute_label

Inputs Method Outputs
for line in self:
            if not line.product_id:
                line.label = line.name
                continue

            product_with_lang = line.product_id.with_context(lang=line.order_id._get_lang())
            if not line.name:
                line.label = product_with_lang.display_name
            elif line.name.splitlines()[0] == product_with_lang.display_name:
                # If description already holds the product name, use it as label
                line.label = line.name
            else:
                line.label = product_with_lang.display_name + "\n" + line.name

Back to entity