Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to get values from Many2many relation and store it as char?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
many2many
2 Răspunsuri
12248 Vizualizări
Imagine profil
Paulo Matos

Hello everyone,

I am using Odoo 12 and lately I am unable to post images nor code on the forum and for this reason I will not be able to post them here but anyway I hope you can help me solve my problem.

I have a model with a many2many relation to the "res.users" model shown on my form view as "many2many_tags".

When I fill data on my model, I only get the number of records for the related many2many field and not the value for the "name" field and thus, when I put this field on my list view, I can only get the number of records and not the "name" value for the records.

For this reason, I want to collect the "name" field value from the "res.users" related model and pass them to a new character field automatically and use this field to show the desired names on my tree view. Since this is a many2many relation, I want to be able to "collect" all users selected from the form view on the "res.users" related field.

How can I achieve that? Any idea on how can I do that?

Thank you very much in advance

Best regards

Paulo


0
Imagine profil
Abandonează
Imagine profil
Niyas Raphy (Walnut Software Solutions)
Cel mai bun răspuns

Hi,

Rather than storing the many2many fields to Char field, see how the Attribute values of Model Product, which is a many2many field is displayed in the tree view.

Inventory -> Master Data -> Product Variants

See this answer here:  many2many field in list view odoo 11

Thanks

1
Imagine profil
Abandonează
Paulo Matos
Autor

Dear @Niyas Raphy

You are right.

I was using "widget="many2many_tags" on form field and forgot to include it on the tree view also.

Using it on tree view I can get the desired results

Thank you once again

Best regards

Imagine profil
Thayif kabir
Cel mai bun răspuns

Hi Paulo,

You can use many2many relation to access that corresponding model. By using res.users Many2many relation you get value of name field and store it your models char field.

You can use loop to access all records in res.users and store to your char field.

for record in many2many relation:

char = many2many.name 

0
Imagine profil
Abandonează
Paulo Matos
Autor

@Thayif,

I have tested this approach and I was able to achieve the results I wanted on the "char" field.

For this specific situation I have used the widget="many2many_tags" since it is enough for solving my problem.

In fact, my problem was I was just using it on the form view and not on the list view where the related field is shown.

I have noted your help and will use it as a reference anytime for sure.

Thank you once again

Best regards

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
ODOO V16 Associate Parts to a Finished Good
many2many
Imagine profil
Imagine profil
1
feb. 24
2911
Custom Model Data in Many2many field without storing in Database
many2many
Imagine profil
0
iul. 24
4338
Why a new record is creating when selecting in Many2Many field
many2many
Imagine profil
0
iul. 22
60
How to overwrite field many2many?
many2many
Imagine profil
Imagine profil
1
iul. 22
4027
How to apply domain filter on many2many field? Rezolvat
many2many
Imagine profil
Imagine profil
Imagine profil
2
dec. 23
34607
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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