Thursday, 19 April 2012

How to Add custom Widget in your open ERP module

How to Add custom Widget in your open ERP module ..
 Here are steps : 
                                                        By : Pinakin Nayi
                                                               Trainee OpenERP,
                                                               E-mail :
Step 1 :
          create a folder
                   --> static
                            --> src
                                  --> xml
                                        -> lib.xml
                                  --> css
                                        -> .css

Step 2 :
          Register your xml file in
          Like this
                      'css': [ 'static/src/css/resource.css' ],
                      'js': [  'static/src/js/lib.js' ],
                       'qweb' : [ 'static/src/xml/lib.xml', ],

Step 3 : 
        In  "lib.xml"  create your template
           like ,
                    <templates id="template" xml:space="preserve">
                     <t t-name="link">
                      <div>manage your template  </div>

Step 4 :
      In  "lib.js"  create your template
           like ,

                      openerp.lib = function(instance)
                       instance.web.form.widgets.add('link', 'openerp.lib.Mywidget');
                       instance.lib.Mywidget = instance.web.form.Widget.extend( {
                              template : 'link',
                              init : function(arg)
                              console.log(' custome widget');

Step 5 : 
       In this test i have only write "manage your template" instread of that you can
      write your own template to implement ..

Step 6 : 
         Now , your Widget is ready ,
         you have to implement this in your tag.

        <field name="description" colspan="4" widget="link" />


  1. A Magento side extension and an Open ERP side module. The Magento extension is a PHP based web services improvement which is fully written and maintained by Openlabs.

    ERP Modules

  2. I have this error : View error

    Can't find field 'xxx' in the following view parts composing the view of object model xxxxxxxx':
    * xxxxxxxxxxxxx

    Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model

    I have to put the field on the colomn of my class ?

  3. Ya, U will get this. Bcz u are testing my widget in  v6.1 but i had made it for the v6.2 or latest so try in that.

  4. Add your field in py file

  5. Thanks for pointing that out. This good example of adding custom widget in open ERP module.ERP module List consists of many important modules that will make organizations run their business process.

  6. how can i remove control panel in odoo?

  7. Nice blog, very interesting to read
    I have bookmarked this article page as i received good information from this.

    Cloud Based ERP Software in India

    ERP Software Providers in Hyderabad

    ERP Software Company in Hyderabad