Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

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

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

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

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
restaurantform_viewodooV8
1571 Visualizações
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
Cancelar
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

 

 

 

Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
can't find table planner in Odoo8 POS for restuarant
pos restaurant odooV8
Avatar
Avatar
1
abr. 16
3295
Hide or remove button added by xpath Resolvido
xpath inherited form_view odooV8
Avatar
Avatar
Avatar
Avatar
8
out. 22
33092
How do I filter selection from form view?
filtering form_view res.users odooV8
Avatar
Avatar
1
mai. 16
7856
Orders on a kitchen screen?
restaurant
Avatar
Avatar
Avatar
Avatar
Avatar
5
jul. 25
9919
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Avatar
0
mar. 25
1996
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة 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 é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

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