This question has been flagged
7 Replies
40432 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

Avatar
Discard

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

please help me

Best Answer

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.

Avatar
Discard
Author

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.

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.

Author

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.

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.

Author

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.

Best Answer

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.

Avatar
Discard
Best Answer

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.

Avatar
Discard
Best Answer
limit = "5" default_order="entry_date"


Avatar
Discard
Best Answer

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?

Avatar
Discard
Best Answer

Hello,

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

Thanks to informe me if is there any solution.

Regards.

Avatar
Discard
Best Answer

Similar ask here.

Avatar
Discard