Thursday, 19 April 2012

OpenERP Create Web Module

OpenERP Create Web Module

                                                                    By : Pinakin Nayi
                                                                           Trainee OpenERP (Jan 2012) ,
                                                                           Gandhinagar .

Hello ,
        You all are going to search "OpenERP Web Module". I hope this will helpful to you.
OpenERP Web Module.

--> To build web module you have to create a module at server addons.

--> You need to first create
         file similar as server addons.
Where have more parameters likes

“name”: “lib_resource”,
“category” : “Hidden”,
“description”:’Openerp web Library’,
“version”: “2.0″,

“depends”: ['web','project'],
qweb’ : ['static/src/xml/lib.xml'],
“css”: [],
“js”: ['static/src/js/lib.js'],
“auto_install”: True

--> As you see in above code. how to add your css and js and qweb templates.

        Inside your module need to manage folder structure.
        lib_resource/static/src/xml   ->  Files related to qweb templates
        lib_resourcer/static/src/js     ->  Files related to javascript which you create or code.
        lib_resource/static/lib          ->  Put your javascript related libs and js plugins….

*--> Create
        lib.js file at lib_resource/static/src/js.

        Note : Now most important rule to remember. inside lib.js you need to create openerp new namespace lib_resource.
        openerp.lib_resource = function(openerp)
            var myTemplate  =  ’link’,   // template for qweb rendering … we can manage it as per our requirement.
            Here you can create new function or global variables.
            Also if you want to modify or inherit any existing class or libs the  here you can manage that.
            Here you can inherit any existing class and modify its operation and also able to create new classes…

--> lib.xml  [ at ] lib_resource/static/src/xml

 This file holds information regarding qweb template’s.
What is qweb???
when we try to load the page then templates render on qweb.js and qweb2.js
these 2 files are containing all the information well i also do not know deeply about this because we have never try to know that thing.
meanly it is used for loading the templates for different views
 example :
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <templates id=”link1” xml:space=”preserve”>   
        <t t-name=”link”>
            <div>………………… manage your template……………    </div>

--> OpenERP Web Module { Level 2 } :
    If you want to create new  widget for form.
    openerp.lib = function(openerp)
        openerp.web.form.<class name> = openerp.web.form.<class name>.extend({
            ….. manage your code …..

For getting more grips on it review all most web addons in side server addons folders.

Note : ( Remember )
    OpenERP have main important files are located at :
    -->addons/web/static/src/js :-
        Here all js are main core js and on this other openerp javascript depended.
        boot.js, core.js, crome.js and data.js files are the heart of openerp framework.
        Where view_form.js, view_page.js and view_list.js are also most important to render list view and form views.
        Also all other files in this same directory are most important files.
        OpenERP have user jqeury differed all most in code. So need to grip on it too.
        addons/web/static/src/xml :- base.xml

This file hold all most all presentation view related templates.


  1. Okay, I had tried this, but I have a question.

    How do you make this visible through like a button?

  2. you can try widget="link" in your xml file button code.

  3. please explain more about wizards & qweb with example.
    I'm still confused with those things.thanks :-)

    1. This comment has been removed by the author.

    2. Hi, qweb is very complex in openerp here i described the widget is similar example.
      And for wizard similar all the things only we set target as 'new' in action which will call the new wizard.
      Here example in all the remaining things are same only you have to change 'target'...

      Convert to opportunity



  4. Please tell how to inherit js functions