Skip to Content
Menu
This question has been flagged
1 Atsakyti
7680 Rodiniai

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;  });
Portretas
Atmesti
Autorius Best Answer

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


Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
2
spal. 19
11865
0
bal. 16
25382
1
rugs. 20
4384
0
vas. 19
5550
3
bal. 18
30731