Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
8253 Zobrazení

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;  });
Avatar
Zrušit
Autor Nejlepší odpověď

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


Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
říj 19
12712
0
dub 16
26140
1
zář 20
5177
0
úno 19
6458
3
dub 18
31928