|
|
""" States for some specific countries should not be offered as filtering options because
they drastically reduce the amount of IAP reveal results.
For example, in Belgium, only 11% of companies have a defined state within the
reveal service while the rest of them have no state defined at all.
Meaning specifying states for that country will yield a lot less results than what you could
expect, which is not the desired behavior.
Obviously all companies are active within a state, it's just a lack of data in the reveal
service side.
To help users create meaningful iap searches, we only keep the states filtering for several
whitelisted countries (based on their country code).
The complete list and reasons for this change can be found on task-2471703. """
for lead_mining_request in self:
countries = lead_mining_request.country_ids.filtered(lambda country:
country.code in iap_tools._STATES_FILTER_COUNTRIES_WHITELIST)
lead_mining_request.available_state_ids = self.env['res.country.state'].search([
('country_id', 'in', countries.ids)
])
|
|