Merge PR #453 into 14.0

Signed-off-by dreispt
This commit is contained in:
OCA-git-bot 2025-02-28 09:06:10 +00:00
commit fbb32a3be2
28 changed files with 1356 additions and 0 deletions

View File

@ -0,0 +1,103 @@
====================
Document Page Portal
====================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:83751d0dd805c839f85221e62ddf9569bc2555dda895792cc05bcc5cbc4ab377
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
:target: https://github.com/OCA/knowledge/tree/13.0/document_page_portal
:alt: OCA/knowledge
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/knowledge-13-0/knowledge-13-0-document_page_portal
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=13.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows documents to be made available on the portal.
**Table of contents**
.. contents::
:local:
Configuration
=============
No configuration required.
Usage
=====
* Add a user as a follower of the document or configure the document as public so that it is visible through the user portal.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_portal%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Escodoo
Contributors
~~~~~~~~~~~~
* `Escodoo <https://www.escodoo.com.br>`_:
* Marcel Savegnago <marcel.savegnago@escodoo.com.br>
Other credits
~~~~~~~~~~~~~
The development of this module has been financially supported by:
* Escodoo <https://www.escodoo.com.br>
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
.. |maintainer-marcelsavegnago| image:: https://github.com/marcelsavegnago.png?size=40px
:target: https://github.com/marcelsavegnago
:alt: marcelsavegnago
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-marcelsavegnago|
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/13.0/document_page_portal>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -0,0 +1,2 @@
from . import controllers
from . import models

View File

@ -0,0 +1,24 @@
# Copyright (C) 2020 - TODAY, Marcel Savegnago - Escodoo).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Document Page Portal",
"summary": """
This module enables document page portal""",
"version": "14.0.1.0.0",
"category": "Knowledge Management",
"author": "Escodoo, Odoo Community Association (OCA)",
"maintainers": ["marcelsavegnago"],
"images": ["static/description/banner.png"],
"website": "https://github.com/OCA/knowledge",
"license": "AGPL-3",
"depends": ["base", "portal", "document_page"],
"data": [
"views/assets.xml",
"views/document_page.xml",
"security/document_page_portal_security.xml",
"security/ir.model.access.csv",
"views/document_page_portal_templates.xml",
],
}

View File

@ -0,0 +1 @@
from . import portal

View File

@ -0,0 +1,147 @@
# Copyright (C) 2020 - TODAY, Marcel Savegnago - Escodoo).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import http
from odoo.exceptions import AccessError, MissingError
from odoo.http import request
from odoo.osv.expression import OR
from odoo.tools.translate import _
from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager
class CustomerPortal(CustomerPortal):
def _prepare_portal_layout_values(self):
values = super(CustomerPortal, self)._prepare_portal_layout_values()
values["document_page_count"] = request.env["document.page"].search_count(
[("type", "=", "content")]
)
return values
def _document_page_get_page_view_values(
self, document_page, access_token, **kwargs
):
values = {
"page_name": "document_page",
"document_page": document_page,
}
return self._get_page_view_values(
document_page,
access_token,
values,
"my_document_pages_history",
False,
**kwargs
)
@http.route(
["/my/knowledge/documents/", "/my/knowledge/documents/page/<int:page>"],
type="http",
auth="user",
website=True,
)
def portal_my_knowledge_document_pages(
self,
page=1,
date_begin=None,
date_end=None,
sortby=None,
search=None,
search_in="content",
**kw
):
values = self._prepare_portal_layout_values()
domain = [("type", "=", "content")]
searchbar_sortings = {
"date": {"label": _("Newest"), "order": "create_date desc"},
"name": {"label": _("Name"), "order": "name"},
"parent": {"label": _("Category"), "order": "parent_id"},
}
searchbar_inputs = {
"content": {
"input": "content",
"label": _('Search <span class="nolabel"> (in Content)</span>'),
},
"all": {"input": "all", "label": _("Search in All")},
}
# default sort by value
if not sortby:
sortby = "date"
order = searchbar_sortings[sortby]["order"]
if date_begin and date_end:
domain += [
("create_date", ">", date_begin),
("create_date", "<=", date_end),
]
# search
if search and search_in:
search_domain = []
if search_in in ("content", "all"):
search_domain = OR(
[
search_domain,
["|", ("name", "ilike", search), ("content", "ilike", search)],
]
)
domain += search_domain
# pager
document_pages_count = request.env["document.page"].search_count(domain)
pager = portal_pager(
url="/my/knowledge/documents",
url_args={"date_begin": date_begin, "date_end": date_end, "sortby": sortby},
total=document_pages_count,
page=page,
step=self._items_per_page,
)
document_pages = request.env["document.page"].search(
domain, order=order, limit=self._items_per_page, offset=pager["offset"]
)
request.session["my_document_pages_history"] = document_pages.ids[:100]
values.update(
{
"date": date_begin,
"document_pages": document_pages,
"page_name": "document_page",
"default_url": "/my/knowledge/s",
"pager": pager,
"searchbar_sortings": searchbar_sortings,
"searchbar_inputs": searchbar_inputs,
"sortby": sortby,
"search_in": search_in,
"search": search,
}
)
return request.render(
"document_page_portal.portal_my_knowledge_document_pages", values
)
@http.route(
[
"/knowledge/document/<int:document_page_id>",
"/knowledge/document/<int:document_page_id>/<token>",
"/my/knowledge/document/<int:document_page_id>",
],
type="http",
auth="public",
website=True,
)
def document_pages_followup(self, document_page_id=None, access_token=None, **kw):
try:
document_page_sudo = self._document_check_access(
"document.page", document_page_id, access_token
)
except (AccessError, MissingError):
return request.redirect("/my")
values = self._document_page_get_page_view_values(
document_page_sudo, access_token, **kw
)
return request.render("document_page_portal.document_pages_followup", values)

