Basically I'm trying to override a function by extending it. I have the following base (simplified) code:

openerp.point_of_sale = function(db) {

    var Order = Backbone.Model.extend({

        exportAsJSON: function() {
            return {'bigobject'}
        }
    })
}

Then, I'm writing my own .js where I want to inherit and override exportAsJSON function and I'm not sure how to .extend it. Here is my erroneous approach:

openerp.my_module = function(db) {

    db.point_of_sale.Order = db.point_of_sale.Order.extend({

        exportAsJSON: function() {

            var order_data = this._super();
            //... add more stuff on object
            return order_data;
        }
    })
}

What would be the correct way of doing it?

I hope I'm providing enough information for an answer (I'm working on OpenERP by the way). Any help will be appreciated.

EDIT: More specifically, the error seems to be in the extension itself:

db.point_of_sale.Order = db.point_of_sale.Order.extend({

...even if I put a simple return 0; within my exportAsJSON function, the page doesn't load and I get the following error in my browser console:

"Cannot call method 'extend' of undefined" 
Edit
Report