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

How can I create a related field on purchase.order.line to give me the NAME of the product? (Without the Internal Reference Number prepended to it)

Iscriviti

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

La domanda è stata contrassegnata
many2onerelatedrelated_fieldsv11Community
2 Risposte
6299 Visualizzazioni
Avatar
Asad Asif

Hello Friends,

I am new to Odoo and I really need your guidance.

In Purchase Order Lines I need the name of the product without the Internal Reference Number as currently it shows the (Internal Reference Number+Product Name).

I know that in the Model "product.template" there is a field name which is the Actual Name of the Product (minus -) the Internal Reference  so this is the field I want to Display On Purchase Order Lines.

So what I did was the following:
1. I created a new field in model "purchase.order.line"
​x_product_tmpl_id = fields.Many2one('product.template')

2.Then I created another field  Related Field in model "purchase.order.line" as follows:
x_name = fields.Char(string='Name', related='x_product_tmpl_id.name')​

Now the issue is that instead of showing the Product Name its showing Blank.

Can anyone please point out my mistake and suggest the correct way to do it.

Thanks

Sincerely,

Asad

0
Avatar
Abbandona
Ray Carnes (ray)

"Related Field | V11CE |" is not a question. I have edited your post to have a Question in the Title. Please consider posting a Question in the Title to increase your chances of visitors opening/answering your post. I moved V11CE to the TAG area of the post, as that is best practice.

Asad Asif
Autore

Thanks Ray, Next time I will be more careful.

Avatar
Paresh Wagh
Risposta migliore

Hi Asad:

You probably don't need to define x_product_tmpl_id as the model already has a field called product_id.

Change the definition of x_name to the following and it should work.

x_name = fields.Char(string='Name', related='product_id.name')​
1
Avatar
Abbandona
Asad Asif
Autore

Hello Paresh,

Thanks for your reply.

Its working now , but I have one question the way I created the related field is the method correct? Because with what I did its still showing blank data?

I am asking because in this model there was already an existing field product_id, but may be in any new custom model this field wont be there so if I need to copy the value to the new model how would I do it?

Please reply.

Thanks

Paresh Wagh

Hi Asad: Your approach looks good to me. The only other attribute you may want to add to your field declaration is readonly=True, if you are interested in only displaying the name on the screen.

If this was to be done on a model without the product_id field, you would need to first figure out how to establish the relationship between the model and the Product Template or Product Variant model. It's difficult to provide a generic answer to this part of the question because it would depend on the requirements you are trying to address.

Hope that helps. Please click on the check mark next to the answer to mark it as resolved if it solved your issue, so that it helps others in the future too.

Asad Asif
Autore

Thanks, I tried to click corrected answer but it was already resolved.

Anyways thanks for taking out your precious time to help me.

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à
Many2one related field Risolto
many2one related
Avatar
Avatar
3
set 21
10169
Representation of Many2one in view Risolto
many2one related
Avatar
Avatar
Avatar
4
gen 20
3929
More than one Many2one fields on same model + related fields
many2one related
Avatar
0
nov 18
5124
how can i get the wage field in "hr.contract" value into the "hr.employee" "hr_wage" field is it possible with many2one and related ? TypeError: Model 'hr.employee' inherits from non-existing model 'hr.contract'.
many2one related
Avatar
0
apr 17
4650
Write to Record in Related Field of Many2One Relationship
many2one related_fields
Avatar
0
mag 15
7371
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