Files
odoo_source/addons/partner_autocomplete/views/additional_info_template.xml
T
Aurélien Warnon 9620721884 [IMP] partner_autocomplete,crm_*: unify displayed "clearbit" information
PURPOSE

We make multiple calls to the clearbit API and the returned information are
shown in various different templates, although they contain the same
information.

The purpose of this commit is to unify the templates into a single one to
reduce code size and improve coherence.

SPECIFICATIONS

Currently, we have 3 ways of reaching out to the IAP clearbit api:
- When creating a partner (autocomplete service)
- When enriching an existing lead based on its email address
- When generating leads using the "Geneate Leads" button or using the website
  visitors

Every time we use the service, we log a note in the model's chatter containing
all the information returned by the cleabit service (estimated annual revenue,
media links, sector, ...).

Though using different endpoints and methods, all the calls essentially return
the same data, and the templates could be unified for consistency.

This is the goal of this commit.

We merge the 3 separate templates of each modules into a unique template that
always renders the same information to the end user.

To do that, we had to find a common module to store the template, we chose
"partner_autocomplete" as it's installed anyway as soon as "crm_iap_lead_*" is
installed.

LINKS

PR #40349
Upgrade PR odoo/upgrade#775
Task 2081471
2020-04-15 07:37:43 +00:00

112 lines
6.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="enrich_service_information">
<p t-esc="flavor_text" />
<div class="o_partner_autocomplete_enrich_info bg-white p-3 mt-3 mb-3 mr-5">
<div class="col-12 row p-0 m-0">
<div class="col-10 p-0">
<h4>
<span class="mr-3 align-middle" t-esc="name"/>
<a t-if="twitter" class="ml-2" target="_blank" t-attf-href="http://www.twitter.com/{{twitter}}">
<img src="/web_editor/font_to_img/61569/rgb(0,132,180)/22"/>
</a>
<a t-if="facebook" class="ml-2" target="_blank" t-attf-href="http://www.facebook.com/{{facebook}}">
<img src="/web_editor/font_to_img/61570/rgb(59,89,152)/22"/>
</a>
<a t-if="linkedin" class="ml-2" target="_blank" t-attf-href="https://www.linkedin.com/{{linkedin}}">
<img src="/web_editor/font_to_img/61580/rgb(0,119,181)/22"/>
</a>
<a t-if="crunchbase" class="ml-2" target="_blank" t-attf-href="https://www.crunchbase.com/{{crunchbase}}">
<img width="19px" height="19px" src="/partner_autocomplete/static/img/crunchbase.ico"/>
</a>
</h4>
<p t-esc="description"/>
</div>
<div class="col-2 p-0 text-right">
<img t-attf-src="{{logo}}" alt="Company Logo" style="max-width: 80px;"/>
</div>
</div>
<hr/>
<div class="col-12 row m-0 p-0">
<div t-if="company_type" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-building text-primary"/>
<b>Company type</b>
</div>
<div t-if="company_type" class="my-1 col-9" t-esc="company_type" />
<div t-if="founded_year" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-calendar text-primary"/>
<b>Founded</b>
</div>
<div t-if="founded_year" class="my-1 col-9" t-esc="founded_year" />
<t t-set="sectors" t-value="[]" />
<t t-if="sector_primary" t-set="sectors" t-value="sectors + [sector_primary]" />
<t t-if="industry" t-set="sectors" t-value="sectors + [industry]" />
<t t-if="industry_group" t-set="sectors" t-value="sectors + [industry_group]" />
<t t-if="sub_industry" t-set="sectors" t-value="sectors + [sub_industry]" />
<div t-if="sectors" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-industry text-primary"/>
<b>Sectors</b>
</div>
<div t-if="sectors" class="my-1 col-9">
<t t-foreach="sectors" t-as="inner_sector">
<label t-esc="inner_sector" style="font-weight:normal; padding: 2px 10px; background-color: #eeeeee; margin: 1px 0px; border-radius: 13px;"/>
</t>
</div>
<div t-if="employees" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-users text-primary"/>
<b>Employees</b>
</div>
<div t-if="employees" class="my-1 col-9" t-esc="'%.0f' % employees" />
<div t-if="estimated_annual_revenue" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-money text-primary"/>
<b>Estimated revenue</b>
</div>
<div t-if="estimated_annual_revenue" class="my-1 col-9">
<span t-esc="estimated_annual_revenue" /><span> per year</span>
</div>
<div t-if="phone_numbers" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-phone text-primary"/>
<b>Phone</b>
</div>
<div t-if="phone_numbers" class="col-9">
<t t-foreach="phone_numbers" t-as="phone_number">
<a t-attf-href="tel:{{phone_number}}" t-esc="phone_number" style="font-weight:normal; padding: 2px 10px; background-color: #eeeeee; margin: 1px 0px; border-radius: 13px;"/>
</t>
</div>
<div t-if="email" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-envelope text-primary"/>
<b>Email</b>
</div>
<div t-if="email" class="col-9">
<t t-foreach="email" t-as="email_item">
<a target="_top" t-attf-href="mailto:{{email_item}}" t-esc="email_item" style="font-weight:normal; padding: 2px 10px; background-color: #eeeeee; margin: 1px 0px; border-radius: 13px;"/>
</t>
</div>
<div t-if="timezone" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-globe text-primary"/>
<b>Timezone</b>
</div>
<div t-if="timezone" class="my-1 col-9" t-esc="timezone.replace('_', ' ')" />
<div t-if="tech" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-cube text-primary"/>
<b>Technologies Used</b>
</div>
<div t-if="tech" class="my-1 col-9">
<t t-foreach="tech" t-as="tech_item">
<label t-esc="tech_item.replace('_', ' ').title()" style="font-weight:normal; padding: 2px 10px; background-color: #eeeeee; margin: 1px 0px; border-radius: 13px;"/>
</t>
</div>
<div t-if="twitter_bio" class="my-1 p-0 col-3">
<i class="fa fa-fw mr-2 fa-twitter text-primary"/>
<b>Twitter</b>
</div>
<div t-if="twitter_bio" class="my-1 col-9">
<div t-if="twitter_followers"><t t-esc="twitter_followers"/> followers</div>
<div t-esc="twitter_bio" />
</div>
</div>
</div>
</template>
</odoo>