Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

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)

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
many2onerelatedrelated_fieldsv11Community
2 Réponses
6302 Vues
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
Ignorer
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
Auteur

Thanks Ray, Next time I will be more careful.

Avatar
Paresh Wagh
Meilleure réponse

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
Ignorer
Asad Asif
Auteur

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
Auteur

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

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

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Many2one related field Résolu
many2one related
Avatar
Avatar
3
sept. 21
10171
Representation of Many2one in view Résolu
many2one related
Avatar
Avatar
Avatar
4
janv. 20
3930
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
avr. 17
4650
Write to Record in Related Field of Many2One Relationship
many2one related_fields
Avatar
0
mai 15
7372
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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