[ADD] document_tag

This commit is contained in:
Maxime Chambreuil 2020-04-11 19:57:07 -05:00
parent 84e8bc4b32
commit d0cfa3234b
16 changed files with 177 additions and 0 deletions

21
document_tag/README.rst Normal file
View File

@ -0,0 +1,21 @@
**This file is going to be generated by oca-gen-addon-readme.**
*Manual changes will be overwritten.*
Please provide content in the ``readme`` directory:
* **DESCRIPTION.rst** (required)
* INSTALL.rst (optional)
* CONFIGURE.rst (optional)
* **USAGE.rst** (optional, highly recommended)
* DEVELOP.rst (optional)
* ROADMAP.rst (optional)
* HISTORY.rst (optional, recommended)
* **CONTRIBUTORS.rst** (optional, highly recommended)
* CREDITS.rst (optional)
Content of this README will also be drawn from the addon manifest,
from keys such as name, authors, maintainers, development_status,
and license.
A good, one sentence summary in the manifest is also highly recommended.

3
document_tag/__init__.py Normal file
View File

@ -0,0 +1,3 @@
# Copyright (C) 2020 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

View File

@ -0,0 +1,19 @@
# Copyright (C) 2020 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Document Tag",
"version": "13.0.1.0.0",
"category": "Knowledge Management",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/knowledge",
"license": "AGPL-3",
"depends": ["document_page"],
"data": [
"security/ir.model.access.csv",
"security/ir_rule.xml",
"views/document_tag.xml",
"views/document_page.xml",
],
"development_status": "Beta",
"maintainers": ["max3903"],
}

View File

@ -0,0 +1,6 @@
# Copyright (C) 2020 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import (
document_tag,
document_page,
)

View File

@ -0,0 +1,9 @@
# Copyright (C) 2020 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class DocumentPage(models.Model):
_inherit = "document.page"
tag_ids = fields.Many2many("document.tag", string="Tags")

View File

@ -0,0 +1,12 @@
# Copyright (C) 2020 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class DocumentTag(models.Model):
_name = "document.tag"
_description = "Document Tag"
name = fields.Char(index=True)
parent_id = fields.Many2one("document.tag", string="Parent")
company_id = fields.Many2one("res.company", string="Company")

View File

@ -0,0 +1,3 @@
* `Open Source Integrators <https://www.opensourceintegrators.com>`_
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>

View File

@ -0,0 +1 @@
This module allows you to manage tags for document pages and categories.

View File

@ -0,0 +1,7 @@
To use this module, you need to:
* Go to *Knowledge > Configuration > Tags*
* Create tags
* Go to *Knowledge > Pages* or *Knowledge > Categories*
* Create or select an existing record
* Set the tags

View File

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
document_tag_user,document.tag user,model_document_tag,knowledge.group_document_user,1,0,0,0
document_tag_manager,document.tag manager,model_document_tag,document_page.group_document_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 document_tag_user document.tag user model_document_tag knowledge.group_document_user 1 0 0 0
3 document_tag_manager document.tag manager model_document_tag document_page.group_document_manager 1 1 1 1

View File

@ -0,0 +1,10 @@
<odoo>
<record model="ir.rule" id="document_tag_rule">
<field name="name">document_tag multi-company</field>
<field name="model_id" ref="model_document_tag" />
<field name="global" eval="True" />
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
</record>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,24 @@
<odoo>
<!-- Form view -->
<record id="view_document_page_form_tag" model="ir.ui.view">
<field name="name">document.page.form.tag</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="tag_ids" widget="many2many_tags" />
</field>
</field>
</record>
<!-- Search view -->
<record id="view_document_page_search_tag" model="ir.ui.view">
<field name="name">document.page.search.tag</field>
<field name="model">document.page</field>
<field name="inherit_id" ref="document_page.view_wiki_filter" />
<field name="arch" type="xml">
<field name="parent_id" position="after">
<field name="tag_ids" />
</field>
</field>
</record>
</odoo>

View File

@ -0,0 +1,52 @@
<odoo>
<!-- Tree view -->
<record id="view_document_tag_tree" model="ir.ui.view">
<field name="name">document.tag.tree</field>
<field name="model">document.tag</field>
<field name="arch" type="xml">
<tree string="Document Tags">
<field name="name" />
<field name="parent_id" />
<field name="company_id" groups="base.group_multi_company" />
</tree>
</field>
</record>
<!-- Form view -->
<record id="view_document_tag_form" model="ir.ui.view">
<field name="name">document.tag.form</field>
<field name="model">document.tag</field>
<field name="arch" type="xml">
<form string="Document Tag">
<sheet>
<h1>
<field name="name" placeholder="Name" />
</h1>
<group id="main">
<group id="main-left">
<field name="parent_id" />
</group>
<group id="main-right">
<field
name="company_id"
groups="base.group_multi_company"
/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="action_tag" model="ir.actions.act_window">
<field name="name">Tags</field>
<field name="res_model">document.tag</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_document_tag_tree" />
</record>
<menuitem
id="menu_tags"
name="Tags"
parent="knowledge.menu_document_configuration"
action="action_tag"
sequence="20"
/>
</odoo>

View File

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

View File

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