Skip to content
Snippets Groups Projects
Commit 0e6e80ca authored by Pierre Rousseau's avatar Pierre Rousseau
Browse files

[IMP] crm_iap_lead: improve credits tooltip


Before this commit, the tooltip message for the credits lacks clarity when making a request for companies and contacts. The sentence 'making a total of X credits for this request' was only the total of the credits for the contacts, without the credits for the companies.
Now, the tooltip is clearer, the total takes into account the credits for the companies and the contacts.

Task-ID 2036946

closes odoo/odoo#35049

Signed-off-by: default avatarRémi Rahir (rar) <rar@odoo.com>
parent 22223e14
No related branches found
No related tags found
No related merge requests found
......@@ -62,18 +62,17 @@ class CRMLeadMiningRequest(models.Model):
# Fields for the blue tooltip
lead_credits = fields.Char(compute='_compute_tooltip', readonly=True)
lead_contacts_credits = fields.Char(compute='_compute_tooltip', readonly=True)
lead_total_credits = fields.Char(compute='_compute_tooltip', readonly=True)
@api.onchange('lead_number', 'contact_number')
def _compute_tooltip(self):
for record in self:
total_credits = CREDIT_PER_COMPANY * record.lead_number
company_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)
record.lead_contacts_credits = _("Up to %d additional credits will be consumed to identify %d contacts per company.") % (contact_credits*company_credits, record.contact_number)
record.lead_credits = _('%d credits will be consumed to find %d companies.') % (company_credits, record.lead_number)
record.lead_total_credits = _("This makes a total of %d credits for this request.") % (total_contact_credits + company_credits)
@api.depends('lead_ids')
def _compute_leads_count(self):
......
......@@ -91,6 +91,7 @@
<span attrs="{'invisible': [('search_type', '!=', 'people')]}">
<field name="lead_contacts_credits"/>
<br/>
<field name="lead_total_credits"/>
</span>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment