Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

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

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
pythonxmlmany2onerelateddomain_filter
2 Replies
4465 Rodiniai
Portretas
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
Portretas
Atmesti
Portretas
ss
Best Answer

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
Portretas
Atmesti
jomin joseph
Autorius

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
Autorius

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

Portretas
Jainesh Shah(Aktiv Software)
Best Answer

Hi Jo, 

Please find code in comment. 

I hope this will help you. 

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

0
Portretas
Atmesti
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
Autorius

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!

Registracija
Related Posts Replies Rodiniai Veikla
What should the view inherit from?
python xml view many2one
Portretas
0
kov. 15
5133
OpenERP 7 many2one with current month filter
filter python xml many2one
Portretas
Portretas
2
kov. 15
30226
openerp 7 .netsvc: Unable to use a closed cursor.
python xml many2one __openerp__.py
Portretas
0
kov. 15
7097
How to hide view.xml fields group in Account module with attr
python xml
Portretas
Portretas
Portretas
2
gruod. 23
13887
how to remove first empty element from fields.selection Solved
python xml
Portretas
Portretas
Portretas
3
liep. 22
24301
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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