View File

@ -0,0 +1,94 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * document_page_portal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.document_pages_followup
msgid "<em class=\"text-muted\"><small>No content</small></em>"
msgstr ""
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.document_pages_followup
msgid "<small class=\"text-right\">Category:</small>"
msgstr ""
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
#, python-format
msgid "Category"
msgstr ""
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.document_pages_followup
msgid "Current Category of this document"
msgstr ""
#. module: document_page_portal
#: model:ir.model,name:document_page_portal.model_document_page
msgid "Document Page"
msgstr ""
#. module: document_page_portal
#: model:ir.model.fields,help:document_page_portal.field_document_page__is_public
msgid ""
"If true it allows any user of the portal to have access to this document."
msgstr ""
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_home_Knowledge_document_page
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_home_menu_Knowledge
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
msgid "Knowledge Documents"
msgstr ""
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
#, python-format
msgid "Name"
msgstr ""
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#, python-format
msgid "Newest"
msgstr ""
#. module: document_page_portal
#: model:ir.model.fields,field_description:document_page_portal.field_document_page__is_public
msgid "Public Page"
msgstr ""
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
msgid "Ref"
msgstr ""
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#, python-format
msgid "Search <span class=\"nolabel\"> (in Content)</span>"
msgstr ""
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#, python-format
msgid "Search in All"
msgstr ""
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
msgid "There are currently no Knowledge Document for your account."
msgstr ""

View File

@ -0,0 +1,98 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * document_page_portal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-06-23 10:10+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.document_pages_followup
msgid "<em class=\"text-muted\"><small>No content</small></em>"
msgstr "<em class=\"text-muted\"><small>Nessun contenuto</small></em>"
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.document_pages_followup
msgid "<small class=\"text-right\">Category:</small>"
msgstr "<small class=\"text-right\">Categoria:</small>"
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
#, python-format
msgid "Category"
msgstr "Categoria"
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.document_pages_followup
msgid "Current Category of this document"
msgstr "Categoria attuale di questo documento"
#. module: document_page_portal
#: model:ir.model,name:document_page_portal.model_document_page
msgid "Document Page"
msgstr "Pagina documento"
#. module: document_page_portal
#: model:ir.model.fields,help:document_page_portal.field_document_page__is_public
msgid ""
"If true it allows any user of the portal to have access to this document."
msgstr ""
"Se vera consente ad ogni utente del portale di accedere a questo documento."
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_home_Knowledge_document_page
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_home_menu_Knowledge
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
msgid "Knowledge Documents"
msgstr "Documenti knowledge"
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
#, python-format
msgid "Name"
msgstr "Nome"
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#, python-format
msgid "Newest"
msgstr "Il più recente"
#. module: document_page_portal
#: model:ir.model.fields,field_description:document_page_portal.field_document_page__is_public
msgid "Public Page"
msgstr "Pagina pubblica"
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
msgid "Ref"
msgstr "Rif."
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#, python-format
msgid "Search <span class=\"nolabel\"> (in Content)</span>"
msgstr "Cerca <span class=\"nolabel\"> (nel contenuto)</span>"
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#, python-format
msgid "Search in All"
msgstr "Cercare fra tutti"
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
msgid "There are currently no Knowledge Document for your account."
msgstr "Al momento non ci sono documenti knowledge per il tuo account."

