[IMP] crm_iap_lead: allow industries to match several reveal ids
Reveal industries were naively implemented to match a single ID on the reveal service side. While this is very convenient from a technical point of view, it does not really work on the user end, since various industries are very similar and some of them could be merged to ease usability. This commit allows the crm.iap.lead.industry to have several reveal_ids. Since we don't want to make this too complicated, we simply stored them as a Char and separate them with a ",". They are split right before being sent to IAP and all reveal ids are merged back into a single list, making it work the same way as before on the IAP side. We also took this opportunity to completely remove some of the listed industries, since after some research they appear to give absolutely no result. UPG PR odoo/upgrade#2288 Task-2471703
This commit is contained in:
@@ -1,29 +1,21 @@
|
||||
"id",name,reveal_id
|
||||
"crm_iap_lead_industry_30","Consumer Discretionary","30"
|
||||
"id",name,reveal_ids
|
||||
"crm_iap_lead_industry_30_155","Consumer Discretionary","30,155"
|
||||
"crm_iap_lead_industry_33","Consumer Staples","33"
|
||||
"crm_iap_lead_industry_69","Insurance","69"
|
||||
"crm_iap_lead_industry_69_157","Banks & Insurance","69,157"
|
||||
"crm_iap_lead_industry_86","Media","86"
|
||||
"crm_iap_lead_industry_114","Real Estate","114"
|
||||
"crm_iap_lead_industry_136","Transportation","136"
|
||||
"crm_iap_lead_industry_138","Utilities","138"
|
||||
"crm_iap_lead_industry_146","Industrials","146"
|
||||
"crm_iap_lead_industry_138_156","Energy & Utilities ","138"
|
||||
"crm_iap_lead_industry_148","Materials","148"
|
||||
"crm_iap_lead_industry_149","Telecommunication Services","149"
|
||||
"crm_iap_lead_industry_150","Consumer Services","150"
|
||||
"crm_iap_lead_industry_151","Diversified Consumer Services","151"
|
||||
"crm_iap_lead_industry_150_151","Consumer Services","150,151"
|
||||
"crm_iap_lead_industry_152","Retailing","152"
|
||||
"crm_iap_lead_industry_153","Food & Staples Retailing","153"
|
||||
"crm_iap_lead_industry_154","Food, Beverage & Tobacco","154"
|
||||
"crm_iap_lead_industry_155","Household & Personal Products","155"
|
||||
"crm_iap_lead_industry_156","Energy Equipment & Services","156"
|
||||
"crm_iap_lead_industry_157","Banks","157"
|
||||
"crm_iap_lead_industry_158","Diversified Financial Services","158"
|
||||
"crm_iap_lead_industry_159","Diversified Financials","159"
|
||||
"crm_iap_lead_industry_153_154","Food, Beverage & Tobacco","153,154"
|
||||
"crm_iap_lead_industry_158_159","Diversified Financials & Financial Services","158,159"
|
||||
"crm_iap_lead_industry_160","Health Care Equipment & Services","160"
|
||||
"crm_iap_lead_industry_161","Pharmaceuticals, Biotechnology & Life Sciences","161"
|
||||
"crm_iap_lead_industry_162","Capital Goods","162"
|
||||
"crm_iap_lead_industry_163","Commercial & Professional Services","163"
|
||||
"crm_iap_lead_industry_164","Semiconductors & Semiconductor Equipment","164"
|
||||
"crm_iap_lead_industry_165","Software & Services","165"
|
||||
"crm_iap_lead_industry_166","Technology Hardware & Equipment","166"
|
||||
"crm_iap_lead_industry_167","Construction Materials","167"
|
||||
|
||||
|
@@ -10,7 +10,8 @@ class CrmIapLeadIndustry(models.Model):
|
||||
_description = 'CRM IAP Lead Industry'
|
||||
|
||||
name = fields.Char(string='Industry', required=True, translate=True)
|
||||
reveal_id = fields.Char(required=True)
|
||||
reveal_ids = fields.Char(required=True,
|
||||
help="The list of reveal_ids for this industry, separated with ','")
|
||||
color = fields.Integer(string='Color Index')
|
||||
|
||||
_sql_constraints = [
|
||||
|
||||
@@ -167,7 +167,15 @@ class CRMLeadMiningRequest(models.Model):
|
||||
payload.update({'company_size_min': self.company_size_min,
|
||||
'company_size_max': self.company_size_max})
|
||||
if self.industry_ids:
|
||||
payload['industry_ids'] = self.industry_ids.mapped('reveal_id')
|
||||
# accumulate all reveal_ids (separated by ',') into one list
|
||||
# eg: 3 records with values: "175,176", "177" and "190,191"
|
||||
# will become ['175','176','177','190','191']
|
||||
all_industry_ids = [
|
||||
reveal_id.strip()
|
||||
for reveal_ids in self.mapped('industry_ids.reveal_ids')
|
||||
for reveal_id in reveal_ids.split(',')
|
||||
]
|
||||
payload['industry_ids'] = all_industry_ids
|
||||
if self.search_type == 'people':
|
||||
payload.update({'contact_number': self.contact_number,
|
||||
'contact_filter_type': self.contact_filter_type})
|
||||
|
||||
Reference in New Issue
Block a user