I have some One2Many field in my model. I set limit = 5 for tree element in view. But how I can change list with possible values(80-200-500 etc.) to my custom list(for example: 10-15-etc.)?
Here my xml:
<!--
info about view:
<record model="ir.ui.view" id="view_my_id_employee_form">
<field name="name">hr.employee.property.form.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form" />
-->
<field name="adaptation_result_ids">
<tree default_order="date desc" limit="5">
<field name="name"/>
<field name="date"/>
</tree>
</field>
Maybe it is possible using Window Actions in settings?
I tried different ways but all in vain. Can you help with my problem? Thank you in advance.
/addons/web/static/src/js/views/list_view.js
render_pager: function($node) {
//...
this.$pager
//...
.find('.oe_list_pager_state')
.click(function (e) {
e.stopPropagation();
var $this = $(this);
var $select = $('<select>')
.appendTo($this.empty())
.click(function (e) {e.stopPropagation();})
.append('<option value="80">80</option>' +
'<option value="200">200</option>' +
'<option value="500">500</option>' +
'<option value="2000">2000</option>' +
'<option value="NaN">' + _t("Unlimited") + '</option>')
.change(function () {
var val = parseInt($select.val(), 10);
self._limit = (isNaN(val) ? null : val);
self.page = 0;
self.reload_content();
}).blur(function() {
$(this).trigger('change');
})
.val(self._limit || 'NaN');
});
//...
}
/my_module/template.xml
<openerp>
<data>
<template id="assets_backend_tree_pager" name="tree pager" inherit_id="web.assets_backend">
<xpath expr="//script[@src='/web/static/src/js/views/list_view.js']" position="replace">
<script type="text/javascript" src="/my_module/static/src/js/views/list_view.js"></script>
</xpath>
</template>
</data>
</openerp>
/my_module/static/src/js/views/list_view.js
// TODO code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With