View File

@ -0,0 +1,121 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * document_page_portal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-27 14:08+0000\n"
"PO-Revision-Date: 2019-11-27 11:11-0300\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 2.2.4\n"
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.document_pages_followup
msgid "<em class=\"text-muted\"><small>No content</small></em>"
msgstr ""
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.document_pages_followup
msgid "<small class=\"text-right\">Category:</small>"
msgstr ""
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
#, python-format
msgid "Category"
msgstr "Categoria"
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.document_pages_followup
msgid "Current Category of this document"
msgstr ""
#. module: document_page_portal
#: model:ir.model,name:document_page_portal.model_document_page
msgid "Document Page"
msgstr ""
#. module: document_page_portal
#: model:ir.model.fields,help:document_page_portal.field_document_page__is_public
msgid ""
"If true it allows any user of the portal to have access to this document."
msgstr ""
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_home_Knowledge_document_page
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_home_menu_Knowledge
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
msgid "Knowledge Documents"
msgstr ""
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
#, python-format
msgid "Name"
msgstr "Nome"
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#, python-format
msgid "Newest"
msgstr "Mais Recentes"
#. module: document_page_portal
#: model:ir.model.fields,field_description:document_page_portal.field_document_page__is_public
msgid "Public Page"
msgstr ""
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
msgid "Ref"
msgstr ""
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#, python-format
msgid "Search <span class=\"nolabel\"> (in Content)</span>"
msgstr ""
#. module: document_page_portal
#: code:addons/document_page_portal/controllers/portal.py:0
#, python-format
msgid "Search in All"
msgstr ""
#. module: document_page_portal
#: model_terms:ir.ui.view,arch_db:document_page_portal.portal_my_knowledge_document_pages
msgid "There are currently no Knowledge Document for your account."
msgstr ""
#~ msgid ""
#~ "<br/>\n"
#~ " <b>Category:</b>"
#~ msgstr ""
#~ "<br/>\n"
#~ " <b>Categoria:</b>"
#~ msgid ""
#~ "<br/>\n"
#~ " <strong>Date:</strong>"
#~ msgstr ""
#~ "<br/>\n"
#~ " <strong>Data:</strong>"
#~ msgid "All"
#~ msgstr "Todos"
#~ msgid "Documents"
#~ msgstr "Documentos"
#~ msgid "There are no documents in your account."
#~ msgstr "Não há documentos em sua conta."

View File

@ -0,0 +1 @@
from . import document_page

View File

@ -0,0 +1,15 @@
# Copyright 2020 - TODAY, Marcel Savegnago - Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class DocumentPage(models.Model):
_inherit = "document.page"
is_public = fields.Boolean(
"Public Page",
help="If true it allows any user of the portal to have "
"access to this document.",
)

View File

@ -0,0 +1 @@
No configuration required.

View File

@ -0,0 +1,3 @@
* `Escodoo <https://www.escodoo.com.br>`_:
* Marcel Savegnago <marcel.savegnago@escodoo.com.br>

View File

@ -0,0 +1,3 @@
The development of this module has been financially supported by:
* Escodoo <https://www.escodoo.com.br>

View File

@ -0,0 +1 @@
This module allows documents to be made available on the portal.

View File

@ -0,0 +1 @@
* Add a user as a follower of the document or configure the document as public so that it is visible through the user portal.

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<record model="ir.rule" id="knowledge_user_document_page_rule">
<field name="name">Documents: knowledge user: see all</field>
<field name="model_id" ref="document_page.model_document_page" />
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4,ref('knowledge.group_document_user'))]" />
</record>
<record model="ir.rule" id="knowledge_portal_document_page_rule">
<field name="name">Documents: portal users: portal or following</field>
<field name="model_id" ref="document_page.model_document_page" />
<field name="domain_force">
[
'|', '|', ('type', '!=', 'content'), ('is_public', '=', True),
('message_partner_ids', 'child_of', [user.partner_id.commercial_partner_id.id])
]
</field>
<field
name="groups"
eval="[(4, ref('base.group_portal')),(4, ref('base.group_user'))]"
/>
</record>
</data>
</odoo>

