I was able to reach this point, my NEW.js script file is loaded in /web/database/manager page.
If I create a break point in "var break_point;" it stops there.
I don't get any error, but it just don't execute the rest of the code...
openerp.MYMODULE = function (instance) {
/*just for test in a break point*/
var break_point;
/* redefine from chrome.js:412 */
instance.web.DatabaseManagerNEW = instance.web.DatabaseManager.extend( {
do_render: function() {
this._super(parent);
/* add new submit handler*/
self.$el.find("form[name=NEW_db_form]").validate({ submitHandler: self.do_NEW });
},
do_NEW: function(form) {
var self = this;
var $form = $(form),
fields = $form.serializeArray();
self.rpc("/web/database/NEW", {'fields': fields}).done(function(result) {
if (result.error) {
self.display_error(result);
return;
}
self.start();
});
},
});
/* redefine view_form.js:72 */
instance.web.FormViewNEW = instance.web.FormView.extend({
load_form: function(data) {
this._super(parent);
/* redefine button */
if (!this.sidebar && this.options.$sidebar) {
this.sidebar.add_items('other', _.compact([
self.is_action_enabled('create') && { label: _t('NEW'), callback: self.on_button_NEW }
]));
}
},
on_button_NEW: function() {
var self = this;
return this.has_been_loaded.then(function() {
return self.dataset.call('copy', [self.datarecord.id, {}, self.dataset.context]).then(function(new_id) {
self.record_created(new_id);
self.to_edit_mode();
});
});
},
});
};
This code inserted in those files works, but not in my NEW.js file.
Hi Carlos,
how and when you need to use that new widgets that you are creating?. Note that when you use extend you are creating a new widget and normally you need to use it with a qweb client template and/or use it through a client action or a new kind of view. What is the need for those new widgets?. I think that the reason that your code is not working relies in that questions.
Provide more info about what you need to do to be able to help you. I you just wanna change the behavior of the original widget you need to use 'include' not 'extend'. The difference is that include change the widget in place and extend return a copy of the widget with the changes