Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

odoo 16: Many2one field - how to return value of another field Instead Of default 'id'

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
many2oneodoo16features
2 Risposte
4060 Visualizzazioni
Avatar
SmithJohn45

i have a table coa_ledgers (id, name, ledger_acc etc.)

for my banks i want to have a field ledger_acc which should type of Many2one to select from coa_ledgers and return the value of field ledger_acc instead of id

how i can achieve this, can i mention field name to be return then How To or something else?

please help.

 ledger_acc = fields.Many2one('coa_ledgers', string='Ledger A/c')

regards 

0
Avatar
Abbandona
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Risposta migliore

Hi,

To achieve the desired functionality where the Many2one field 'ledger_acc' in your Odoo model returns the value of the 'ledger_acc' field instead of the ID of the selected record from the 'coa_ledgers', you can use the 'name_get' method:

class CoaLedgers(models.Model):
_name = 'coa_ledgers'

name = fields.Char(string='Name')
ledger_acc = fields.Char(string='Ledger A/c')

def name_get(self):
result = []
for record in self:
name = record.ledger_acc
result.append((record.id, name))
return result

Regards

1
Avatar
Abbandona
SmithJohn45
Autore

thanks, but may be i failed to convery the problem OR may be i failed to understand what solution you have posted here.
anyway there are 2 things when it populates dropdown list (Many2one), (1) a display value and (2) a return value
i am asking about Return Value which will save in current Many2one field to make relation / reference to its parent model.
hope that clear.
very sorry for any inconvenience.
regards

SmithJohn45
Autore

@Cybrosys Techno Solution
waiting for your response on my comment posted yesterday.
regards

Avatar
SmithJohn45
Autore Risposta migliore

@Admin @Moderator 

what is problem with this forum? i can't get Answer to my problems then How I Can recommend Odoo 

nobody even trying to inform how i can get Answer or at least like: this is not possible yet in Odoo 

on of my previous topic regarding Parent-Child (Master-Detail) not yet Answered by seniors here, nobody is able to say "no, this is not possible" etc. can anyone please guide that from where i can get help and resolve my problems? 

i think simple Comment is not able to inform someone here that this thread/toipic is updated. and also i faced posting the Error text and my code, i request to Delete a post due to this problem and ask to guide me for How To's but simply post Deleted silently, because this is simple and nobody helped for How To's because this was not possible for him.


regards

0
Avatar
Abbandona
Niyas Raphy (Walnut Software Solutions)

Hi,
This is a public forum, where it is not ensured to answer and all solve your all issues. As all forums, people may help if they feel it is easy for them, there are lot of questions which is answered and answered.

If the question is easy and straightforward, the chance of getting answered is high, else people wont spend much time to resolve your issues.

Incase if you feel the forum is not helpful much and need more support, you may seek dedicated support from any sort of support channels.

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
odoo 16: Many2one - how i can another field Instead Of default Risolto
many2one odoo16features
Avatar
Avatar
1
mag 23
4502
many2one unlink without delete (v16)
many2one odoo odoo16features
Avatar
Avatar
1
apr 24
2571
What is the best way to restrict the many2one field from opening up
many2one Odoo13.0 odoo16features
Avatar
Avatar
Avatar
2
feb 24
3163
[SOLVED] How to make visible selected values in many2one or many2many fields on Settings page in Odoo 16 Risolto
many2one many2many odoo16features
Avatar
Avatar
Avatar
3
dic 23
7213
many2one field is not saving
fields many2one odoo16features
Avatar
Avatar
1
ago 23
3735
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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