Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Limit selections between two fields using Studio

Subscriure's

Get notified when there's activity on this post

This question has been flagged
4 Respostes
1095 Vistes
Avatar
Brandon Lackey

I'm trying to limit options shown in the Packages window.  I have two Many2One fields:

  • Carrier
  • Package Type

When I select a certain "Carrier" I only want to see the package types associated with that carrier.  For example "dhl" has (pack1, pack2, pack3), "fedex" has (pack4, pack5, pack6) and "usps" has (pack7, pack8, pack9).


I have figured out how to do this with a single carrier in the Domain of the "Package Type" field:

[["package_carrier_type","=","dhl"]]

However, I haven't figured out how to properly write the domain to work with all the carrier options.  Any help is greatly appreciated.

V16

0
Avatar
Descartar
Avatar
Bob The Cow
Best Answer

Use this domain: [ '|',('carrier_id', '=', selected_carrier_id), ('carrier_id', '=', False)]

0
Avatar
Descartar
Brandon Lackey
Autor

Thank you for the input. Unfortunately, 'carrier_id' does not appear to be a valid domain entry in the Package Type field. Copying this code results in an "Domain not properly formed" error and I cannot find the 'carrier_id' when trying to add this manually in Studio with the Domain GUI.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi Brandon,

To achieve dynamic filtering of the "Package Type" field based on the selected "Carrier" in Odoo v16, you can use a computed domain in your model definition. Here's how you can set it up:

Ensure that the Carrier model has a relational field in the Package Type model and apply a domain for the package_type Many2one field using Studio.

You can define the domain directly in the Studio interface like this:

[('carrier_id', '=', carrier_id)]

This domain will filter the available options in the "Package Type" field based on the selected "Carrier"


Hope it helps

0
Avatar
Descartar
Brandon Lackey
Autor

Thank you for the input! I haven't been able to get this to work yet, but I don't think I fully understand how to "Ensure that the Carrier model has a relational field in the Package Type model", could you provide a bit more detail on hot to accomplish this?

Avatar
Brandon Lackey
Autor Best Answer

I have still been unable to get this to work.  Any help is greatly appreciated.

0
Avatar
Descartar
Avatar
Master
Best Answer

Hi,

I'd be glad to help you with limiting package type options based on the selected carrier in Odoo V16. Here's the domain you can use for the "Package Type" field:

[ '|',('carrier_id', '=', selected_carrier_id), ('carrier_id', '=', False)]


Explanation:

  • [('carrier_id', '=', selected_carrier_id)]: This part filters the "Package Type" records where the carrier_id field is equal to the currently selected carrier's ID (selected_carrier_id). This ensures only package types associated with the chosen carrier are shown.
  • '|' (OR operator): This separates the two conditions within the domain.
  • ('carrier_id', '=', False)]: This part allows you to see package types that are not associated with any carrier (if applicable in your data model). This provides flexibility if you have some generic package types that can be used with any carrier.

Hope help you. ​

0
Avatar
Descartar
Brandon Lackey
Autor

Thanks for the info and explanation. Unfortunately, this doesn't seem to be working, I get the following error:
Unknown field "stock.package.type.carrier_id" in domain of <field name="package_type_id"> ([["carrier_id","=","selected_carrier_id"]]))

The "carrier_id" field appears to be a list of the Shipping Methods, but the fields available while creating the domain under the "package_carrier_type" are the base carriers selected as the "Provider" (delivery_type) within the Shipping method. I've tried using this modified code, but it's not working either (doesn't error, but the selection field stays empty):
[["package_carrier_type","=","selected_delivery_type"]]

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

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

Registrar-se
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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