I am trying to call python function from javascript.
Python class:
class message_of_the_day(osv.osv):
_name = "message_of_the_day"
def my_method(self, cr, uid, context=None):
return {"hello": "world")}
Javascript file:
openerp.oepetstore = function(instance)
{
instance.oepetstore.MyClass = instance.web.Class.extend(
{
hi_start: function()
{
var self = this;
var model = new instance.web.Model("message_of_the_day");
model.call("my_method", [], {context: new instance.web.CompoundContext()}).then(function(result)
{
console.log("hello world, I am working");
});
},
});
var my_object = new instance.oepetstore.MyClass();
my_object.hi_start();
}
When I run this module, the page stopped loading.
What am I doing wrong here?
Any help???