Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How do I change the columns displayed in a many2many tree view?

Odebírat

Get notified when there's activity on this post

This question has been flagged
treeviewv7treemany2many
3 Odpovědi
55550 Zobrazení
Avatar
AJ Schrafel Paper Corp

I have a custom module with a tree view that display a many2many field. Everything works fine, i would just like to display different fields in the tree view.

This is the pertinant part of the code

<group>
    <tree string="Partner Contacts">
        <field name="partner_id" domain="[('customer','=',True),('opt_out','=',False)]"/>
    </tree>
</group>

Using the above XML code, the tree view displays the columns Name, Phone, Email.

How can I modify it so that the columns display are Name, City, State?

Thanks.

1
Avatar
Zrušit
Avatar
AJ Schrafel Paper Corp
Autor Nejlepší odpověď

I fixed it by doing the following:

<group>
<field name="partner_id" widget="many2many">
   <tree>
      <field name="name"/>
      <field name="city"/>
      <field name="state"/>
   </tree>
</field>
</group>
13
Avatar
Zrušit
Jérôme Thériault

Still works in Odoo 10

mitra safari

<field name="partner_id" widget="many2many_tags">

in odoo 11

Avatar
Lucas
Nejlepší odpověď

You may define a custom tree view with the fields you want to show and explicitly use it for your many2many field

doc.openerp.com/v6.0/developer/2_6_views_events/views/specify_view_to_use.html

<field name="order_line" colspan="4" nolabel="1" context="{'form_view_ref' : 'module.view_id', 'tree_view_ref' : model.view_id'}"/>

where 'tree_view_ref' points to your custom tree view

2
Avatar
Zrušit
Avatar
klacus
Nejlepší odpověď

Please check this sample. The model has a many2one field. This many2one is Calib_id. This is a connection with a two table. csyscmeascalibrate >> csyscmeascalibraterow. You can use this way to see what you want, and filter the data if is it necessary.

Xml.:

        <record model="ir.ui.view" id="csysc_measuringtoolcalibration_form_view">   
        <field name="name">csysc_measuringtoolcalibration.form</field>
        <field name="model">csyscmeascalibrate</field>
        <field name="type">form</field>       
        <field name="arch" type="xml">
        <form string="Measuring Equipment Calibration Plan">
                <group colspan="4" col="6">                                 
                <field name="name"/>     
                <field name="Title"/>
                <field name="ISO_form_number"/>
                <field name="type"/>    
                </group>  
                                <notebook colspan="4">
                                    <page string="Controlled Calibration points">
                                     <field colspan="4" name="Calib_lines" nolabel="1" widget="one2many_list" mode="tree"/>                                                                                                 
                                    </page>
                                </notebook>         


            </form>             
        </field>
    </record>

python

class csyscmeascalibraterow(osv.osv):
_name = "csyscmeascalibraterow"
_description = "calibration data sheet"
_columns = {    
    'name'  : fields.char('Calibration point:',size=40, required = True, help='The name of the calibration point, like jig width or ring diameter...etc'),
    'Calib_id':fields.many2one('csyscmeascalibrate','Parent Calibration', select=False, ondelete='cascade'),
    'NomValue' : fields.float('Nominal Value:',size=40, required = False, help='Nominal measuring value: like 12.00'),
    "Max_deviation" : fields.char('Max deviation:',size=40, required = False, help='Maximum deviation from nominal measuring value: like 12.00'),
    }
csyscmeascalibraterow() 


class csyscmeascalibrate(osv.osv):
_name = "csyscmeascalibrate"
_description = "calibration data sheet"
_columns = {
    'name'  : fields.char('Calibration Name:',size=40, required = True, help='The name of the calibration like Calipper 0-150...etc'),
    'Title'     : fields.char('Calibration title:',size=40, required = True, help='Title of the calibration point, like measuring series with jig...'),     
    'ISO_form_number' : fields.char('Iso Form Number:',size=40, required = False, help='The ISO system form number'),
    'type': fields.many2one('csyscmtooltypes','Equipment type',required = True),
    'Calibration_child_row_id': fields.many2one('csyscmeascalibrate','csyscmeascalibrate'),
    'Calib_lines': fields.one2many('csyscmeascalibraterow', 'Calib_id', 'Calibration Plan id'),  
        }
csyscmeascalibrate()
-1
Avatar
Zrušit
AJ Schrafel Paper Corp
Autor

thank you for your comment, but how does this change the columns automatically displayed when a many2many field is displayed?

klacus

As I think this is depend the relation. Please put it your code, and the situation will be clear, what you want...

Lucas

klacus, your example does not customize the fields you want to show within the nested tree view

klacus

Yes because this is show all of the fields from csyscmeascalibraterow. If you want to show a special view, you must declare it in xml, and after that you need to call according by tree name. (As I know :-) )

Lucas

"i would just like to display different fields in the tree view.", that's the key part

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Show a field from many2many relationship in a tree view Vyřešeno
treeview tree many2many tree_view
Avatar
Avatar
Avatar
Avatar
4
čvn 25
12369
Multi step wizard with data from many2many relation?
v7 many2many
Avatar
0
bře 15
7673
xml-rpc search on many2many query
v7 many2many
Avatar
Avatar
Avatar
2
bře 15
10285
Highlight Records in Tree Vyřešeno
treeview tree odoo
Avatar
Avatar
Avatar
Avatar
3
kvě 23
2895
How to hide import button in a specific tree view in Odoo v12
import treeview tree
Avatar
Avatar
1
dub 23
4575
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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