Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Display name w/ default_code not showing when adding lines to Sales Order

Odebírat

Get notified when there's activity on this post

This question has been flagged
2 Odpovědi
1716 Zobrazení
Avatar
Frank Sandqvist

Hi,

I am resorting to the forum as I'm at my wits end as to why this is happening. It seems to have started happening after upgrading to Odoo 18

My issue is that display_name is not working as I'd expect.

If I edit the product, it appears as I'd like ([default_code] name)

Screenshot: https://drive.google.com/file/d/1uBE3QdlUmqllqBtq8RN3TOk0QCNGEaLB/view?usp=sharing


When I browse the product in the sol_product_many2one widget, they are appearing

Screenshot: https://drive.google.com/file/d/1i-IV2Uq-iYCbtXP8unByj3f2nJv5pnL1/view?usp=sharing


But - when I add the product it just disappears.

Screenshot: https://drive.google.com/file/d/1ngwsDimqb6VQfnMJpdu9R-tbWHSA4LH8/view?usp=sharing


It also does not show on PDF quotes / order confs. 


Is this new default behaviour that I need to fix manually with Odoo 18, or is something not configured right? I tried to investigate the sol_product_many2one but it's a bit too dense for me. I also checked the "name" column in the sale_order_line table, and that indeed does not include the default_code.


Thank you so much in advance!

0
Avatar
Zrušit
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Nejlepší odpověď

Hi,

In Odoo 18, the behavior of product names changed: the display_name (which shows [default_code] name) is now only used for UI display and is not automatically copied into the sale order line’s name field. This is why the product appears correctly in the widget but disappears after selection and doesn’t show in PDFs. To restore the old behavior, you can override the product_id onchange in sale.order.line so that the name field stores the display name.


Code:

from odoo import models, api


class SaleOrderLine(models.Model):

    _inherit = 'sale.order.line'


    @api.onchange('product_id')

    def _onchange_product_id_custom(self):

        res = super(SaleOrderLine, self)._onchange_product_id()

        if self.product_id:

            self.name = self.product_id.display_name or self.product_id.name

        return res


Hope it helps.

0
Avatar
Zrušit
Avatar
Banibro IT Solutions
Nejlepší odpověď

What’s Happening in Odoo 18

  1. display_name no longer includes [default_code] name automatically everywhere.

    • In Odoo 17 and earlier, the default behavior was for display_name to return [default_code] name if default_code existed.

    • In Odoo 18, the logic for display_name is not used consistently across all widgets or record displays anymore. Some widgets like sol_product_many2one still use it, but fields like product_id.name or report lines may now rely on name or direct database values that exclude default_code.

  2. On the Sale Order Line (SOL), the name field is manually computed.

    • This field is populated during product_id_change() or _compute_product_id_change().

    • It does not include [default_code] unless you explicitly add it to the logic.

  3. PDF reports and quotes depend on the sale.order.line.name field.

    • If default_code isn’t part of that field, it won’t appear on your documents.

 How to Fix It

You need to override the behavior that generates the sale order line name to include the default_code. This will make it show up correctly in:

  • The form view

  • The PDF/print report

  • Any related downstream record

 Override product_id_change in a custom module or via Studio (dev mode)


from odoo import models


class SaleOrderLine(models.Model):

    _inherit = 'sale.order.line'


    def _compute_product_id_change(self):

        super()._compute_product_id_change()


        for line in self:

            if line.product_id:

                product = line.product_id

                default_code = product.default_code or ''

                name = product.name or ''

                display_name = "[%s] %s" % (default_code, name) if default_code else name

                line.name = display_name


 Fix PDF Quotes/Reports

Ensure your QWeb report template uses line.name and not just product_id.name. You don’t have to change this if you fix the name field as shown above — but just double-check.

 Why This Changed in Odoo 18?

Odoo 18 leans more toward modular, explicit control over display logic — likely to reduce performance overhead and simplify translation and customization. However, it means you have to manually define where and how you want default_code included.

Summary of What You Should Do

  •  Override _compute_product_id_change() to customize how name on sale.order.line is populated.

  •  Confirm your report template pulls from line.name, not product_id.name.

  •  Don’t rely solely on display_name anymore — it's not consistently used in PDF/reporting contexts.

0
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now