Files
odoo_source/addons/website_knowledge/views/knowledge_templates_frontend.xml
T
0727bbe8f1 [IMP] website_knowledge: allow public users to access published articles
This commit gives the read access to public users to published articles
(website_published = True).

Task-2674460

Part-of: odoo/odoo#82315
Co-authored-by: Damien Abeloos <abd@odoo.com>
Co-authored-by: Julien Banken <jbn@odoo.com>
Co-authored-by: David Beguin <dbe@odoo.com>
Co-authored-by: Fabio Barbero <faba@odoo.com>
Co-authored-by: Thibault Delavallee <tde@odoo.com>
Co-authored-by: Aurelien Warnong <awa@odoo.com>
2022-05-13 02:58:50 +02:00

37 lines
1.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="website_knowledge_article_view_frontend" name="Website Knowledge Layout" inherit_id="knowledge.knowledge_article_view_frontend">
<xpath expr="//a[hasclass('o_favorites_toggle_button')]" position="replace">
<a t-if="not request.env.user._is_public()"
href="#" class="o_favorites_toggle_button pl-1" t-att-data-article-id="article.id">
<i t-if="article.is_user_favorite" class="fa fa-star" />
<i t-else="" class="fa fa-star-o" />
</a>
</xpath>
</template>
<template id="website_knowledge_article_tree_frontend" name="Website Knowledge Article Tree" inherit_id="knowledge.knowledge_article_tree_frontend">
<xpath expr="//section[1]" position="replace">
<t t-set="all_articles" t-value="(workspace_articles | shared_articles)"/>
<t t-set="published_articles" t-value="all_articles.filtered(lambda a: a.website_published)"/>
<t t-set="visible_articles" t-value="all_articles.filtered(lambda a: not a.website_published)"/>
<section t-if="published_articles">
<div class="h4 mb-0">Public articles</div>
<ul class="o_tree o_tree_workspace m-0 px-0 py-2">
<t t-call="knowledge.articles_template">
<t t-set="articles" t-value="published_articles"/>
</t>
</ul>
</section>
<section t-if="visible_articles">
<div class="h4 mb-0">Shared with you</div>
<ul class="o_tree o_tree_workspace m-0 px-0 py-2">
<t t-call="knowledge.articles_template">
<t t-set="articles" t-value="visible_articles"/>
</t>
</ul>
</section>
</xpath>
</template>
</odoo>