View File

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
document_page_portal,document.page portal,document_page.model_document_page,base.group_portal,1,0,0,0
document_page_portal_user,document.page portal user,document_page.model_document_page,base.group_user,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 document_page_portal document.page portal document_page.model_document_page base.group_portal 1 0 0 0
3 document_page_portal_user document.page portal user document_page.model_document_page base.group_user 1 0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,446 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Document Page Portal</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="document-page-portal">
<h1 class="title">Document Page Portal</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:83751d0dd805c839f85221e62ddf9569bc2555dda895792cc05bcc5cbc4ab377
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/knowledge/tree/13.0/document_page_portal"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/knowledge-13-0/knowledge-13-0-document_page_portal"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/knowledge&amp;target_branch=13.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows documents to be made available on the portal.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-7">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>No configuration required.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<ul class="simple">
<li>Add a user as a follower of the document or configure the document as public so that it is visible through the user portal.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_portal%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Escodoo</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.escodoo.com.br">Escodoo</a>:<ul>
<li>Marcel Savegnago &lt;<a class="reference external" href="mailto:marcel.savegnago&#64;escodoo.com.br">marcel.savegnago&#64;escodoo.com.br</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-7">Other credits</a></h2>
<p>The development of this module has been financially supported by:</p>
<ul class="simple">
<li>Escodoo &lt;<a class="reference external" href="https://www.escodoo.com.br">https://www.escodoo.com.br</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/marcelsavegnago"><img alt="marcelsavegnago" src="https://github.com/marcelsavegnago.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/13.0/document_page_portal">OCA/knowledge</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,45 @@
odoo.define("document_page_portal.tour", function (require) {
"use strict";
var tour = require("web_tour.tour");
tour.register(
"document_page_portal_tour",
{
test: true,
url: "/my",
},
[
{
content: "Check document_page_portal is loaded",
trigger:
'a[href*="/my/knowledge/documents"]:contains("Knowledge Documents"):first',
},
{
content: "Check public document_page is loaded",
trigger:
'a[href*="/knowledge/document/"]:contains("Test Public Page 1"):first',
},
]
);
tour.register(
"document_page_portal_search_tour",
{
test: true,
url: "/my/knowledge/documents",
},
[
{
content: "Search",
trigger: "input[name='search']",
run: "text Test",
},
{
content: "Click Search.",
extra_trigger: "#wrap:not(:has(input[name=search]:propValue('')))",
trigger: ".search-submit",
},
]
);
});

View File

@ -0,0 +1 @@
from . import test_document_page_portal

View File

