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

_rec_name - predefined fields

Iscriviti

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

La domanda è stata contrassegnata
fieldspredefined_rec_name
12 Risposte
56810 Visualizzazioni
Avatar
omprakash

Hai Friends ,

 First I thank everyone who give good guideline for newbie in OpenERP . I have question regards predefined fields - _rec_name  in OpenERP .
  1. Its not clear for me , _rec_name predefined fields in OpenERP . Friends can you please explain with sample module .It more useful for clear understanding .

Thanks & Regards OMPRAKASH.A

0
Avatar
Abbandona
Odoo Mates

See this video to understand use of the rec_name and how to set it for a model: https://www.youtube.com/watch?v=d_cyPsVc7vg

Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Risposta migliore

_name is used to define object like account.invoice, sale.order, purchase.order, res.users.

When you have name field in your columns, you don't need to define field in _rec_name. OpenERP takes name field by default.

You have seen name in any form when you select many2one field. For example in Sale Order when you select Customer, you can see Customer's Name in that many2one field. Now if you want to show Customer's Phone Number in many2one field, you have to define phone field in _rec_name like this: _rec_name = 'phone'

If your columns don't have any name field then you have to define any field in _rec_name.

There are other reasons which Prakash described in his answer.

12
Avatar
Abbandona
omprakash
Autore

Hi Sudhir Arya, Thanks for your reply . I am new for OpenERP , If my question are very silly please don't mistake . I am very interest to know about OpenERP . 1. > From your point I can understand that _rec_name not needed until _name is defined . But if i create a <objectname>.py class _name is mandatory . So I must declare the _name fields . 2.> If i define _rec_name how can i make use .

omprakash
Autore

This is my sample code please explain with this ...< Test.py > from osv import fields,osv class test(osv.osv): _name = 'sodexis' _rec_name = 'data_id' _columns = { 'name' : fields.char('name' , required = 1 , size = 30 ), 'age' : fields.integer('age' , store = False), 'data_id':fields.many2one('test', 'data_id', required=False) } test()

omprakash
Autore

Please explain with this example , And once i thank you both for such guideline ... Thanks regards ----OMPRAKASH.A

Sudhir Arya (ERP Harbor Consulting Services)

I am talking about name field in _columns not _name. There is nothing to do with _name.

Sudhir Arya (ERP Harbor Consulting Services)

In your code you have defined name field

`name`: fields.char('name', required=1, size=30)

So you don't need to define _rec_name because OpenERP takes name field by by default.

omprakash
Autore

Hi Suhir Arya , Thanks for your reply ..

Avatar
Prakash
Risposta migliore

In fields.many2one("table.name", output)

Default name_get method return the output value "name" field value in the table.

suppose in the table contain no "name" field then we can use _rec_name = field_name

Now in name_get method return _rec_name field value.

0
Avatar
Abbandona
omprakash
Autore

Hi Prakash , Thanks for your reply . I have doubt , _name is mandatory then how can I use _rec_name ? If you explain with sample code , It make more useful for me & once again thanks for your reply

Jainesh Shah(Aktiv Software)

Hi omprakash, Here is the sample code.

Class Test(models.Model):

_name = 'test'

_rec_name = field_1

field_1 = fields.Many2one('object',"Field 1")

field_2 = fields.Many2one('object',"Field 2")

date = fields.Date("Date")

As you can see no "name" field is there in above model.

So here we have 2 option :

Option 1: set rec_name :- Here field which is set in rec_name works as Model name field.

Option 2: override name_get method :- We need to override name_get method.(here we can concate more than 2 fields and create name for model)

@api.multi

@api.depends('field_1', 'date')

def name_get(self):

result = []

for test in self:

name = test.field_1 + ' ' + account.date

result.append((test.id, name))

return result

Avatar
Nivas
Risposta migliore

Hi,

I have another doubt here.I want to know the way to find which field is applied in _rec_name in the particular model.

I have taken that model id from ir.model table and also I could find all the fields list created in that model through ir.model.fields table.But I could not find which field is used in _rec_name

Could you please help me?


0
Avatar
Abbandona
Avatar
subbarao
Risposta migliore

_rec_name name by default looks for name field, if name field is not available then it will display like your model_name,db_id , so we have to pass at least one field to _rec_name in case of no name field.

0
Avatar
Abbandona
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à
_auto & _sql predefined fields
fields _auto _sql predefined
Avatar
Avatar
1
ott 22
12999
_sequence predefined fields
fields _sequence predefined attributes
Avatar
Avatar
1
lug 15
7772
How to display a red * for required fields
fields
Avatar
Avatar
Avatar
Avatar
3
mag 25
3377
How to display a red * for required fields
fields
Avatar
Avatar
1
apr 25
2405
one2one relational field Risolto
fields
Avatar
Avatar
Avatar
Avatar
3
set 24
16066
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