I want to show a popover in a specific sales order line column, like shown in the first screenshot here : https://ibb.co/n0FP1Jf
I tried to show a popover by inheriting the Javascript class FieldOne2Many and One2ManyListView, this trick is working with FormView inheritence but the same code dosen't work with the One2ManyListView as showing in the code and the screenshot below:
CODE WORKING WITH "FormView" :
odoo.define("saleorderline_on_hover.ListView", function (require) {
"use strict";
var ListView = require("web.ListView");
var KanbanView = require("web_kanban.KanbanView");
var FormView = require("web.FormView");
var instance = openerp;
var core = require('web.core');
FormView.include({
do_show: function () {
if (this.dataset.model == 'sale.order'){
this.$el.find('tr').popover(
{
'content': function(e){
return '<p>SHOW INFORMATION HERE</p>'
},
'html': true,
'placement': function(c,s){
return $(s).position().top < 200?'bottom':'top'
},
'trigger': 'hover',
});
}
return this._super();
}
});
});
The Result of this code is the Popover shown in the screenshot here : https://ibb.co/r7bxSzq
THE SAME CODE NOT WORKING WITH "FieldOne2Many" and "One2ManyListView" :
odoo.define("saleorderline_on_hover.ListView", function (require) {
"use strict";
var ListView = require("web.ListView");
var KanbanView = require("web_kanban.KanbanView");
var FormView = require("web.FormView");
var instance = openerp;
var core = require('web.core');
var FieldOne2Many = core.form_widget_registry.get('one2many');
FieldOne2Many.include({
init: function() {
this._super.apply(this, arguments);
var One2ManyListView = this.x2many_views.list;
One2ManyListView.include({
do_show: function () {
this.x2m.$el.find('tr').popover({'content': function(e){
return '<p>SHOW INFORMATION HERE</p>'},
'html': true,
'placement': function(c,s){
return $(s).position().top < 200?'bottom':'top'
},
'trigger': 'hover',
});
}
return this._super();}
});
}
});
});
The problem here is that I can't find the "tr" or "td" element in "this.x2m.$el" by the method .find() or I'm missing something, can you please enlighten me on the subject, Thanks