[IMP] crm_reveal: Usability Improvements
- Rename labels and reorder fields - Add support for states - Add contact_filter_type - Add filter_on_size closes odoo/odoo#28968
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server saas~11.5\n"
|
||||
"Project-Id-Version: Odoo Server 13.0alpha1+e\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-10-02 10:05+0000\n"
|
||||
"PO-Revision-Date: 2018-10-02 10:05+0000\n"
|
||||
"POT-Creation-Date: 2018-12-04 09:24+0000\n"
|
||||
"PO-Revision-Date: 2018-12-04 09:24+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -34,6 +34,11 @@ msgstr ""
|
||||
msgid "(Time Now)"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "1 credit is consumed per visitor matching the website traffic conditions and whose company can be identified.<br/>"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_1
|
||||
msgid "3D Printing"
|
||||
@@ -64,11 +69,6 @@ msgstr ""
|
||||
msgid "<span class=\"o_stat_text\"> Opportunities </span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "<span> people </span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_2
|
||||
msgid "Accounting"
|
||||
@@ -239,6 +239,11 @@ msgstr ""
|
||||
msgid "Chemicals"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,help:crm_reveal.field_crm_reveal_rule__lead_for
|
||||
msgid "Choose whether to track companies only or companies and their contacts"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_23
|
||||
msgid "Civil Engineering"
|
||||
@@ -292,7 +297,17 @@ msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: selection:crm.reveal.rule,lead_for:0
|
||||
msgid "Companies + Contacts"
|
||||
msgid "Companies and their Contacts"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__company_size_min
|
||||
msgid "Company Size"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__company_size_max
|
||||
msgid "Company Size Max"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
@@ -412,11 +427,6 @@ msgstr ""
|
||||
msgid "Created on"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__calculate_credits
|
||||
msgid "Credit Used"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_222
|
||||
msgid "Data Processing & Outsourced Services"
|
||||
@@ -537,7 +547,7 @@ msgid "Energy Equipment & Services"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: code:addons/crm_reveal/models/crm_reveal_rule.py:73
|
||||
#: code:addons/crm_reveal/models/crm_reveal_rule.py:74
|
||||
#, python-format
|
||||
msgid "Enter Valid Regex."
|
||||
msgstr ""
|
||||
@@ -557,11 +567,6 @@ msgstr ""
|
||||
msgid "Events"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__extra_contacts
|
||||
msgid "Extra Contacts"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_45
|
||||
msgid "Eyewear"
|
||||
@@ -577,6 +582,21 @@ msgstr ""
|
||||
msgid "Family Services"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__contact_filter_type
|
||||
msgid "Filter On"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,help:crm_reveal.field_crm_reveal_rule__filter_on_size
|
||||
msgid "Filter companies based on their size."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__filter_on_size
|
||||
msgid "Filter on Size"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_48
|
||||
msgid "Finance"
|
||||
@@ -642,6 +662,11 @@ msgstr ""
|
||||
msgid "Forums"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "From"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_56
|
||||
msgid "Fundraising"
|
||||
@@ -802,11 +827,6 @@ msgstr ""
|
||||
msgid "IT Services"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,help:crm_reveal.field_crm_reveal_rule__lead_for
|
||||
msgid "If you track company data, one credit will be consumed per lead/opportunity created. If you track company and contacts data, two credits will be consumed. Such data will be visible in the lead/opportunity."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_66
|
||||
msgid "Import & Export"
|
||||
@@ -838,13 +858,13 @@ msgid "Industrials & Manufacturing"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model,name:crm_reveal.model_crm_reveal_industry
|
||||
msgid "Industry Tag"
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__industry_tag_ids
|
||||
msgid "Industries"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__industry_tag_ids
|
||||
msgid "Industry Tags"
|
||||
#: model:ir.model,name:crm_reveal.model_crm_reveal_industry
|
||||
msgid "Industry Tag"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
@@ -1000,12 +1020,6 @@ msgstr ""
|
||||
msgid "Leave empty to always match. Odoo will not create lead if no match"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,help:crm_reveal.field_crm_reveal_rule__company_size_max
|
||||
#: model:ir.model.fields,help:crm_reveal.field_crm_reveal_rule__company_size_min
|
||||
msgid "Leave it as 0 if you don't want to use this filter."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_79
|
||||
msgid "Legal Services"
|
||||
@@ -1036,6 +1050,11 @@ msgstr ""
|
||||
msgid "Machinery"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "Make sure you know if you have to be GDPR compliant for storing personal data."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_188
|
||||
msgid "Marine"
|
||||
@@ -1066,14 +1085,9 @@ msgstr ""
|
||||
msgid "Materials"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__company_size_max
|
||||
msgid "Max Company Size"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: sql_constraint:crm.reveal.rule:0
|
||||
msgid "Maximum 5 extra contacts are allowed!"
|
||||
msgid "Maximum 5 contacts are allowed!"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
@@ -1106,11 +1120,6 @@ msgstr ""
|
||||
msgid "Military"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__company_size_min
|
||||
msgid "Min Company Size"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_89
|
||||
msgid "Mining & Metals"
|
||||
@@ -1162,12 +1171,6 @@ msgstr ""
|
||||
msgid "Networking"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "No credit is consumed if the company is not found.<br/>\n"
|
||||
" 1 credit is consumed if the company is found.<br/>"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.actions.act_window,help:crm_reveal.crm_reveal_rule_action
|
||||
msgid "No rule found"
|
||||
@@ -1183,6 +1186,11 @@ msgstr ""
|
||||
msgid "Not Found"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__extra_contacts
|
||||
msgid "Number of Contacts"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__leads_count
|
||||
msgid "Number of Generated Leads"
|
||||
@@ -1203,6 +1211,11 @@ msgstr ""
|
||||
msgid "Only visitors of following countries will be converted into leads/opportunities (using GeoIP)."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,help:crm_reveal.field_crm_reveal_rule__state_ids
|
||||
msgid "Only visitors of following states will be converted into leads/opportunities."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: selection:crm.reveal.rule,lead_type:0
|
||||
msgid "Opportunity"
|
||||
@@ -1435,6 +1448,11 @@ msgstr ""
|
||||
msgid "Road & Rail"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: selection:crm.reveal.rule,contact_filter_type:0
|
||||
msgid "Role"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_role__name
|
||||
msgid "Role Name"
|
||||
@@ -1491,6 +1509,7 @@ msgid "Semiconductors & Semiconductor Equipment"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: selection:crm.reveal.rule,contact_filter_type:0
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__seniority_id
|
||||
msgid "Seniority"
|
||||
msgstr ""
|
||||
@@ -1555,6 +1574,11 @@ msgstr ""
|
||||
msgid "State"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,field_description:crm_reveal.field_crm_reveal_rule__state_ids
|
||||
msgid "States"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.industry,name:crm_reveal.crm_reveal_industry_128
|
||||
msgid "Stores"
|
||||
@@ -1622,7 +1646,7 @@ msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,help:crm_reveal.field_crm_reveal_rule__extra_contacts
|
||||
msgid "This is the number of extra contacts to track if their role and seniority match your criteria.Their details will show up in the history thread of generated leads/opportunities. One credit is consumed per tracked contact."
|
||||
msgid "This is the number of contacts to track if their role/seniority match your criteria. Their details will show up in the history thread of generated leads/opportunities. One credit is consumed per tracked contact."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
@@ -1680,6 +1704,11 @@ msgstr ""
|
||||
msgid "URL Expression"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "Up to"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:ir.model.fields,help:crm_reveal.field_crm_reveal_rule__sequence
|
||||
msgid "Used to order the rules with same URL and countries. Rules with a lower sequence number will be processed first."
|
||||
@@ -1735,6 +1764,11 @@ msgstr ""
|
||||
msgid "Wireless Telecommunication Services"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "additional credit(s) are consumed if the company matches this rule."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.role,name:crm_reveal.crm_reveal_role_1
|
||||
msgid "ceo"
|
||||
@@ -1750,11 +1784,6 @@ msgstr ""
|
||||
msgid "consulting"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "credits are consumed if the company matches the rule."
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.role,name:crm_reveal.crm_reveal_role_4
|
||||
msgid "customer_service"
|
||||
@@ -1775,6 +1804,11 @@ msgstr ""
|
||||
msgid "education"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "employees"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model:crm.reveal.role,name:crm_reveal.crm_reveal_role_6
|
||||
msgid "engineering"
|
||||
@@ -1870,3 +1904,8 @@ msgstr ""
|
||||
msgid "sale"
|
||||
msgstr ""
|
||||
|
||||
#. module: crm_reveal
|
||||
#: model_terms:ir.ui.view,arch_db:crm_reveal.crm_reveal_rule_form
|
||||
msgid "to"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -29,25 +29,26 @@ class CRMRevealRule(models.Model):
|
||||
|
||||
# Website Traffic Filter
|
||||
country_ids = fields.Many2many('res.country', string='Countries', help='Only visitors of following countries will be converted into leads/opportunities (using GeoIP).')
|
||||
state_ids = fields.Many2many('res.country.state', string='States', help='Only visitors of following states will be converted into leads/opportunities.')
|
||||
regex_url = fields.Char(string='URL Expression', help='Regex to track website pages. Leave empty to track the entire website, or / to target the homepage. Example: /page* to track all the pages which begin with /page')
|
||||
sequence = fields.Integer(help='Used to order the rules with same URL and countries. '
|
||||
'Rules with a lower sequence number will be processed first.')
|
||||
|
||||
# Company Criteria Filter
|
||||
industry_tag_ids = fields.Many2many('crm.reveal.industry', string='Industry Tags', help='Leave empty to always match. Odoo will not create lead if no match')
|
||||
company_size_min = fields.Integer(string='Min Company Size', help="Leave it as 0 if you don't want to use this filter.")
|
||||
company_size_max = fields.Integer(string='Max Company Size', help="Leave it as 0 if you don't want to use this filter.")
|
||||
industry_tag_ids = fields.Many2many('crm.reveal.industry', string='Industries', help='Leave empty to always match. Odoo will not create lead if no match')
|
||||
filter_on_size = fields.Boolean(string="Filter on Size", default=True, help="Filter companies based on their size.")
|
||||
company_size_min = fields.Integer(string='Company Size', default=0)
|
||||
company_size_max = fields.Integer(default=1000)
|
||||
|
||||
# Contact Generation Filter
|
||||
contact_filter_type = fields.Selection([('role', 'Role'), ('seniority', 'Seniority')], string="Filter On", required=True, default='role')
|
||||
preferred_role_id = fields.Many2one('crm.reveal.role', string='Preferred Role')
|
||||
other_role_ids = fields.Many2many('crm.reveal.role', string='Other Roles')
|
||||
seniority_id = fields.Many2one('crm.reveal.seniority', string='Seniority')
|
||||
extra_contacts = fields.Integer(string='Extra Contacts', help='This is the number of extra contacts to track if their role and seniority match your criteria.Their details will show up in the history thread of generated leads/opportunities. One credit is consumed per tracked contact.')
|
||||
|
||||
calculate_credits = fields.Integer(compute='_compute_credit_count', string='Credit Used', readonly=True)
|
||||
extra_contacts = fields.Integer(string='Number of Contacts', help='This is the number of contacts to track if their role/seniority match your criteria. Their details will show up in the history thread of generated leads/opportunities. One credit is consumed per tracked contact.', default=1)
|
||||
|
||||
# Lead / Opportunity Data
|
||||
lead_for = fields.Selection([('companies', 'Companies'), ('people', 'Companies + Contacts')], string='Data Tracking', required=True, default='companies', help='If you track company data, one credit will be consumed per lead/opportunity created. If you track company and contacts data, two credits will be consumed. Such data will be visible in the lead/opportunity.')
|
||||
lead_for = fields.Selection([('companies', 'Companies'), ('people', 'Companies and their Contacts')], string='Data Tracking', required=True, default='companies', help='Choose whether to track companies only or companies and their contacts')
|
||||
lead_type = fields.Selection([('lead', 'Lead'), ('opportunity', 'Opportunity')], string='Type', required=True, default='opportunity')
|
||||
suffix = fields.Char(string='Suffix', help='This will be appended in name of generated lead so you can identify lead/opportunity is generated with this rule')
|
||||
team_id = fields.Many2one('crm.team', string='Sales Channel')
|
||||
@@ -61,7 +62,7 @@ class CRMRevealRule(models.Model):
|
||||
# This limits the number of extra contact.
|
||||
# Even if more than 5 extra contacts provided service will return only 5 contacts (see service module for more)
|
||||
_sql_constraints = [
|
||||
('limit_extra_contacts', 'check(extra_contacts >= 0 and extra_contacts <= 5)', 'Maximum 5 extra contacts are allowed!'),
|
||||
('limit_extra_contacts', 'check(extra_contacts >= 1 and extra_contacts <= 5)', 'Maximum 5 contacts are allowed!'),
|
||||
]
|
||||
|
||||
@api.constrains('regex_url')
|
||||
@@ -89,16 +90,6 @@ class CRMRevealRule(models.Model):
|
||||
self.clear_caches() # Clear the cache in order to recompute _get_active_rules
|
||||
return super(CRMRevealRule, self).unlink()
|
||||
|
||||
@api.depends('extra_contacts', 'lead_for')
|
||||
def _compute_credit_count(self):
|
||||
""" Computes maximum IAP credit can be consumed per lead """
|
||||
credit = 1
|
||||
if self.lead_for == 'people':
|
||||
credit += 1
|
||||
if self.extra_contacts:
|
||||
credit += self.extra_contacts
|
||||
self.calculate_credits = credit
|
||||
|
||||
def _compute_leads_count(self):
|
||||
leads = self.env['crm.lead'].read_group([
|
||||
('reveal_rule_id', 'in', self.ids)
|
||||
@@ -133,12 +124,14 @@ class CRMRevealRule(models.Model):
|
||||
{
|
||||
'id': 0,
|
||||
'url': ***,
|
||||
'country_codes': ['BE', 'US']
|
||||
'country_codes': ['BE', 'US'],
|
||||
'state_codes': [('BE', False), ('US', 'NY'), ('US', 'CA')]
|
||||
},
|
||||
{
|
||||
'id': 1,
|
||||
'url': ***,
|
||||
'country_codes': ['BE']
|
||||
'country_codes': ['BE'],
|
||||
'state_codes': [('BE', False)]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -154,10 +147,21 @@ class CRMRevealRule(models.Model):
|
||||
elif regex_url == '/':
|
||||
regex_url = '.*/$' # for home
|
||||
countries = rule.country_ids.mapped('code')
|
||||
|
||||
# First apply rules for any state in countries
|
||||
states = [(country_id.code, False) for country_id in rule.country_ids]
|
||||
if rule.state_ids:
|
||||
for state_id in rule.state_ids:
|
||||
if (state_id.country_id.code, False) in states:
|
||||
# Remove country because rule doesn't apply to any state
|
||||
states.remove((state_id.country_id.code, False))
|
||||
states += [(state_id.country_id.code, state_id.code)]
|
||||
|
||||
rules.append({
|
||||
'id': rule.id,
|
||||
'regex': regex_url,
|
||||
'country_codes': countries
|
||||
'country_codes': countries,
|
||||
'state_codes': states
|
||||
})
|
||||
for country in countries:
|
||||
country_rules = self._add_to_country(country_rules, country, len(rules) - 1)
|
||||
@@ -175,16 +179,19 @@ class CRMRevealRule(models.Model):
|
||||
country_rules[country].append(rule_index)
|
||||
return country_rules
|
||||
|
||||
def _match_url(self, url, country_code, rules_excluded):
|
||||
def _match_url(self, url, country_code, state_code, rules_excluded):
|
||||
"""
|
||||
Return the matching rule based on the country and URL.
|
||||
"""
|
||||
all_rules = self._get_active_rules()
|
||||
rules_id = all_rules['country_rules'].get(country_code, [])
|
||||
|
||||
rules_matched = []
|
||||
for rule_index in rules_id:
|
||||
rule = all_rules['rules'][rule_index]
|
||||
if str(rule['id']) not in rules_excluded and re.search(rule['regex'], url):
|
||||
if ((country_code, state_code) in rule['state_codes'] or (country_code, False) in rule['state_codes'])\
|
||||
and str(rule['id']) not in rules_excluded\
|
||||
and re.search(rule['regex'], url):
|
||||
rules_matched.append(rule)
|
||||
return rules_matched
|
||||
|
||||
@@ -274,6 +281,7 @@ class CRMRevealRule(models.Model):
|
||||
'rule_id': rule.id,
|
||||
'lead_for': rule.lead_for,
|
||||
'countries': rule.country_ids.mapped('code'),
|
||||
'filter_on_size': rule.filter_on_size,
|
||||
'company_size_min': rule.company_size_min,
|
||||
'company_size_max': rule.company_size_max,
|
||||
'industry_tags': rule.industry_tag_ids.mapped('reveal_id'),
|
||||
@@ -281,10 +289,11 @@ class CRMRevealRule(models.Model):
|
||||
}
|
||||
if rule.lead_for == 'people':
|
||||
data.update({
|
||||
'contact_filter_type': rule.contact_filter_type,
|
||||
'preferred_role': rule.preferred_role_id.reveal_id or '',
|
||||
'other_roles': rule.other_role_ids.mapped('reveal_id'),
|
||||
'seniority': rule.seniority_id.reveal_id or '',
|
||||
'extra_contacts': rule.extra_contacts
|
||||
'extra_contacts': rule.extra_contacts - 1
|
||||
})
|
||||
rule_payload[rule.id] = data
|
||||
return rule_payload
|
||||
|
||||
@@ -40,9 +40,9 @@ class CRMRevealView(models.Model):
|
||||
domain.append(('create_date', '<', fields.Datetime.to_string(datetime.date.today() - relativedelta(weeks=weeks_valid))))
|
||||
self.search(domain).unlink()
|
||||
|
||||
def _create_reveal_view(self, url, ip_address, country_code, rules_excluded):
|
||||
def _create_reveal_view(self, url, ip_address, country_code, state_code, rules_excluded):
|
||||
# we are avoiding reveal if reveal_view already created for this IP
|
||||
rules = self.env['crm.reveal.rule']._match_url(url, country_code, rules_excluded)
|
||||
rules = self.env['crm.reveal.rule']._match_url(url, country_code, state_code, rules_excluded)
|
||||
if rules:
|
||||
query = """
|
||||
INSERT INTO crm_reveal_view (reveal_ip, reveal_rule_id, reveal_state, create_date)
|
||||
|
||||
@@ -19,13 +19,14 @@ class IrHttp(models.AbstractModel):
|
||||
# created from another module, e.g. website_form
|
||||
if not lead_id:
|
||||
country_code = 'geoip' in request.session and request.session['geoip'].get('country_code')
|
||||
state_code = 'geoip' in request.session and request.session['geoip'].get('region')
|
||||
if country_code:
|
||||
try:
|
||||
url = request.httprequest.url
|
||||
ip_address = request.httprequest.remote_addr
|
||||
rules_excluded = (request.httprequest.cookies.get('rule_ids') or '').split(',')
|
||||
before = time.time()
|
||||
new_rules_excluded = request.env['crm.reveal.view'].sudo()._create_reveal_view(url, ip_address, country_code, rules_excluded)
|
||||
new_rules_excluded = request.env['crm.reveal.view'].sudo()._create_reveal_view(url, ip_address, country_code, state_code, rules_excluded)
|
||||
# even when we match, no view may have been created if this is a duplicate
|
||||
_logger.info('Reveal process time: [%s], match rule: [%s?], country code: [%s], ip: [%s]',
|
||||
time.time() - before, new_rules_excluded == rules_excluded, country_code,
|
||||
|
||||
@@ -23,48 +23,51 @@
|
||||
<field name="active" widget="boolean_button" options="{'terminology': 'archive'}"/>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<div class="alert alert-info pull-right" role="alert">
|
||||
No credit is consumed if the company is not found.<br/>
|
||||
1 credit is consumed if the company is found.<br/>
|
||||
<span attrs="{'invisible': [('lead_for', '!=', 'people')]}"><field name="calculate_credits" class="mb0"/> credits are consumed if the company matches the rule.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<div class="oe_title mb8">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
<h1 class="o_row">
|
||||
<field name="name" placeholder="e.g. US Visitors"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<field name="lead_for" widget="radio"/>
|
||||
</group>
|
||||
<group>
|
||||
<group string="Website Traffic Conditions">
|
||||
<field name="country_ids" widget="many2many_tags"/>
|
||||
<field name="regex_url" widget="website_urls"/>
|
||||
<field name="sequence"/>
|
||||
</group>
|
||||
</group>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<group>
|
||||
<field name="lead_for" widget="radio"/>
|
||||
</group>
|
||||
<group string="Website Traffic Conditions">
|
||||
<field name="country_ids" widget="many2many_tags"/>
|
||||
<field name="state_ids" widget="many2many_tags" attrs="{'invisible': [('country_ids', '=', [])]}" domain="[('country_id', 'in', country_ids)]"/>
|
||||
<field name="regex_url" widget="website_urls"/>
|
||||
<field name="sequence"/>
|
||||
</group>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="alert alert-info" role="alert">
|
||||
1 credit is consumed per visitor matching the website traffic conditions and whose company can be identified.<br/>
|
||||
<span attrs="{'invisible': [('lead_for', '!=', 'people')]}">Up to <field name="extra_contacts" readonly="1" class="mb0"/> additional credit(s) are consumed if the company matches this rule.</span>
|
||||
</div>
|
||||
<div class="alert alert-info" role="alert" attrs="{'invisible': [('lead_for', '!=', 'people')]}">
|
||||
Make sure you know if you have to be GDPR compliant for storing personal data.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<group>
|
||||
<group string="Opportunity Generation Conditions">
|
||||
<field name="industry_tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True, 'no_quick_create': True}"/>
|
||||
<label for="company_size_min"/>
|
||||
<div>
|
||||
<field name="company_size_min" class="oe_inline" />
|
||||
<span> people </span>
|
||||
</div>
|
||||
<label for="company_size_max"/>
|
||||
<div>
|
||||
<field name="company_size_max" class="oe_inline" />
|
||||
<span> people </span>
|
||||
<field name="filter_on_size"/>
|
||||
<label for="company_size_min" attrs="{'invisible': [('filter_on_size', '=', False)]}"/>
|
||||
<div attrs="{'invisible': [('filter_on_size', '=', False)]}">
|
||||
From <field name="company_size_min" class="oe_inline col-sm-3" />
|
||||
to <field name="company_size_max" class="oe_inline col-sm-3" />
|
||||
employees
|
||||
</div>
|
||||
</group>
|
||||
<group string="Contact Filter" attrs="{'invisible': [('lead_for', '!=', 'people')]}">
|
||||
<field name="preferred_role_id" options="{'no_create_edit': True, 'no_quick_create': True}"/>
|
||||
<field name="other_role_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True, 'no_quick_create': True}" attrs="{'invisible': [('preferred_role_id','=', False)]}"/>
|
||||
<field name="seniority_id" options="{'no_create_edit': True, 'no_quick_create': True}"/>
|
||||
<field name="extra_contacts"/>
|
||||
<field name="contact_filter_type" widget="radio"/>
|
||||
<field name="preferred_role_id" attrs="{'invisible': [('contact_filter_type','!=', 'role')]}" options="{'no_create_edit': True, 'no_quick_create': True}"/>
|
||||
<field name="other_role_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True, 'no_quick_create': True}" attrs="{'invisible': ['|', ('preferred_role_id','=', False), ('contact_filter_type','!=', 'role')]}"/>
|
||||
<field name="seniority_id" attrs="{'invisible': [('contact_filter_type','!=', 'seniority')]}" options="{'no_create_edit': True, 'no_quick_create': True}"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator attrs="{'invisible': [('lead_type', '!=', 'lead')]}" string="Lead Data" />
|
||||
|
||||
Reference in New Issue
Block a user