In customer master, when I entering the state I clicked search more option. It lists only 160 items where actually it contains more than that. So I checked it found that the search view only list 160 items even the master file contain more than that.
dataset.name_search(search_val, self.build_domain(), 'ilike', 160).done(function(_data) {
self._search_create_popup("search", _data);
} `
When changing 160 to 161, the search form shows 161 items.
So how can I set this to unlimited (ie. as much as the items there) and moreover is it safe to change the value within Odoo? Or how can I do this in other way?
Thanks in advance
On the Partner form, the State field has a domain
that is enforced if your partner has their Country selected. This means that if you choose "United States" as the Country, then it will only show States that also have a Country of "United States"
However, even when the Country is not selected, it will still restrict the number of States shown in the Search more... popup.
I'm not sure why, but if you:
Then it will return all available States...
It seems that this is a known issue with no plan to fix (at least not to backport to stable versions once it is fixed). See these Github Issues reports (below). This still exists on Odoo 11, even on demo.odoo.com
There are ways to work around this issue, but it requires modifying the JavaScript (as you mentioned it in your question, you may have some idea about this already). You can see this question on the Odoo forum, which has a couple of snippets.
Basically, the solution requires overriding the name_search
function out of addons/web/static/src/js/framwork/data.js
name_search: function (name, domain, operator, limit) {
# This is the magic
limit = 0;
# Just the above line
return this._model.call('name_search', {
name: name || '',
args: domain || false,
operator: operator || 'ilike',
context: this._model.context(),
limit: limit || 0
});
},
Note: This will globally affect all of your Odoo. If you want to restrict it to only one form (or some other criteria), then you must do so with whatever view/template you use to define your JavaScript import.
The normal way to modify that is to change the default limit
of a Window Action in XML or the GUI and it will show more or less records by default.
Notes:
You can also define that limit
change via XML on the Action.
<field name=“limit”>0</field>
You can also set the limit
attribute on a tree
element directly.
Again, you may have to test this to see which value provides the unlimited list, but you can use it like this (in the tree view XML definition):
<tree id=“...” string=“...” limit=“0”/>