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

how to override name_get method in new api

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
newapi
3 Antwoorden
20714 Weergaven
Avatar
Soohoo

can anbody tell me override name_get method in new api

1
Avatar
Annuleer
Avatar
Soohoo
Auteur Beste antwoord

In the new api, it's the field display_name. Just override the field display name to a computed one.

 class res_partner(Model):
        ...

        display_name = fields.Char(
            string='Name', compute='_compute_display_name',
        )

        @api.one
        @api.depends('name', 'parent_id.name')
        def _compute_display_name(self):
            names = [self.parent_id.name, self.name]
            self.display_name = ' / '.join(filter(None, names))

2
Avatar
Annuleer
Avatar
Burhan Vakharia
Beste antwoord

Learn – Overriding name_get method in Odoo 8 with Example & Screenshots - Odoo Technical

http://odootechnical.com/overriding-name_get-method-in-odoo-8/

1
Avatar
Annuleer
Avatar
Toni Mas
Beste antwoord

I had some problems with this until I read this post by Martin Trigaux in the mailing list:

https://www.odoo.com/groups/community-59/community-8908652

Perhaps is a good idea to update the docs.

 

Hello, Sorry to contradict you but it's actually still name_get that you should override. The initial intended behaviour was indeed to have display_name as replacement of name_get. However there were lot's of issues with the initial implementation and it was not backward compatible with the old api and we have to partially go back to old behaviour[1].

So the current behaviour of the name_get/display_name is the following:

name_get is still the main function used for rendering display_name is a computed field that will use name_get If you want to change both, you should still override name_get (see event for example[2]).

Changing the method of display_name would affect only display_name, not name_get (can be what we want[3] but usually not).

We may change one day to fully use display_name and drop name_get but that means breaking the backward-compatibility.

Hope it's clear.

[1] https://github.com/odoo/odoo/commit/f138aa26085d103a88dbd8bb73fb8bf5517298ad

[2] https://github.com/odoo/odoo/blob/8.0/addons/event/event.py#L194

[3] https://github.com/odoo/odoo/blob/8.0/openerp/addons/base/res/res_partner.py#L232

--

Martin Trigaux Odoo (Formerly OpenERP)

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
how i can Export Report in PDF format Odoo 12 CE
newapi
Avatar
Avatar
3
mei 20
8448
How to used read_group method in new api ?
newapi
Avatar
Avatar
Avatar
6
mrt. 16
26850
Avatar image in new api
newapi
Avatar
Avatar
1
mrt. 15
9208
What is the use of @api.returns? Opgelost
odooV8 newapi
Avatar
Avatar
Avatar
2
jan. 20
16844
How to write multiple records at once
orm newapi
Avatar
0
jan. 17
12023
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