Odoo Help

6
3 Answers
7
Avatar

Andreas Brueckl

--Andreas Brueckl--

5381
| 7 8 7
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
3/18/13, 7:34 AM

You can change the default limit in this file:

web/addons/web/static/src/js/view_list.js

If you want to set the default limit to 10, the you can change the paragraph

defaults: {
    // records can be selected one by one
    'selectable': true,
    // list rows can be deleted
    'deletable': false,
    // whether the column headers should be displayed
    'header': true,
    // display addition button, with that label
    'addable': _lt("Create"),
    // whether the list view can be sorted, note that once a view has been
    // sorted it can not be reordered anymore
    'sortable': true,
    // whether the view rows can be reordered (via vertical drag & drop)
    'reorderable': true,
    'action_buttons': true,
    //whether the editable property of the view has to be disabled
    'disable_editable_mode': false,
},

to

defaults: {
    // records can be selected one by one
    'selectable': true,
    // list rows can be deleted
    'deletable': false,
    // whether the column headers should be displayed
    'header': true,
    // display addition button, with that label
    'addable': _lt("Create"),
    // whether the list view can be sorted, note that once a view has been
    // sorted it can not be reordered anymore
    'sortable': true,
    // whether the view rows can be reordered (via vertical drag & drop)
    'reorderable': true,
    'action_buttons': true,
    //whether the editable property of the view has to be disabled
    'disable_editable_mode': false,
    'limit': 10,
},
2 Comments
Vasiliy Birukov
3/18/13, 7:44 AM

Thanks, it work! BTW what "defaults.limit" and "options.limit". Where it setup?

Andreas Brueckl
3/18/13, 9:38 AM

I have updated my answer. It is better to use the defaults-value for the limit. I was not able to find howto setup the "options".

3
Avatar

nazarii

--nazarii--

908
| 6 5 7
Ukraine
--nazarii--
nazarii
9/6/13, 6:21 PM

Hi guys, this code is great but why don't you use standard functionality instead of editing in core web? There is already limit parameter predefined you can use declaring x2many field, for instance to limit number of sale order lines shown in sale order you can define:

        'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', limit=10, readonly=True, states={'draft': [('readonly', False)]}),

Let's use standard functionality!

1 Comment
Xsias
9/10/13, 8:00 AM

Yes, but with this solution you doesn't have the possibility to change page. You only display 10 entries and you can't see the next entries.

1
DNTQ
7/4/13, 11:39 PM

You can change in view_form.js. _.extend(view.options, { ....., limit: self.options.limit || 5, //5 is default value }

Ask a Question
Writer
Keep Informed
2 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now