@ -0,0 +1,36 @@
# Copyright 2020 - TODAY, Marcel Savegnago - Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl
import odoo.tests
@odoo.tests.tagged("post_install", "-at_install")
class TestPortalDocumentPage(odoo.tests.HttpCase):
def test_01_document_page_portal_tour(self):
# Create a public document
self.env["document.page"].create(
{
"name": "Test Public Page 1",
"content": "Test content",
"is_public": True,
}
)
self.browser_js(
"/",
"odoo.__DEBUG__.services['web_tour.tour']"
".run('document_page_portal_tour')",
"odoo.__DEBUG__.services['web_tour.tour']"
".tours.document_page_portal_tour.ready",
login="portal",
)
def test_02_document_page_portal_tour(self):
self.browser_js(
"/",
"odoo.__DEBUG__.services['web_tour.tour']"
".run('document_page_portal_search_tour')",
"odoo.__DEBUG__.services['web_tour.tour']"
".tours.document_page_portal_search_tour.ready",
login="portal",
)

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2020 - TODAY, Marcel Savegnago - Escodoo
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<template
id="assets_frontend"
inherit_id="web.assets_frontend"
name="Portal Assets"
priority="15"
>
<xpath expr="//script[last()]" position="after">
<script
type="text/javascript"
src="/document_page_portal/static/src/js/document_page_portal_tour.js"
/>
</xpath>
</template>
</odoo>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2020 - TODAY, Marcel Savegnago - Escodoo
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record model="ir.ui.view" id="document_page_form_view">
<field name="name">document.page.form (in document_page_portal)</field>
<field name="model">document.page</field>
<field name="inherit_id" ref="document_page.view_wiki_form" />
<field name="arch" type="xml">
<field name="parent_id" position="after">
<field name="is_public" groups="document_page.group_document_manager" />
</field>
</field>
</record>
</odoo>

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="0">
<template
id="portal_my_home_menu_Knowledge"
name="Portal layout : Knowledge document_pages menu entries"
inherit_id="portal.portal_breadcrumbs"
priority="50"
>
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li
t-if="page_name == 'document_page' or document_page"
t-attf-class="breadcrumb-item #{'active ' if not document_page else ''}"
>
<a
t-if="document_page"
t-attf-href="/my/knowledge/documents?{{ keep_query() }}"
>Knowledge Documents</a>
<t t-else="">Knowledge Documents</t>
</li>
<li t-if="document_page" class="breadcrumb-item active">
#<span t-field="document_page.id" />
</li>
</xpath>
</template>
<template
id="portal_my_home_Knowledge_document_page"
name="Portal My Home : Knowledge Documents"
inherit_id="portal.portal_my_home"
priority="50"
>
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
<t t-if="document_page_count" t-call="portal.portal_docs_entry">
<t t-set="title">Knowledge Documents</t>
<t t-set="url" t-value="'/my/knowledge/documents'" />
<t t-set="count" t-value="document_page_count" />
</t>
</xpath>
</template>
<template id="portal_my_knowledge_document_pages" name="Knowledge Document">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True" />
<t t-call="portal.portal_searchbar">
<t t-set="title">Knowledge Documents</t>
</t>
<div t-if="not document_pages" class="alert alert-info">
There are currently no Knowledge Document for your account.
</div>
<t t-if="document_pages" t-call="portal.portal_table">
<thead>
<tr>
<th class="text-right">Ref</th>
<th class="w-100">Name</th>
<th />
<th class="text-center">Category</th>
</tr>
</thead>
<t t-foreach="document_pages" t-as="document_page">
<tr>
<td class="text-right"><a
t-attf-href="/knowledge/document/#{document_page.id}"
><small>#</small><t t-esc="document_page.id" /></a></td>
<td>
<a
t-attf-href="/knowledge/document/#{document_page.id}"
><span t-field="document_page.name" /></a>
</td>
<td />
<td class="text-center"><span
class="badge badge-pill badge-info"
t-field="document_page.parent_id.name"
/></td>
</tr>
</t>
</t>
</t>
</template>
<template id="document_pages_followup" name="Knowledge Documents Followup">
<t t-call="portal.portal_layout">
<t t-set="wrapwrap_classes" t-value="'o_portal_bg_dark'" />
<t
t-set="o_portal_fullwidth_alert"
groups="knowledge.group_document_user"
>
<t t-call="portal.portal_back_in_edit_mode">
<t
t-set="backend_url"
t-value="'/web#return_label=Website&amp;model=document.page&amp;id=%s&amp;view_type=form' % (document_page.id)"
/>
</t>
</t>
<t t-call="portal.portal_record_layout">
<t t-set="card_header">
<div class="row no-gutters">
<div class="col-md">
<h5 class="mb-1 mb-md-0">
<span t-field="document_page.name" />
<small class="text-muted"> (#<span
t-field="document_page.id"
/>)</small>
</h5>
</div>
<div class="col-md text-md-right">
<small class="text-right">Category:</small>
<span
t-field="document_page.parent_id.name"
class=" badge badge-pill badge-info"
title="Current Category of this document"
/>
</div>
</div>
</t>
<t t-set="card_body">
<div class="row mb-4">
<h1 class="col-lg-12">
<span t-field="document_page.name" />
</h1>
<div
t-if="document_page.content"
class="col-lg-12"
t-raw="document_page.content"
/>
<div t-else="" class="col-lg-10">
<em class="text-muted"><small>No content</small></em>
</div>
</div>
</t>
</t>
</t>
</template>
</data>
</odoo>

View File

@ -0,0 +1 @@
../../../../document_page_portal

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)