I want to add my custom code inside SectionAndNoteListRenderer
But its not working. In console.log its saying Undefined.
odoo.define('pack_so_product.pack_so_product_widget', function (require) {
"use strict";
var SectionAndNoteListRenderer = require('account.section_and_note_backend');
var core = require('web.core');
var _t = core._t;
var QWeb = core.qweb;
console.log(SectionAndNoteListRenderer);
SectionAndNoteListRenderer.include({
_onAddRecord: function (ev) {
// we don't want the browser to navigate to a the # url
ev.preventDefault();
// we don't want the click to cause other effects, such as unselecting
// the row that we are creating, because it counts as a click on a tr
ev.stopPropagation();
// but we do want to unselect current row
var self = this;
this._super.apply(this, arguments);
this.unselectRow().then(function () {
var context = ev.currentTarget.dataset.context;
if (context && pyUtils.py_eval(context).open_package_product){
self._rpc({
model: 'ir.model.data',
method: 'xmlid_to_res_id',
kwargs: {xmlid: 'pack_so_product.sale_product_package_view_form'},
}).then(function (res_id) {
self.do_action({
name: _t('Add a package'),
type: 'ir.actions.act_window',
res_model: 'sale.package.product',
views: [[res_id, 'form']],
target: 'new',
context: {
'open_package_product': true
}
});
});
} else {
self.trigger_up('add_record', {context: context && [context]}); // TODO write a test, the deferred was not considered
}
});
},
});
});