mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-27 10:58:41 -06:00
[ADD] document_tag
This commit is contained in:
parent
84e8bc4b32
commit
d0cfa3234b
21
document_tag/README.rst
Normal file
21
document_tag/README.rst
Normal 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
3
document_tag/__init__.py
Normal 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
|
19
document_tag/__manifest__.py
Normal file
19
document_tag/__manifest__.py
Normal 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"],
|
||||
}
|
6
document_tag/models/__init__.py
Normal file
6
document_tag/models/__init__.py
Normal 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,
|
||||
)
|
9
document_tag/models/document_page.py
Normal file
9
document_tag/models/document_page.py
Normal 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")
|
12
document_tag/models/document_tag.py
Normal file
12
document_tag/models/document_tag.py
Normal 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")
|
3
document_tag/readme/CONTRIBUTORS.rst
Normal file
3
document_tag/readme/CONTRIBUTORS.rst
Normal file
@ -0,0 +1,3 @@
|
||||
* `Open Source Integrators <https://www.opensourceintegrators.com>`_
|
||||
|
||||
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
|
1
document_tag/readme/DESCRIPTION.rst
Normal file
1
document_tag/readme/DESCRIPTION.rst
Normal file
@ -0,0 +1 @@
|
||||
This module allows you to manage tags for document pages and categories.
|
7
document_tag/readme/USAGE.rst
Normal file
7
document_tag/readme/USAGE.rst
Normal 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
|
3
document_tag/security/ir.model.access.csv
Normal file
3
document_tag/security/ir.model.access.csv
Normal 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
|
|
10
document_tag/security/ir_rule.xml
Normal file
10
document_tag/security/ir_rule.xml
Normal 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>
|
BIN
document_tag/static/description/icon.png
Normal file
BIN
document_tag/static/description/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
24
document_tag/views/document_page.xml
Normal file
24
document_tag/views/document_page.xml
Normal 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>
|
52
document_tag/views/document_tag.xml
Normal file
52
document_tag/views/document_tag.xml
Normal 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>
|
1
setup/document_tag/odoo/addons/document_tag
Symbolic link
1
setup/document_tag/odoo/addons/document_tag
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../document_tag
|
6
setup/document_tag/setup.py
Normal file
6
setup/document_tag/setup.py
Normal file
@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
Loading…
Reference in New Issue
Block a user