Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Edit dropdown in sales module

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
salesproductdropdownodoo18
3 Antwoorden
132 Weergaven
Avatar
Agent

Is it possible to change the field display_name in the sales dropdown in sales where the product to add to the order line is selected? The standard Odoo shows `display_name`, which is `default_code` + the product name. I want to know if it's possible and how to change for another different compute field instead to show in the dropdown in odoo 18
I'm trying to concatenate more fields so that they display in the dropdown without affecting other modules that use the product's display_name

0
Avatar
Annuleer
Codesphere Tech

Hello,
Yes you can inherit the name_search for that and update it as per your needs

Avatar
Kunjan Patel
Beste antwoord
Hello Agent,
I hope you are doing well

models/product.py
from odoo import models, api
class ProductProduct(models.Model):
     _inherit = 'product.product'

      @api.depends_context('show_sale_display')
      def _compute_display_name(self):
          if self.env.context.get('show_sale_display'):
              for rec in self:
                 rec.display_name = f"[{rec.default_code or ''}] {rec.name} | ${rec.list_price:.2f}"
          else:
              super()._compute_display_name()

  views/sale_order_view.xml
  <?xml version="1.0" encoding="UTF-8"?>
  <odoo>
      <record id="view_order_form_custom_display" model="ir.ui.view">
          <field name="name">sale.order.form.custom.display</field>
          <field name="model">sale.order</field>
          <field name="inherit_id" ref="sale.view_order_form"/>
          <field name="arch" type="xml">
              <xpath expr="//field[@name='order_line']/list/field[@name='product_id']" position="attributes">
                  <attribute name="context">{'show_sale_display': True}</attribute>
              </xpath>
          </field>
      </record>
  </odoo>

Result:  Sale shows [ABC123] Product Name | $99.99 other modules show default.

I hope this information helps you

Thanks & Regards,
Kunjan Patel
0
Avatar
Annuleer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste antwoord
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

1
Avatar
Annuleer
Avatar
Agent
Auteur Beste antwoord

thank you all!!

0
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Suggestions for Odoo Product Module Enhancement: Dynamic Combination Sets and Combination Product Interface Optimization
sales product odoo18
Avatar
0
dec. 24
309
Conditionally show or hide product attributes (Odoo Online/Studio)
sales product
Avatar
Avatar
1
okt. 25
710
Hide the cost
sales product
Avatar
Avatar
Avatar
2
mei 25
4557
Products in multi company
sales product
Avatar
0
nov. 24
1537
how to filter out all products which got no sales with the last 3 months or a specific period?
sales product
Avatar
Avatar
1
aug. 24
2363
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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