Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

dependent drop-down in odoo / open erp

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
3 Risposte
6760 Visualizzazioni
Avatar
Himanshu Mittal

I have made two drop-downs. Second dropdown's data is dependent on first drop-down's chosen value.

I have tried multiple methods, but didn't find any relevant solution.

Those are my three lists:

SELECTION_LIST = (('sela','Selected a'), ('selb','Selected b')) SELECTION_LIST_2 = (('selc','Selected c'), ('seld','Selected d')) SELECTION_LIST_3 = (('sele','Selected e'), ('self','Selected f'))

And I defined my fields this way:

'type_selection': fields.selection( [ ('selection1', 'Selection 1'), ('selection2', 'Selection 2'), ('selection3', 'Selection 3'), ], 'Category 1', required=False), 'type_selection_2': fields.selection( type_selection={ 'selection1': [{SELECTION_LIST}], 'selection2': [{SELECTION_LIST_2}], 'selection3': [{SELECTION_LIST_3}], }, "Category 2", required=False)

Unfortunately I get an error.

0
Avatar
Abbandona
Avatar
Jacky
Risposta migliore

It is better to use an Onchange method in these cases.

0
Avatar
Abbandona
Avatar
Himanshu Mittal
Autore Risposta migliore

have also used onchange function like this

In xml file ->

<field name="type_selection" on_change="_set_list_data(type_selection)"/> -->

<field name="type_selection_2"/>

In python file ->

'type_selection': fields.selection([
                                  ('selection1','Selection 1'),
                                  ('selection2','Selection 2'),
                                  ('selection3','Selection 3')
                                  ],'Select Call Reason',required=False),
        'type_selection_2': fields.selection(
                                             _get_selection,
                                             'What do you want ?')

 

python function 

 def _set_list_data(self,cr,uid,selected,context=None):
        if selected == 'selection1':
            SELECTION_LIST = SELECTION_LIST_2
            vals = {'type_selection_2': SELECTION_LIST_2}        
            return {'type_selection_2': SELECTION_LIST_2}
        else:
            vals = {'type_selection_2': SELECTION_LIST_3}
            SELECTION_LIST = SELECTION_LIST_3        
            return {'type_selection_2': SELECTION_LIST_3}
        
    def _get_selection(self, cr, uid, context=None):
        return SELECTION_LIST

0
Avatar
Abbandona
Med Said BARA

In your .py file move the function definition before the _columns (fields definitions)

OdooBot
which function?

Warm Regards,

Himanshu Mittal | Trainee,Technology |himanshu.mittal@nagarro.com| 09649417940


Nagarro Software (P) Ltd, Plot No-14, Sec-18, Electronic City, Gurgaon, Haryana-122015, India

Visit our facebook page : https://www.facebook.com/nagarrocampus

  

P Please consider the environment and do not print this email unless absolutely necessary



On Wed, Oct 29, 2014 at 5:33 PM, Med Said BARA <diassynthesis@mail.odoo.com> wrote:

In your .py file move the function definition before the _columns (fields definitions)

--
Med Said BARA
Sent by Odoo Inc. using Odoo about Forum Post False

OdooBot
Le 29/10/2014 13:19, HImanshu Mittal a écrit :
<blockquote cite="mid:CAEZJQWfuK8P-nK-KuYPyZbWEPign4bq0jONMfdB1=QiLpN_-AQ@mail.gmail.com" type="cite">
which function?

Warm Regards,

Himanshu Mittal | Trainee,Technology |himanshu.mittal@nagarro.com| 09649417940


Nagarro Software (P) Ltd, Plot No-14, Sec-18, Electronic City, Gurgaon, Haryana-122015, India

Visit our facebook page : https://www.facebook.com/nagarrocampus

  

P Please consider the environment and do not print this email unless absolutely necessary



On Wed, Oct 29, 2014 at 5:33 PM, Med Said BARA <diassynthesis@mail.odoo.com> wrote:

In your .py file move the function definition before the _columns (fields definitions)

--
Med Said BARA
Sent by Odoo Inc. using Odoo about Forum Post False

--
Himanshu Mittal
Sent by OpenERP S.A. using Odoo about Forum Post False Both: def _set_list_data and def _get_selection.

Can you post the error message you are getting?

Best regards.
OdooBot
Hi,
Can you please look into this
http://stackoverflow.com/questions/26591360/dependent-drop-down-in-odoo-open-erp

Regards,
Himanshu Mittal
Avatar
Med Said BARA
Risposta migliore

At first glance, there is a smell of (python) " Nested Lists".

But it will be helpful, if you give a concrete example, like for product's categories and subcategories, or Brand and Models of cars ...

0
Avatar
Abbandona
Himanshu Mittal
Autore

Like We Say.. List 1 has Items -> Mobile,Laptop, Tablets List 2.1 (For Mobile) -> Samsung, Apple List 2.2 (For Laptop) -> Apple, Dell List 2.3 (For Tablet) -> Samsung, Dell, Apple How can I achieve the same

Himanshu Mittal
Autore

Any update on this??

Himanshu Mittal
Autore

Any update on this??

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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