Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
restaurantform_viewodooV8
1592 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
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!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
can't find table planner in Odoo8 POS for restuarant
pos restaurant odooV8
Imagine profil
Imagine profil
1
apr. 16
3303
Hide or remove button added by xpath Rezolvat
xpath inherited form_view odooV8
Imagine profil
Imagine profil
Imagine profil
Imagine profil
8
oct. 22
33118
How do I filter selection from form view?
filtering form_view res.users odooV8
Imagine profil
Imagine profil
1
mai 16
7876
Orders on a kitchen screen?
restaurant
Imagine profil
Imagine profil
Imagine profil
Imagine profil
Imagine profil
5
iul. 25
9942
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Imagine profil
0
mar. 25
2001
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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