[MIG] document_page_tags: Migration to 12.0

This commit is contained in:
Marcel Savegnago 2019-12-19 03:13:58 -03:00 committed by lfreeke
parent c367592493
commit 1d650890c9
11 changed files with 119 additions and 26 deletions

View File

@ -5,12 +5,14 @@
Tags/Keywords for document page Tags/Keywords for document page
=============================== ===============================
This module allows you to fill in keywords on your pages to simplify finding them afterwards. This module allows you to fill in keywords on your pages to simplify finding
them afterwards.
Usage Usage
===== =====
Fill in your keywords, and search for them by typing (part of) the keyword and choose searching for keywords. Fill in your keywords, and search for them by typing (part of) the keyword and
choose searching for keywords.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
@ -21,7 +23,8 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_. 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. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback If you spotted it first, help us smashing it by providing a detailed and
welcomed feedback
`here <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_tags%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `here <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_tags%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits Credits
@ -31,6 +34,7 @@ Contributors
------------ ------------
* Holger Brunn <hbrunn@therp.nl> * Holger Brunn <hbrunn@therp.nl>
* Marcel Savegnago <marcel.savegnago@gmail.com>
Maintainer Maintainer
---------- ----------

View File

@ -1,4 +1,2 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015-2018 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models from . import models

View File

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015-2018 Therp BV <https://therp.nl> # Copyright 2015-2020 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{ {
"name": "Tags/Keywords for document page", "name": "Document Page Tags",
"version": "10.0.1.0.0", "version": "10.0.1.1.0",
"author": "Therp BV,Odoo Community Association (OCA)", "author": "Therp BV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/knowledge",
"license": "AGPL-3", "license": "AGPL-3",
"category": "Knowledge Management", "category": "Knowledge Management",
"summary": "Allows you to assign tags or keywords to pages and search for " "summary": "Allows you to assign tags or keywords to pages and search for "

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015-2018 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import document_page from . import document_page
from . import document_page_tag from . import document_page_tag

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015-2018 Therp BV <https://therp.nl> # Copyright 2015-2018 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import models, fields from odoo import models, fields
class DocumentPage(models.Model): class DocumentPage(models.Model):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015-2018 Therp BV <https://therp.nl> # Copyright 2015-2018 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import api, models, fields from odoo import api, models, fields
class DocumentPageTag(models.Model): class DocumentPageTag(models.Model):
@ -9,6 +9,8 @@ class DocumentPageTag(models.Model):
_description = 'A keyword for document pages' _description = 'A keyword for document pages'
name = fields.Char(required=True, translate=True) name = fields.Char(required=True, translate=True)
color = fields.Integer(string='Color Index')
active = fields.Boolean(default=True)
_sql_constraints = [ _sql_constraints = [
('unique_name', 'unique(name)', 'Tags must me unique'), ('unique_name', 'unique(name)', 'Tags must me unique'),

View File

@ -1,3 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_document_page_tag_all,access_document_page_tag,model_document_page_tag,,1,0,0,0 document_page_user,document.page user,model_document_page_tag,knowledge.group_document_user,1,0,0,0
access_document_page_tag,access_document_page_tag,model_document_page_tag,base.group_user,1,0,1,1 document_page_editor,document.page editor,model_document_page_tag,document_page.group_document_editor,1,1,1,0
document_page_manager,document.page manager,model_document_page_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 access_document_page_tag_all document_page_user access_document_page_tag document.page user model_document_page_tag knowledge.group_document_user 1 0 0 0
3 access_document_page_tag document_page_editor access_document_page_tag document.page editor model_document_page_tag base.group_user document_page.group_document_editor 1 0 1 1 1 0
4 document_page_manager document.page manager model_document_page_tag document_page.group_document_manager 1 1 1 1

View File

@ -1,4 +1,2 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015-2018 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import test_document_page_tags from . import test_document_page_tags

View File

@ -2,8 +2,8 @@
# Copyright 2015-2018 Therp BV <https://therp.nl> # Copyright 2015-2018 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from psycopg2 import IntegrityError from psycopg2 import IntegrityError
from openerp.tests.common import TransactionCase from odoo.tests.common import TransactionCase
from openerp.tools.misc import mute_logger from odoo.tools.misc import mute_logger
class TestDocumentPageTags(TransactionCase): class TestDocumentPageTags(TransactionCase):

View File

@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<odoo> <odoo>
<record id="view_wiki_form" model="ir.ui.view"> <record id="view_wiki_form" model="ir.ui.view">
<field name="model">document.page</field> <field name="model">document.page</field>
<field name="inherit_id" ref="document_page.view_wiki_form" /> <field name="inherit_id" ref="document_page.view_wiki_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="parent_id" position="after"> <field name="parent_id" position="after">
<field name="tag_ids" widget="many2many_tags" /> <field
name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color', 'no_create_edit': True}"
/>
</field> </field>
</field> </field>
</record> </record>
@ -18,4 +23,21 @@
</field> </field>
</field> </field>
</record> </record>
<!-- List View-->
<record id="document_page_tag_view_inherit_list" model="ir.ui.view">
<field name="name">document_page.tags.tree</field>
<field name="model">document.page</field>
<field name="inherit_id" ref="document_page.view_wiki_tree"/>
<field name="type">tree</field>
<field name="field_parent">child_ids</field>
<field name="arch" type="xml">
<field name="parent_id" position="after">
<field name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color'}"/>
</field>
</field>
</record>
</odoo> </odoo>

View File

@ -1,13 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="view_document_page_tag_form" model="ir.ui.view">
<record id="view_document_page_tag_search" model="ir.ui.view">
<field name="name">document.page.tag.search</field>
<field name="model">document.page.tag</field> <field name="model">document.page.tag</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form> <search string="Document Tag Search">
<group> <filter
<field name="name" /> string="Archived"
name="inactive"
domain="[('active','=',False)]"
/>
<separator/>
<field
name="name"
filter_domain="[('name', 'ilike', self)]"
/>
</search>
</field>
</record>
<record id="view_document_page_tag_form" model="ir.ui.view">
<field name="name">document.page.tag.form</field>
<field name="model">document.page.tag</field>
<field name="arch" type="xml">
<form string="Tag">
<sheet>
<div class="oe_button_box" name="button_box">
<button
name="toggle_active"
type="object"
class="oe_stat_button"
icon="fa-check"
>
<field
name="active"
widget="boolean_button"
options="{&quot;terminology&quot;: &quot;active&quot;}"
/>
</button>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1>
<field name="name" required="1"/>
</h1>
</div>
<group name="main">
<field name="color" />
</group> </group>
</sheet>
</form> </form>
</field> </field>
</record> </record>
<record id="view_document_page_tag_tree" model="ir.ui.view">
<field name="name">document.page.tag.tree</field>
<field name="model">document.page.tag</field>
<field name="arch" type="xml">
<tree string="Document Tags">
<field name="name" />
</tree>
</field>
</record>
<record id="document_page_tag_action" model="ir.actions.act_window">
<field name="name">Tags</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">document.page.tag</field>
<field name="view_mode">tree,form</field>
<field name="view_type">form</field>
</record>
<menuitem
id="document_page_tag_menu"
name="Tags"
parent="knowledge.menu_document_configuration"
action="document_page_tag_action"
sequence="45" />
</odoo> </odoo>