Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Dynamically display fields based on fields.Selection() options

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
2 Antwoorden
12904 Weergaven
Avatar
Nnamdi Jibunoh

Good day Guys,

I have a field that is a Selection field e.g

type_main = fields.Selection(selection =([('a','A'),('b','B'),('c','C')]), 'Main Type')

but i want to dynamically show another field on the form view when either a, b or c is selected from the type_main field e.g i want that when you select A then a field that links to product.template module-(field.Many2one) is displayed, but if you select B then the displayed field is related to hr.employees-(field.Many2one) and finally selecting C displays a field that related to accounts.asset.asset (field.Many2one).

Any suggestions will be appreciated.

NB: Am using Odoo 8.


Thanks for your answers, it works now!. But i have the following issues with the solution

1) Am Using 

 widget="one2many_list"

to display the tree in another Model's view, all 3 fields field1, field2, field3 do not display inline, they all display at the bottom of the page when the corresponding type_main is selected, ie if i select Option A from type_main the field1 displays at the bottom of the page instead of in the tree view.. So my question is, is there a way to force a field display at a particular point on the page or at least correct this behaviour.

2) Also the label of the fields are always visible on the tree view from Q1, but i want them entirely hidden. I have tried to use 

<field name="field1" attrs="{'invisible': [('type_main', '!=', 'a')]}" nolabel="1"/>

but it still permanently displays on the tree view. Is there a way to remove its label from the tree view?

NB: I tried to use comments but i dont have required karma, sorry guys.

1
Avatar
Annuleer
Avatar
Emipro Technologies Pvt. Ltd.
Beste antwoord

Hello,

You have to write your fields with attrs as like below.

<field name="field1" attrs="{'invisible': [('type_main', '!=', 'a')]}"/>
<field name="field2" attrs="{'invisible': [('type_main', '!=', 'b')]}"/>
<field name="field3" attrs="{'invisible': [('type_main', '!=', 'c')]}"/>

According to above attrs when you select 'a' inside 'type_main' at that time 'field1' is visible, same as 'b' inside 'type_main' then 'field2' is visible and 'c' inside 'type_main' then 'field3' is visible.

I think you will get what you want.

Note : You have also make thoese fields 'required' using attrs as like invisible.

3
Avatar
Annuleer
iWesabe Technologies

+1

Avatar
Axel Mendoza
Beste antwoord

This could be easily done using attrs on each of the many2one fields using the field type_main in a domain, like:


<field name="field1" attrs="{'invisible': [('type_main', '!=', 'a')]}"/>
<field name="field2" attrs="{'invisible': [('type_main', '!=', 'b')]}"/>
<field name="field3" attrs="{'invisible': [('type_main', '!=', 'c')]}"/>
0
Avatar
Annuleer
Emipro Technologies Pvt. Ltd.

Here you have to put opeerator '!=' because it is for 'invisible' not for 'visible'. I think you get it.

Axel Mendoza

Edited, thanks

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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