Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
8196 Lượt xem

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;  });
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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); }, }) })


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 19
12672
0
thg 4 16
26116
1
thg 9 20
5131
0
thg 2 19
6430
3
thg 4 18
31885