Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
337 Zobrazení

I have created a model called canal_ventas to add a field (canal_ventas) to the sale order model. I have inherited all the views from sale.order, added my new field and my module works well.

I also created a list view for the canal_ventas model (called sale_order_canales_lista) so i can view and edit the records associated to it.

I want to access the view from the sale_menu_root menu but I keep getting a parse error in menuitem.

My XML code is as follows:

<?xml version='1.0' encoding='utf-8'?>

<odoo>

  <data>


    <record id="canales_ventas_view" model="ir.actions.act_window">

        <field name="name">Canales de Ventas</field>

        <field name="res_model">canal_ventas.canal_ventas</field>

        <field name="view_mode">list,form</field>


    </record>


    <!-- explicit list view definition -->

     

   <record id="sale_order_canales_lista" model="ir.ui.view">

<field name="name">sale.order.canales.lista</field>

<field name="model">canal_ventas.canal_ventas</field>

<field name="arch" type="xml">

            <list string="Canales de Ventas">   

            <field name="name"/>

<field name="canal_description"/>


            </list>

</field>

</record>


    <menuitem id="canal_ventas_lista_canales"

        name="Canales de Ventas"

        action="canal_ventas.sale_order_canales_lista"

        parent="sale.sale_menu_root"

        sequence="60"/>



  </data>

</odoo>


This is the error I get

odoo.tools.convert.ParseError: while parsing /home/odoo/src/user/canal_ventas/views/lista_canales.xml:30, somewhere inside

<menuitem id="canal_ventas_lista_canales" name="Canales de Ventas" action="canal_ventas.sale_order_canales_lista" parent="sale.sale_menu_root" sequence="60"/>


Can someone help me?

Avatar
Zrušit
Autor

Thank you very much. That solved my problem

Nejlepší odpověď

you have passed the view id in menuitem's action field. You need to pass the action id.

 <menuitem id="canal_ventas_lista_canales"

        name="Canales de Ventas"

       action="canal_ventas.sale_order_canales_lista"

 //action="canal_ventas.canales_ventas_view" 

        parent="sale.sale_menu_root"

        sequence="60"/>



Avatar
Zrušit