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

How to limit the choice in radio button depending on other fields

Odebírat

Get notified when there's activity on this post

This question has been flagged
restaurantform_viewodooV8
1546 Zobrazení
Avatar
Sonny

I need to make the radio button option to only "container" when the values of direction='export', transport='ocean' and ocean_shipment_type='fcl'.

Here are the snippets of models involved:

class FreightShipment(models.Model): 
    _name = 'freight.shipment'

    direction = fields.Selection(([('import', 'Import'), ('export', 'Export')]), string='Direction' )
    transport = fields.Selection(([('air', 'Air'), ('ocean', 'Ocean'), ('land', 'Land')]),
                                 string='Transport Via')
    ocean_shipment_type = fields.Selection(([('fcl', 'Full Container(FCL)'),
                                             ('lcl', 'Less Container(LCL)')]),
                                           string='Ocean Shipment Type')
    freight_packages = fields.One2many( 'shipment.package.line', 'shipment_id')
class ShipmentPackageLine(models.Model): 
    _name = 'shipment.package.line'
    _rec_name = 'package'

     package_type = fields.Selection([('item', 'Loose Cargo'), ('container', 'Containerized')] ,
                                    string="Package Type", default='item')
     ...

Here is the XML view snippet:

<record model="ir.ui.view" id="freight_shipment_form_view"> 
   <field name="name">freight.shipment.form.view</field>
   <field name="model">freight.shipment</field >
   ...
   <sheet>
      ...
      <div class="oe_title mb24">
         <h1>
            <field class="text-break" name="name" default_focus="1" readonly="1"/>
         </ h1>
         <h3>
            <field name="direction" widget="radio" required="1" options="{'horizontal': true}"/>
         </h3>
      </div>
      ...
      <group string="Transport Details">
         <field name="is_transport_read_only" invisible="1" />
         <group>
            <field name="transport" widget="radio" options="{'horizontal': true}" required="1" readonly="is_transport_read_only"/>
         </group>
         <group>
            <field name ="ocean_shipment_type" invisible="shipment != 'ocean'" required="shipment == 'ocean'"/>
            <field name="inland_shipment_type" invisible="transport != 'land'" required="transport == 'land'"/>
         </group>
      </group>
      ...
      <notebook>
         ...
        <page string="Package Details" invisible="direction != 'export'">
           <field name="freight_packages" nolabel="1" widget="one2many_list">
              <tree string="Package">
                 <field name="name" required="1 "/>
                 ...
              </tree>
              <form string="Package">
                 <group>
                    <label for="package_type"/>
                    <div>
                       <field name="package_type" widget="radio" options="{'horizontal':True}"/>
                    </div>
                 </group>
                 <group invisible="package_type != 'container'">
                    <group string="Containerized">
                       <field name="name" required="1"/>
                    </group>
                    ...
                 <group invisible="package_type != 'item'">
                    <group string="Loose Cargo">
                       <field name="name" required="1"/>
                    </group>
                 ...


Here is the solution Microsoft pilot recommended but this not worked.

# Package type options 
@api.onchange('direction', 'transport', 'ocean_shipment_type')
def _onchange_shipment_conditions(self):
   for package in self.freight_packages:
      if self.direction == 'export' and self.transport == ' ocean' and self.ocean_shipment_type == 'fcl':
         package.package_type = 'container'
         package.fields_get()['package_type']['selection'] = [('container', 'Containerized')]
      else:
         package.fields_get()['package_type']['selection'] = [('item', 'Loose Cargo'), ('container', 'Containerized')]


How to fix my issue?



0
Avatar
Zrušit
OdooBot

Sehr geehrte Damen und Herren,

 

ich bin bis einschließlich 03.01.2025 nicht im Büro. Eingehende E-Mails werden nicht zeitnah bearbeitet oder weitergeleitet.

 

Für dringende allgemeine Anfragen bitte ich Sie unsere Info-E-Mail-Adresse zu verwenden (info@be4energ.com).

 

Für Angebotsanfrage oder Fragen zu Projekten oder Planungen ist unser Projektierungsteam (projects@be4energy.com) für Sie erreichbar.

 

Mit herzlichem Gruße

 

Stefan Galler

 

 

Dear Sir or Madam,

 

I will be out of the office until January 3rd, 2025. Incoming emails will not be processed or forwarded promptly.

 

For urgent general inquiries, please use our general email address (info@be4energ.com).

 

For requests for quotations or questions regarding projects or planning, our project planning team (projects@be4energy.com) is available to assist you.

 

With kind regards,

 

Stefan Galler

 

 

 

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
can't find table planner in Odoo8 POS for restuarant
pos restaurant odooV8
Avatar
Avatar
1
dub 16
3291
Hide or remove button added by xpath Vyřešeno
xpath inherited form_view odooV8
Avatar
Avatar
Avatar
Avatar
8
říj 22
33069
How do I filter selection from form view?
filtering form_view res.users odooV8
Avatar
Avatar
1
kvě 16
7847
Orders on a kitchen screen?
restaurant
Avatar
Avatar
Avatar
Avatar
Avatar
5
čvc 25
9904
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Avatar
0
bře 25
1982
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