[FIX] website_{crm_partner_assign,customer}: fix 404 when crawling

When website_customer is not installed, some endpoints are not handled
by the router, causing the following tests to fail:

- test_10_crawl_public
- test_20_crawl_demo
- test_30_crawl_admin

Those tests were failing due to /customers responding with 404.

Indeed, the route /customers is defined in website_customer, but had
some usage within website_crm_partner_assign, causing tests to fail when
the former module is not installed.

The new behavior can be explained as follows:

- module website_crm_partner_assign on its own will lose the hyperlink.
- module website_customer will now inherit the view definition in order
to wrap the targeted HTML text elements with an anchor tag.

Closes #33344

Signed-off-by: Christophe Simonis <chs@odoo.com>
This commit is contained in:
Johan Demaret Rivarola
2019-05-13 16:34:27 +00:00
parent b03af37462
commit 2a14eea095
2 changed files with 12 additions and 9 deletions
@@ -170,18 +170,12 @@
<template id="references_block" name="Partner References Block">
<t t-if="any([p.website_published for p in partner.implemented_partner_ids])">
<h3 id="references">References</h3>
<div t-foreach="partner.implemented_partner_ids" t-as="reference" class="media">
<t t-if="reference.website_published">
<a class="pull-left" t-attf-href="/customers/#{slug(reference)}">
<span t-field="reference.image_small" t-options='{"widget": "image", "class": "center-block"}'/>
</a>
<div t-foreach="partner.implemented_partner_ids" t-if="reference.website_published" t-as="reference" class="media">
<span t-field="reference.image_small" t-options='{"widget": "image", "class": "center-block pull-left"}'/>
<div class="media-body" style="min-height: 64px;">
<a class="media-heading" t-attf-href="/customers/#{slug(reference)}">
<span t-field="reference.self"/>
</a>
<span class="media-heading" t-field="reference.self"/>
<div t-field='reference.website_short_description'/>
</div>
</t>
</div>
</t>
</template>
@@ -208,4 +208,13 @@
</t>
</template>
<template id="references_block_href" inherit_id="website_crm_partner_assign.references_block" name="Partner References Block">
<xpath expr="//div/span" position="replace">
<a class="pull-left" t-attf-href="/customers/#{slug(reference)}">$0</a>
</xpath>
<xpath expr="//div[@class='media-body']/span" position="replace">
<a class="media-heading" t-attf-href="/customers/#{slug(reference)}">$0</a>
</xpath>
</template>
</odoo>