Wednesday, 25 April 2012

Creating Widget In OpenERP

library/static/src/js/library.js : -

console.log('hi..........')  // Custome message to dispaly on console
openerp.library = function(instance){
    instance.web.form.widgets.add('link', 'openerp.library.Mywidget');
    instance.library.Mywidget = instance.web.form.Widget.extend( {  //Extend the form view
        template : 'link',  // Template Name
        init : function(arg){
            console.log(' custome widget');

library/static/src/xml/library.xml :-

<?xml version="1.0" encoding="UTF-8"?>
    <templates id="template" xml:space="preserve">
        <t t-name="link">
                Currently Not Defined
    </templates> :-

    "name": "Library Management System",
    "version": "0.1",
    "author": "Hiral",
    'js': ['static/src/js/library.js',],  #Path  of js file
    'qweb': ['static/src/xml/library.xml'],  #Path of XML file

1 comment:

  1. Thanks Hiral for your post, I need to create new widget for website not web module. i tried your code nothing works. Could you post a tutorial for website module.