Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
273 Visualizzazioni

I want to add the pivot view to the account.move (v.17)model and its not showing

My XML file is as follows:

<record model="ir.actions.act_window" id="sale_aero.action_account_move_inherit">

            <field name="name">sale.aero.account.move.pivot.inherit</field>

            <field name="res_model">account.move</field>

            <field name="view_mode">tree,form,pivot,graph</field>

            <field name="context">{'search_default_posted': 1}</field>

            <field name="help" type="html">

                <p class="o_view_nocontent_smiling_face">

                    Create a new accounting entry

                </p>

            </field>

        </record>


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

            <field name="name">account.move.pivot</field>

            <field name="model">account.move</field>

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

                <pivot string="Account Moves">

                    <field name="siglas_inv" type="col"/>

                    <field name="aeropuerto_inv" type="row"/>

                </pivot>

            </field>

        </record>


    <!-- ADD THE VIEW TO THE MENU -->

        <menuitem id="sale_aero.menu_account_move_pivot"

            name="Account Moves Pivot"

            action="sale_aero.action_account_move_inherit"

            parent="account.menu_finance_entries"

            sequence="10"/>

Avatar
Abbandona
Autore Risposta migliore

Let me give you more context:

I created the following model:

class factura_aero(models.Model):

    _inherit = 'account.move'


    siglas_inv = fields.Char(string="Siglas Aeronave")

   


    aeropuerto_inv = fields.Selection(string="Codigo Aeropuerto",

                                  selection=[

                                      ('mpmg','MPMG_Gelabert'),

                                      ('mpto','MPTO_Tocumen'),

                                      ('mppa','MPPA_ Panama Pacifico'),

                                      ('otro','Otro'),

                                  ],

                                 )

    fecha_entrega_inv = fields.Date(string="Fecha de entrega", default=fields.Date.today)

    hora_entrega_inv = fields.Float(string="Hora de entrega")


    partner_id = fields.Many2one('res.partner', string="Partner")

   

    es_aero = fields.Boolean(string='Es cliente de aviación',

                                   related = 'partner_id.es_aero')


I added the new fields to the form view and it works flawlessly

I also added one of the new fields to the list view and it also works (see picture)

Then I went ahead and created this XML file to add the pivot view

<odoo>

    <data>

        <record model="ir.actions.act_window" id="sale_aero.action_account_move_inherit">

            <field name="name">sale.aero.action.account.move.pivot.inherit</field>

            <field name="res_model">account.move</field>

            <field name="view_mode">tree,form,pivot,graph</field>

            <field name="type">ir.actions.act_window</field>

            <field name="context">{'search_default_posted': 1}</field>

            <field name="help" type="html">

                <p class="o_view_nocontent_smiling_face">

                    Create a new accounting entry

                </p>

            </field>

        </record>


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

            <field name="name">account.move.pivot</field>

            <field name="model">account.move</field>

            <field name="priority" eval="2"/>

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

                <pivot string="Account Moves">

                    <field name="siglas_inv" type="col"/>

                    <field name="aeropuerto_inv" type="row"/>

                </pivot>

            </field>

        </record>





    </data>

</odoo>

As you can see in the picture above, the pivot option does not show. I checked my code against the code in your example and I don't see a difference.

Is there something I am missing?

Avatar
Abbandona