[IMP] partner_portal_extra_link: fix dependency and clean a view

This commit is contained in:
Stéphan Sainléger
2026-06-22 21:35:49 +02:00
parent c8d6b8f6c4
commit a213def5a1
3 changed files with 25 additions and 26 deletions

View File

@@ -35,15 +35,16 @@ and only if the portal user belongs to a company (has a `parent_id`).
and `wiki_homepage_url`.
2. The backend partner form view is extended to show these fields after the tags
field, hidden for individual contacts (non-company partners).
3. The portal layout template (`portal.portal_layout`) is extended to inject
clickable links into the "My Details" section. The links are read from
`user_id.partner_id.parent_id` (the portal user's parent company).
3. The portal template `portal.portal_contact` (sidebar contact section on
`/my/home`) is extended to inject clickable links from the portal user's
parent company (`user_id.partner_id.parent_id`). A `parent` variable is
captured via `t-set` to avoid repeated relation lookups.
## Dependencies
This module depends on:
- `base`: Odoo base module
- `portal`: Odoo portal module (provides the portal layout templates)
No external Python dependencies are required.

View File

@@ -12,7 +12,7 @@
"summary": "add extra links to user portal as visio url and wiki url",
# any module necessary for this one to work correctly
"depends": [
"base",
"portal",
],
"qweb": [],
"external_dependencies": {

View File

@@ -1,32 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Template /my/home -->
<!-- Template /my/home : extra links for partner parent company -->
<template id="portal_my_home_partner_extra_links" name="Portal My Home: extra links" inherit_id="portal.portal_contact" priority="40">
<xpath expr="//div[hasclass('o_portal_contact_details')]" position="inside">
<t t-if="user_id.partner_id.parent_id">
<t t-if="user_id.partner_id.parent_id.visio_url">
<hr class="mt-1 mb-0"/>
<div>
Salle de visio : <br/>
<a t-att-href="user_id.partner_id.parent_id.visio_url" target="_blank">
<b><t t-out="user_id.partner_id.parent_id.visio_url" /></b>
</a>
</div>
</t>
<t t-set="parent" t-value="user_id.partner_id.parent_id"/>
<t t-if="parent.visio_url">
<hr class="mt-1 mb-0"/>
<div>
Salle de visio : <br/>
<a t-att-href="parent.visio_url" target="_blank">
<b><t t-out="parent.visio_url" /></b>
</a>
</div>
</t>
<t t-if="user_id.partner_id.parent_id">
<t t-if="user_id.partner_id.parent_id.wiki_homepage_url">
<hr class="mt-1 mb-0"/>
<div>
Gare centrale : <br/>
<a t-att-href="user_id.partner_id.parent_id.wiki_homepage_url" target="_blank">
<b><t t-out="user_id.partner_id.parent_id.wiki_homepage_url" /></b>
</a>
</div>
</t>
<t t-if="parent.wiki_homepage_url">
<hr class="mt-1 mb-0"/>
<div>
Gare centrale : <br/>
<a t-att-href="parent.wiki_homepage_url" target="_blank">
<b><t t-out="parent.wiki_homepage_url" /></b>
</a>
</div>
</t>
</xpath>