Odoo. Restricted Fall

I have one One2Many field in my model. I set limit = 5 for the tree element. But how can I change the list with possible values ​​(80-200-500, etc.) to my custom list (for example: 10-15, etc.)?

enter image description here

Here is 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> 

Is it possible that in the settings you can use Window Actions ?

enter image description here

I tried different ways, but all in vain. Can you help with my problem? Thank you in advance.

+7
python openerp odoo-9
source share
1 answer

/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 
+5
source share

All Articles