Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

How to "postion=replace" a Form or Tree View, Menuitem ?

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
formmenuitemtreenew
2 Respuestas
9733 Vistas
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
Descartar
Avatar
Ivan
Mejor respuesta

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
Descartar
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 Mejor respuesta

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
Descartar
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.

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Tree not showing "Add an item"
form tree
Avatar
Avatar
Avatar
Avatar
3
may 20
8357
One model, two forms and trees, how to set this up?
developement form tree
Avatar
Avatar
Avatar
3
abr 24
2718
Make a boolean field editable in a tree view with the possibility of open a form view when clicking on a row ?? Resuelto
editable form tree
Avatar
Avatar
2
nov 18
14130
How to use two specific views (tree and form view) when using ir.actions.act_window Resuelto
form tree ir.actions.act
Avatar
Avatar
2
mar 16
8762
how to use tree in form view
form view tree
Avatar
Avatar
1
mar 15
8898
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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