Tuesday, June 19, 2012

OpenERP web – How to add custom functionalities to the sidebar

I’d like to show how you can add more functionalities to your sidebar on OpenERP web 6.1.
The interesting code from web_export_view module looks like this:

photo credits: domsense


1.    First  (line 3) define your module’s namespace.
2.    then extend (line 7) the sidebar object
3.    and override ‘add_default_sections’ method (line 9)
4.    then we add our new action with its callback to the ‘other’ section using ‘add_items’ function (line 37)
Unfortunately the sidebar is not so modular at this point. As I commented into the code, if we had a registry for sidebar sections/actions we could just define ours and register it. But, for the time being you’ll need to override the original method and maintain by copy&paste the “real default” sections/actions (for the original one, have a look at the core web module).

If you need help on  how to create your web module, check openerp_bootstrap.
A ‘must-say recommendation’: use Firebug to debug your javascript experiments, it will save you a lot of time ;)

Source: http://planet.domsense.com
Eastvantage | IT Outsourcing | Offshoring Services
For business inquiries email info@eastvantage.com

No comments:

Post a Comment