3

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.

Gabriel Robert
  • 3,012
  • 2
  • 18
  • 36
  • 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 Jun 19 '16 at 14:53
  • just a wild guess....file permissions? – danidee Jun 19 '16 at 21:33
  • @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 Jun 20 '16 at 13:25
  • @danidee Didn't solve my issue :\ – Gabriel Robert Jun 20 '16 at 15:16
  • 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 Jun 21 '16 at 06:04
  • @danidee I am editing the python code and updates are done right in Odoo. It's kinda strange! Also, the problem is on my DEV/STAGING environment, which are not on the same OS. – Gabriel Robert Jun 21 '16 at 14:09
  • openerp.modules.loading: loading main/partner_trip.xml My XML is loaded, I don't understand O.o – Gabriel Robert Jun 21 '16 at 14:21

2 Answers2

3
 <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"/>
Gabriel Robert
  • 3,012
  • 2
  • 18
  • 36
-1

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.

  • I do not have views for this module. I just want menu items, the default form view is correct for my case. – Gabriel Robert Jun 20 '16 at 15:14
  • https://gist.github.com/anonymous/c1931b2cbcd441459ba9f84133f3b1dd There you go! – Gabriel Robert Jun 21 '16 at 14:00
  • Ok - I see you solved it - no need for me to look further. I am surprised at the answer - did not expect something that seems now very obvious. I did though sometimes found errors in the way that the xml is processed. Sometimes there is corruption in the database and the only way I could resolved it was by deleting the xml from the database and then upgrade the module. – Dirk van der Merwe Jun 21 '16 at 18:22