diff --git a/document_tag/README.rst b/document_tag/README.rst new file mode 100644 index 00000000..21cd7854 --- /dev/null +++ b/document_tag/README.rst @@ -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. diff --git a/document_tag/__init__.py b/document_tag/__init__.py new file mode 100644 index 00000000..3b2a810b --- /dev/null +++ b/document_tag/__init__.py @@ -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 diff --git a/document_tag/__manifest__.py b/document_tag/__manifest__.py new file mode 100644 index 00000000..463bf9ba --- /dev/null +++ b/document_tag/__manifest__.py @@ -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"], +} diff --git a/document_tag/models/__init__.py b/document_tag/models/__init__.py new file mode 100644 index 00000000..2c5b2cce --- /dev/null +++ b/document_tag/models/__init__.py @@ -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, +) diff --git a/document_tag/models/document_page.py b/document_tag/models/document_page.py new file mode 100644 index 00000000..0d7c328e --- /dev/null +++ b/document_tag/models/document_page.py @@ -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") diff --git a/document_tag/models/document_tag.py b/document_tag/models/document_tag.py new file mode 100644 index 00000000..8d54ef2e --- /dev/null +++ b/document_tag/models/document_tag.py @@ -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") diff --git a/document_tag/readme/CONTRIBUTORS.rst b/document_tag/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..bd2fd4ae --- /dev/null +++ b/document_tag/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Open Source Integrators `_ + + * Maxime Chambreuil diff --git a/document_tag/readme/DESCRIPTION.rst b/document_tag/readme/DESCRIPTION.rst new file mode 100644 index 00000000..ba5ea7af --- /dev/null +++ b/document_tag/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows you to manage tags for document pages and categories. diff --git a/document_tag/readme/USAGE.rst b/document_tag/readme/USAGE.rst new file mode 100644 index 00000000..e34c0de7 --- /dev/null +++ b/document_tag/readme/USAGE.rst @@ -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 diff --git a/document_tag/security/ir.model.access.csv b/document_tag/security/ir.model.access.csv new file mode 100644 index 00000000..36abeb84 --- /dev/null +++ b/document_tag/security/ir.model.access.csv @@ -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 diff --git a/document_tag/security/ir_rule.xml b/document_tag/security/ir_rule.xml new file mode 100644 index 00000000..de1c1cd2 --- /dev/null +++ b/document_tag/security/ir_rule.xml @@ -0,0 +1,10 @@ + + + document_tag multi-company + + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + diff --git a/document_tag/static/description/icon.png b/document_tag/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/document_tag/static/description/icon.png differ diff --git a/document_tag/views/document_page.xml b/document_tag/views/document_page.xml new file mode 100644 index 00000000..00e6dc30 --- /dev/null +++ b/document_tag/views/document_page.xml @@ -0,0 +1,24 @@ + + + + document.page.form.tag + document.page + + + + + + + + + + document.page.search.tag + document.page + + + + + + + + diff --git a/document_tag/views/document_tag.xml b/document_tag/views/document_tag.xml new file mode 100644 index 00000000..943b7d00 --- /dev/null +++ b/document_tag/views/document_tag.xml @@ -0,0 +1,52 @@ + + + + document.tag.tree + document.tag + + + + + + + + + + + document.tag.form + document.tag + +
+ +

+ +

+ + + + + + + + +
+
+
+
+ + Tags + document.tag + tree,form + + + +
diff --git a/setup/document_tag/odoo/addons/document_tag b/setup/document_tag/odoo/addons/document_tag new file mode 120000 index 00000000..5b2f3f6d --- /dev/null +++ b/setup/document_tag/odoo/addons/document_tag @@ -0,0 +1 @@ +../../../../document_tag \ No newline at end of file diff --git a/setup/document_tag/setup.py b/setup/document_tag/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/document_tag/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)