跳至内容
菜单
此问题已终结

Hi i have a js in a module called odoo.define('custom1')  in that i have a backbone model like below.

i need to extend the initialize function in my custom module js.I can get the "somename" by adding require("custom1") but cant access the initialize function.


odoo.define('custom1', function(require){
var exports ={}
     exports.somename = Backbone.Model.extend({
initialize: function(test){         //some code }, });
return exports;  });
形象
丢弃
编写者 最佳答案

Sorry I got it, i solved it like this 


var test = require("custom1");
odoo.define("test3",function (require) { var Supercustom1 = test.somename;

test.somename = test.somename.extend({
    initialize:function(){     //calling super if you want     Supercustom1.prototype.initialize.apply(this, arguments); }, }) })


形象
丢弃
相关帖文 回复 查看 活动
2
10月 19
12674
0
4月 16
26119
1
9月 20
5136
0
2月 19
6433
3
4月 18
31892