Hello,
I'm coding my own list view, to use it in a js_class like this:
view name: product.product.tree
external id:
xml code: <?xml version="1.0"?>
<tree js_class="my_list_view" string="Product Variants" multi_edit="1" duplicate="false" sample="1">
<field name="default_code" string="ddd" optional="show" readonly="1"/>
bla bla...
</tree>
my JS code so far:
odoo.define('sale_product_multi_add.myviewlist', function (require) {
"use strict";
var Context = require('web.Context');
var config = require('web.config');
var ListView = require('web.ListView');
var ListController = require('web.ListController');
var ListRenderer = require('web.ListRenderer');
var core = require('web.core');
var Dialog = require('web.Dialog');
var ListController = require('web.ListController');
var ListView = require('web.ListView');
var viewRegistry = require('web.view_registry');
var _t = core._t;
console.log ("requirements imported")
var MyListRenderer = ListRenderer.extend({
_renderView: function () {
var self = this;
console.log ("up and ready") // this is never executed in modal mode, only in normal tree view
return this._super.apply(this, arguments);
},
});
var MyListView = ListView.extend({
config: _.extend({}, ListView.prototype.config, {
Renderer: MyListRenderer,
}),
});
viewRegistry.add('my_list_view', MyListView);
console.log ("listview registred")
});
As you can see, the _renderView is only executed in a normal view, when browsing products, never when the tree view in shown in a modal view, eg. when you click on a "search more..." in a sale order line to add a product.
How can I change the tree view showing in a "search more..." to add my own JS code and alter the list view normal behavior?
Thanks a lot in advance.
I have the exact same need. Have you found a solution?