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 "postion=replace" a Form or Tree View, Menuitem ?

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
formmenuitemtreenew
2 Respostas
9741 Visualizações
Avatar
Ruban Kannan

Hello everyone, 

I want to list all the product template colums (39 columns I see in pgadmin) in the Product template Form view. Adding position="replace" for fields does not work for me since I want to see all the colums.

I want to know how I can replace the existing menuitem,action and views with the new items I created. Also, how can I inject new menuitem,action and views. Below is my XML content. 

<record id="product_vape_form_view" model="ir.ui.view">
            <field name="name">product.vape.form.view</field>
            <field name="model">product.template</field>
            <field name="arch" type="xml">
                <form>
                    <group>
                        <field name="warranty" />
                        <field name="uos_id" />
                        <field name="list_price" />
                        <field name="weight" />
                        <field name="color" />
                        <field name="image" />
                        <field name="write_uid" />
                        <field name="mes_type" />
                        <field name="uom_id" />
                        <field name="description_purchase" />
                        <field name="create_date" />
                        <field name="uos_coeff" />
                        <field name="create_uid" />
                        <field name="rental" />
                        <field name="product_manager" />
                        <field name="message_last_post" />
                        <field name="company_id" />
                        <field name="state" />
                        <field name="uom_po_id" />
                    </group>
                    <group>
                        <field name="type" />
                        <field name="description" />
                        <field name="weight_net" />
                        <field name="volume" />
                        <field name="write_date" />
                        <field name="active" />
                        <field name="categ_id" />
                        <field name="sale_ok" />
                        <field name="image_medium" />
                        <field name="name" />
                        <field name="description_sale" />
                        <field name="image_small" />
                        <field name="loc_rack" />
                        <field name="track_incoming" />
                        <field name="sale_delay" />
                        <field name="track_all" />
                        <field name="track_outgoing" />
                        <field name="loc_row" />
                        <field name="loc_case" />
                    </group>
                </form>
            </field>
        </record>
        <record id="product_vape_tree_view" model="ir.ui.view">
            <field name="name">product.vape.tree.view</field>
            <field name="model">product.template</field>
            <field name="arch" type="xml">
                <tree >
                    <field name="name" />
                    <field name="create_date"/>
                    <field name="create_uid"/>
                </tree>
            </field>
        </record>
        <record id="action_product_vape_tree_view" model="ir.actions.act_window">
            <field name="name">All Products</field>
            <field name="res_model">product.template</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="product_vape_tree_view"/>
        </record>
        <menuitem id="vape.product" action="action_product_vape_tree_view" name="All Vape Products" parent="base.menu_product" />

0
Avatar
Cancelar
Avatar
Ivan
Melhor resposta

Ruben, aside from <record> tag, there is also <delete> tag.  Both works if you specify the XML ID (id) and model of the said attribute.  So, having said that:

  • You can delete a record by adding <delete id="the_xml_id_of_record_to_delete" model="the_model_to_delete/> somewhere in your XML
  • You can update a record by adding <record id = "the_xml_id_of_record_to_change" model="the_model_to_change"> ... </record>, where ... is the new content (list of fields and their values) of the record.  It will update the fields listed in the content.
  • If the record is created by other module you can specify the "full" XML ID: module_name.the_xml_id_of_record_to_change
  • Note that generally it is not advisible to change or delete a view as the view may be inherited by other modules. It is better to inherit a view instead.
  • To tie in a view to an action, you can specify it with the following XML snippet:
  • <record model="ir.actions.act_window.view" id="tie_in_view_to_action">
                <field name="sequence" eval="1"/>
                <field name="view_mode">form</field>
                <field name="view_id" ref="your_view_xml_id"/>
                <field name="act_window_id" ref="product_template_action_tree"/>
            </record>
1
Avatar
Cancelar
Ruban Kannan
Autor

Note that generally it is not advisible to change or delete a view as the view may be inherited by other modules. It is better to inherit a view instead. /// Thanks. I completely agree with the last point and I want to proceed this way. So, 1. How do I bulk replace fields in an inherited view? 2. How do I add a new menu item under an existing menu item and open the newly created View?

Ivan

Menu will call an action (in this case, a window action). Window action will call a view. So, basically you need to do the following: - Inherit the view that you need to inherit. I am not aware of any way to bulk replace field. You can replace the form, I guess, but this will be quite similar as deleting the old view and creating a new one. - Create a new action window to using the new views that you have specified - Create a new menu whose parent is an old menu (specified by XML ID) and calling the new action that you have created. Check the account/account_view.xml for example. If you really need a different view from the original view, you can create (instead of inheriting or replacing) a new view and let the old view be.

Ruban Kannan
Autor

Thx John. I want to display my new action under Sales/Products underneath Sales/Products/Products by Category. I wrote my new action as . vape is my module name, base.menu_product seems to be the id of Sales/Products. It didn't work

Ruban Kannan
Autor

See the last line of my XML for the action I wrote.

Ruban Kannan
Autor

Sorry about the confusion. This works now. I didn't include the new XML file in my data of openerp.py.

Ruban Kannan
Autor

Thx for this. So this works when I add a new line (field name="sequence" eval="1") or (field name="priority" eval="1") to the form view xml. But, since it changes the priority, it changes the default Form view. While this is okay for me, I just want to know how to associate the my custom form view only to the custom tree view I created. In other words, how to trigger the custom form view when a record in tree view is clicked.

Ivan

Ruben, please refer to the last 2 points in this answer on how to tie in a view to an action.

Avatar
Ruban Kannan
Autor Melhor resposta

I was able to inject a new Menuitem with the following line

<menuitem id="vape.product" action="action_product_vape_tree_view" name="All Vape Products" parent="base.menu_product" />

I'm still wondering how to use my custom defined Form View in place of the default product template form view "product.product_template_only_form_view"

 

0
Avatar
Cancelar
Ivan

Can't find product_template_only_form_view in my version of Odoo. Anyway, there are a couple of ways to achive that. First, the simplest one but no guarantee, is to set your custom view with a small priority. The view has a priority field in which a smaller priority (e.g. 1) will be picked first if there are more than one views defined for that model. Second, is to tie the action with the form view. In my version of Odoo, product.template is called by action with XML ID: product_template_action_tree. You can add the following record to tie in your view with this action: form

Ivan

Sorry the XML is not posted properly, I'll edit my previous answer.

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
Tree not showing "Add an item"
form tree
Avatar
Avatar
Avatar
Avatar
3
mai. 20
8369
One model, two forms and trees, how to set this up?
developement form tree
Avatar
Avatar
Avatar
3
abr. 24
2726
Make a boolean field editable in a tree view with the possibility of open a form view when clicking on a row ?? Resolvido
editable form tree
Avatar
Avatar
2
nov. 18
14142
How to use two specific views (tree and form view) when using ir.actions.act_window Resolvido
form tree ir.actions.act
Avatar
Avatar
2
mar. 16
8779
how to use tree in form view
form view tree
Avatar
Avatar
1
mar. 15
8904
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