This question has been flagged
3 Replies
20613 Views

There are a lot of listviews in OpenERP. They work very good and nice. I often use listviews for sales/addresbook/contacts and for products.

The number of lines can be choosen:

  • 24 lines
  • 80 lines
  • 100 lines
  • 200 lines
  • 500 lines
  • unlimited lines

The default value is always: 24.

I would like to have an other default value.

Is it possible to set the default value in the configuration parameters, if so how? E.g. on a system basis, on a per screen basis or is it possible to keep the default value of the last typed in value?

Avatar
Discard
Best Answer

The default limit for a list view is set on the corresponding Window Action.


VIA THE USER INTERFACE:

Window Actions are managed via:

Settings -> Customization -> Low Level Objects -> Actions -> Window Actions

Because things like Products can be viewed from many different places ...

Sales -> Products -> Products

Sales -> Products -> Products by Category (and then select a Category)

Purchases -> Products -> Products

Warehouse -> Products -> Products

POS Backend -> Products -> Products

Tools -> Configuration -> Lunch -> Products

... if you search for 'product.product' in the Object field, you will see 6 Window Actions named 'Products'.

So it is better to search for the Menu item, via:

Settings -> Customization -> User Interface -> Menu Items

... and then open the Action from there.

When you do, you will see the default value in the Limit field - and you can change this value from 80 to anything you want:

image description


VIA XML:

Change the limit field in the window action definition:

action add <field name="limit">your_default_limit</field>
Avatar
Discard

This solution update the limit of main model, but what about child view, for e.g. if we want to extend the limit of one2many field. is it possible to do through configuration?

Best Answer

You  just need to add the limit value to your one2many field in python


ex: line_id = fields.One2many('res.user', 'objectif_week', limit=4, default=default_get)

Avatar
Discard

The One2many`limit` is an optional limit to use upon read. The OP asks to limit the lines shown in the list view (v6.1) and the provided code is written in the new API which is available since Odoo 8.