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.

0

many2one form view search record limit

By
Prakash
on 9/10/13, 12:04 PM 2,194 views

In openerp 7 Form view many2one field box if entered value "a" default search 7 records. How to increase limit upto 25 records. I overridden name and name_search method to increase the limit to 25. After that in search view many2one field limit increased successfully but in the form view only shows 7 record. How to increase in many2one field search records in form view?

0
Eric
On 4/20/15, 2:52 PM

In the web module look for the file 'view_form.js'

web > static > src > js > view_form.js


search for this line: 'instance.web.form.CompletionFieldMixin'  ( its on line 2898 for me )

below that line is an init function.  Change this.limit = 7;  to this.limit = 25;


Note - I was able to add some dynamic ability by using a javascript ternary statement like this:

this.limit = this.name == 'stage_id' ? 25 : 7;


the 'stage_id' is the name of the stage field for the crm_leads table.  In this case it would show 25 records if the stage_id dropdown list is clicked, otherwise it sets the limit to the default 7 records for the other many2one fields.  Feel free to modify it however you need


0

Grover Menacho

--Grover Menacho--
2523
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Systems Engineer + MBA

Grover Menacho
On 9/10/13, 12:53 PM

RIght here there is a module that does what you want:

https://code.launchpad.net/~hmen/openobject-poiesis/extra-addons-poiesis

poi_limit_search adds a field on General Settings where you have to change the value and a many2one field is going to have that limit of values.

Thanks for reply limit value set in the file view_form.js. Is it possible to increase the limit for particular custom module form. If possible please give me sample code.

Prakash
on 9/10/13, 12:59 PM

Answer updated. Please check it.

GH Mediacloud, Grover Menacho
on 9/10/13, 8:16 PM

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

0 follower(s)

Stats

Asked: 9/10/13, 12:04 PM
Seen: 2194 times
Last updated: 4/20/15, 2:52 PM