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
    • Sociale 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

Limit selections between two fields using Studio

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
4 Antwoorden
1094 Weergaven
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
Annuleer
Avatar
Bob The Cow
Beste antwoord

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

0
Avatar
Annuleer
Brandon Lackey
Auteur

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
Beste antwoord

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
Annuleer
Brandon Lackey
Auteur

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
Auteur Beste antwoord

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

0
Avatar
Annuleer
Avatar
Master
Beste antwoord

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
Annuleer
Brandon Lackey
Auteur

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"]]

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