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í
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • 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
    • Services for Partners
    • 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

Related selection field or parent child drop down menus in odoo 14

Odebírat

Get notified when there's activity on this post

This question has been flagged
pythonxmlmany2onerelateddomain_filter
2 Odpovědi
4481 Zobrazení
Avatar
jomin joseph

Hi guys i am using odoo 14, i have created a custom module that inherit into odoo, i want to create a selection field which i related to another field for eg: i have a selection field: A it has 3 options 1,2,3 if i select option 1 , it should show another selection field which should come only if i select 1 , if i select 2 it should show another selection field , is there any way i can achieve this using python or xml in odoo

0
Avatar
Zrušit
Avatar
ss
Nejlepší odpověď

Hi, @jo
In Python
, Define all the SELECTION FIELDS that is required feature, that is the selection field with value 1 2 3 and selection field that will show for option 1 and selection field to show for option 2.

selection = fields.Selection([('1', '1'), ('2', '2'), ('3', '3')])
slection_for_opt_1 = fields.Selection([('5', '5'), ('6', '6')])
slection_for_opt_2 = fields.Selection([('7', '7'), ('8', '8')])

In XML, Add attrs attribute for the field defination on view as mentioned below

field name="selection"
field name="slection_for_opt_1" attrs="{'invisible': [('selection', '!=', '1')]}"
field name="slection_for_opt_2" attrs="{'invisible': [('selection', '!=', '2')]}"

1
Avatar
Zrušit
jomin joseph
Autor

Hi @Sujata Bhuyan, i tried the code you shared but i am getting this error ValueError: dictionary update sequence element #0 has length 3; 2 is required

ss

Hi @jo, Can you share your code here. So that I can help.

jomin joseph
Autor

python side

# -*- coding: utf-8 -*-

from odoo import models, fields, api

class FieldsCustomDropDown(models.Model):
_inherit = 'sale.order'

selection = fields.Selection([('1', '1'), ('2', '2'), ('3', '3')])
slection_for_opt_1 = fields.Selection([('5', '6', '7')])
slection_for_opt_2 = fields.Selection([('8', '9', '10')])
slection_for_opt_3 = fields.Selection([('11', '12', '13')])
xml side

<record id="new_test_add_custom_purchase_fields_parameters_inherit" model="ir.ui.view">
<field name="name">purchase.test.add..new.custom.fields.inherited</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='category']"
position="after">
<field name="item"/>
</xpath>
</field>
</record>
actual selection will be around 10 options this for testing purpose i did but its not working

Avatar
Jainesh Shah(Aktiv Software)
Nejlepší odpověď

Hi Jo, 

Please find code in comment. 

I hope this will help you. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

0
Avatar
Zrušit
Jainesh Shah(Aktiv Software)

Code :-

XML:
<field name="selection"/>
<field name="slection_for_opt_1" attrs="{'invisible': [('selection', '!=', '1')]}"/>
<field name="slection_for_opt_2" attrs="{'invisible': [('selection', '!=', '2')]}"/>
PY:
selection = fields.Selection([('1', '1'), ('2', '2'), ('3', '3')], string="Selection")
slection_for_opt_1 = fields.Selection([('5', '5'), ('6', '6'), ('7', '7')], string="Selection_1")
slection_for_opt_2 = fields.Selection([('8', '8'), ('9', '9'), ('10', '10')], string="Selection_2")

jomin joseph
Autor

this worked perfectly, i made an error in python side that's why it was not reflecting, thank you sir

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
What should the view inherit from?
python xml view many2one
Avatar
0
bře 15
5143
OpenERP 7 many2one with current month filter
filter python xml many2one
Avatar
Avatar
2
bře 15
30231
openerp 7 .netsvc: Unable to use a closed cursor.
python xml many2one __openerp__.py
Avatar
0
bře 15
7110
How to hide view.xml fields group in Account module with attr
python xml
Avatar
Avatar
Avatar
2
pro 23
13919
how to remove first empty element from fields.selection Vyřešeno
python xml
Avatar
Avatar
Avatar
3
čvc 22
24341
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