Skip to content
Permalink
Browse files

[IMP] crm_iap_lead*: generic improvements

Improve the usability of crm_iap_lead and crm_iap_lead_website.

Task-ID 1965687
  • Loading branch information...
pro-odoo committed Apr 15, 2019
1 parent 0a09a4d commit 8f5680eaac496826d12613a93ab9acf2bb146073
@@ -61,25 +61,20 @@ def _default_lead_type(self):
seniority_id = fields.Many2one('crm.iap.lead.seniority', string='Seniority')

# Fields for the blue tooltip
lead_number_info = fields.Integer(string='Number of Leads ', related='lead_number', readonly=True)
lead_total_credit = fields.Integer(compute='_compute_lead_total_credit')
contact_credit_per_company = fields.Integer(compute='_compute_contact_credit_per_company')
contact_total_credit = fields.Integer(compute='_compute_contact_total_credit')

@api.depends('lead_number')
def _compute_lead_total_credit(self):
for req in self:
req.lead_total_credit = CREDIT_PER_COMPANY * req.lead_number

@api.depends('contact_number')
def _compute_contact_credit_per_company(self):
for req in self:
req.contact_credit_per_company = CREDIT_PER_CONTACT * req.contact_number

@api.depends('contact_number', 'lead_number')
def _compute_contact_total_credit(self):
for req in self:
req.contact_total_credit = CREDIT_PER_CONTACT * req.contact_number * req.lead_number
lead_credits = fields.Char(compute='_compute_credits', readonly=True)
lead_contacts_credits = fields.Char(compute='_compute_credits', readonly=True)

@api.onchange('lead_number', 'contact_number')
def _compute_tooltip(self):
for record in self:
total_credits = CREDIT_PER_COMPANY * record.lead_number
contact_credits = CREDIT_PER_CONTACT * record.contact_number
total_contact_credits = contact_credits * record.lead_number
message_contact = _("""Up to %d additional credits will be consumed
per company to identify its contacts (making a
total of %d credits for this request).""")
record.lead_credits = _('%d credits will be consumed to find %d companies.') % (total_credits, record.lead_number)
record.lead_contacts_credits = message_contact % (contact_credits, total_contact_credits)

@api.depends('lead_ids')
def _compute_leads_count(self):
@@ -188,6 +183,12 @@ def _lead_vals_from_response(self, data):
lead_vals['lead_mining_request_id'] = self.id
return lead_vals

@api.model
def get_empty_list_help(self, help):
help_title = _('Create a Lead Mining Request')
sub_title = _('Generate new leads based on their country, industry, size, etc.')
return '<p class="o_view_nocontent_smiling_face">%s</p><p class="oe_view_nocontent_alias">%s</p>' % (help_title, sub_title)

@api.multi
def action_draft(self):
self.ensure_one()
@@ -86,17 +86,10 @@
<div class="row">
<div class="col-md-6">
<div class="alert alert-info" role="alert">
Up to
<field name="lead_total_credit" class="mb0"/>
credits will be consumed to find
<field name="lead_number_info" class="mb0"/>
companies.
<field name="lead_credits"/>
<br/>
<span attrs="{'invisible': [('search_type', '!=', 'people')]}">
Up to
<field name="contact_credit_per_company" class="mb0"/>
additional credits will be consumed per company to identify contacts.
(<field name="contact_total_credit" class="mb0"/>)
<field name="lead_contacts_credits"/>
<br/>
</span>
</div>
@@ -175,7 +168,6 @@

<menuitem
id="crm_iap_lead_mining_request_menu_action"
name="Lead Mining"
action="crm_iap_lead_mining_request_action"
parent="crm_menu_lead_generation"
sequence="0"/>
@@ -158,7 +158,6 @@
id="crm_reveal_rule_menu_action"
action="crm_reveal_rule_action"
parent="crm_iap_lead.crm_menu_lead_generation"
name="Visits to Leads"
sequence="5"/>

<menuitem

0 comments on commit 8f5680e

Please sign in to comment.
You can’t perform that action at this time.