3
votes

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.

2
Do you always have that problem? A typical mistake while developing within an IDE: not saving (needed files) before server restart. Maybe you've forgotten to save the manifest (openerp.py)? Another problem could be the browser. Just try to reload Odoo with empty cache after updates, - CZoellner
just a wild guess....file permissions? - danidee
@CZoellner openerp.py has been saved properly. Also, it is not a cache problem because my menu item is not created inside Odoo. (Settings -> User interface -> Menu items) - Gabriel Robert
@danidee Didn't solve my issue :\ - Gabriel Robert
are you sure you don't have more than one copy of your module in a different addon path, i've experienced something like this and it turned out that i was editing another copy of the module i had in another folder. (it was in my addons path, but sequentially it came after the folder i thought i was working with)...again this is another wild guess - danidee

2 Answers

3
votes
 <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"/>
-1
votes

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.