Odoo Help

Welcome!

This community 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.

1

How do I limit the number of results in a tree view?

By
Alex Malone
on 7/3/13, 7:22 AM 7,138 views

Hi folks,

So, within a form view I have an embedded tree view (one2many field). This embedded view, by default, shows 80 results before it starts paging. As this is an embedded view, the number of results is simply too much to be useful. Ideally, I want to limit the number of results to 10.

Now, I have found how to change the number of results system wide but that is not what I want. I only want to change the number of results on this one single view whilst leaving the other views unaffected. Is this functionality possible? If it is not possible out of the box, has anyone written any code to update the web client to make it possible?

Code in question:

<field name="activitylog" colspan="3" nolabel="1" >
      <tree string="Activity Log Entries">
            <field name="entry_date" />
            <field name="activity_type" />
            <field name="name" />
            <field name="state" />
            <field name="contact_id" />
            <field name="user_id" />
            <button type="object" string="Open Activity" name="button_view_activity" icon="gtk-open" />
       </tree>
</field>

I want that tree view to be limited by results. Many thanks

can you please tell me how you fetch all the 80 records in the tree view..............?

Praveen Upadhyaya
on 4/19/14, 7:13 PM

please help me

Praveen Upadhyaya
on 4/19/14, 7:13 PM
2

Ghanshyam Prajapati

--Ghanshyam Prajapati--
1377
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 7/3/13, 7:41 AM

Hi Alex, Try

<field name="limit">150</field>

in your action (XML file).

Try Following,

for example,

<record id="action_your_object_form" model="ir.actions.act_window">
    <field name="name">Your Object Name</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">your.object</field>
    <field name="view_type">form</field>
    <field name="limit">150</field>
    <field name="view_mode">tree,form</field>
</record>

Hope this work for you.

Thanks for the quick response but I don't think this will work. Like I said in the original question, the tree view in question is embedded, meaning that it is a one2many field within a form and the tree view for that one2many field is defined inline.

Alex Malone
on 7/3/13, 7:50 AM

Go to Settings / Customization / Low Level Objects / Window Actions Select the action you want to change, edit and change the field Limit, for the number of record you want to display.

Ghanshyam Prajapati
on 7/3/13, 7:55 AM

I've updated the original question to show the code in question. Again, the emphasis here is that this is an embedded tree view, meaning there are no defined actions for it so there is nothing for me to edit.

Alex Malone
on 7/3/13, 7:58 AM

If you are using OpenERP v7, then GO to Settings / Technical / Windows Actions. Select the action you want to change, edit and change the field Limit, for the number of record you want to display.

Ghanshyam Prajapati
on 7/3/13, 8:00 AM

I am using v7. However, like I've said, there is no action defined for this view! Therefore there is nothing to edit in the settings area. As a test, I edited all window actions where the destination model matched what I wanted, but it didn't change anything. I will keep searching for a proper code solution but I expect I am going to have to hack the web client so that it accepts an additional arguement on one2many fields that sets the limit.

Alex Malone
on 7/3/13, 8:07 AM
1
kaynis
On 9/10/13, 8:30 AM

A quick fix which shows only 10 items at a time on sales order. Go to settings-->customization-->window actions--> look for the sales order window action and edit/change the Limit from 80 to 10 or to any number you wish to reduce the number of items displayed at a time to. You may have to add this number of items in the .js (C:\Program Files (x86)\OpenERP 6.1-1\server\openerp\addons\web\static\src\js open view_list.js and add to the list bwt line 273 and 278) file of web module as well. That is what I have done to reduce the number of items displayed in tree view of Sales Order. This does not however stop you from creating more that 10 items which i think is what you want. If you locate the window action of module of interest you can apply this same process to it.

0
Alan Luo
On 11/9/16, 8:51 PM

if changed \addons\web\static\src\js\view_list.js, like add 'limit': 18, on odoo 8.0, the all tree views will change to limited number of 18, even you've setup limited number on action view.

I would ask question again: I only want to change the number of results on this one single view whilst leaving the other views unaffected. Is this functionality possible?

0
Omar OUHARI
On 11/29/15, 11:31 AM

Hello,

I have the same issu. did you find a solution.

Thanks to informe me if is there any solution.

Regards.

0
Xsias
On 9/10/13, 8:09 AM

Similar ask here.

0
Hardik Shah
On 4/21/14, 5:22 AM

Refer the link bugs.launchpad.net/openerp-web/+bug/1310486

I have provided a view_form.js patch.

you can add list_options = '{"limit":10}' as O2M field attribute.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/3/13, 7:22 AM
Seen: 7138 times
Last updated: 11/9/16, 8:54 PM