Gabriel Robert
Gabriel Robert

Reputation: 3080

Odoo do not add new XML file after module update

I have a module already installed inside my project with a couple of new tables. Now, I want to add XML associated with these tables to create menu items.

In my openerp.py, I had this code:

 'data': ['main.xml', 'security/ir.model.access.csv']

Now, I want to add a new file containing my XML:

 'data': ['main.xml', 
          'trips.xml',
          'security/ir.model.access.csv']

trips.xml looks like this:

<openerp>
    <data>

        <record id="action_partner_trip_form" model="ir.actions.act_window">
            <field name="name">Trips</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.partner.trip</field>
            <field name="view_type">form</field>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to create a new trip.
              </p>
            </field>
        </record>

        <menuitem action="action_partner_trip_form" name="Trips" sequence="4" parent="base.menu_sales" groups="base.group_no_one"/>
    </data>
</openerp>

I restarted the server and also updated my main package, but the new XML is not loaded into the application. Also, there are no errors inside my logs.

Of course, if I uninstall -> reinstall it, my XML is loaded and my menu items are added, but I lose precious data.

Upvotes: 3

Views: 1634

Answers (2)

Gabriel Robert
Gabriel Robert

Reputation: 3080

 <menuitem action="action_partner_trip_form" name="Trips" sequence="4" parent="base.menu_sales" groups="base.group_no_one"/>

Won't work.

we need to put an ID to the menuitem like this:

 <menuitem id="menu_trips" action="action_partner_trip_form" name="Trips" sequence="4" parent="base.menu_sales" groups="base.group_no_one"/>

Upvotes: 3

Dirk van der Merwe
Dirk van der Merwe

Reputation: 109

If you are brave, use pgAdmin III to delete the view form ir_ui_view table. Make sure that you also delete data from all the related tables such as ir_ui_view. Sometimes OpenERP does not realise that there is an update in the xml. By deleting the correct data in ir_ui_view, you ensure that the view must be recreated while the original data that you wish to keep is still stored in the database.

Just beware, if things go wrong, it can go horribly wrong if you do not know what you are doing.

The better method would be to use the OpenERP interface. Go to the menu Settings --> Technical --> User interface --> Views. Search through the views and delete the views of your module. Now update/upgrade the module again.

Upvotes: -1

Related Questions