From c95ce9eae5e35651478de6fa077cebb7c5689a15 Mon Sep 17 00:00:00 2001
From: Leonardo Donelli
Date: Thu, 22 Dec 2016 12:43:02 +0100
Subject: [PATCH] [MIG] document_page_approval
---
document_page_approval/README.rst | 47 +++-----
document_page_approval/__init__.py | 22 +---
document_page_approval/__manifest__.py | 28 +----
.../data/email_template.xml | 30 ++---
.../models/document_page_approval.py | 21 +---
.../models/document_page_history_workflow.py | 27 +----
.../security/document_page_security.xml | 4 +-
.../views/document_page_approval.xml | 2 +
.../workflows/document_page_approval.xml | 2 +
knowledge/README.rst | 17 +--
knowledge/__init__.py | 22 +---
knowledge/__manifest__.py | 35 ++----
knowledge/data/ir_module_category.xml | 10 ++
knowledge/demo/knowledge.xml | 12 +-
knowledge/models/__init__.py | 23 +---
knowledge/models/ir_attachment.py | 12 ++
knowledge/models/res_config.py | 35 ++----
knowledge/security/ir.model.access.csv | 3 -
knowledge/security/knowledge_security.xml | 12 +-
knowledge/views/knowledge.xml | 57 +++++++--
knowledge/views/res_config.xml | 114 +++++++++---------
21 files changed, 212 insertions(+), 323 deletions(-)
create mode 100644 knowledge/data/ir_module_category.xml
create mode 100644 knowledge/models/ir_attachment.py
delete mode 100644 knowledge/security/ir.model.access.csv
diff --git a/document_page_approval/README.rst b/document_page_approval/README.rst
index affff9ce..386c5a24 100644
--- a/document_page_approval/README.rst
+++ b/document_page_approval/README.rst
@@ -1,44 +1,40 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
- :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
- :alt: License: AGPL-3
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
======================
Document Page Approval
======================
-This module adds a workflow to approve page modification and show the approved
-version by default.
+This module adds a workflow to approve page modifications and show the approved version by default.
Installation
============
-Makes the document page approval available from where some users can approved the modifications
-made by others users in documents that required approvement.
+No specific installation required.
Configuration
=============
-No configuration required
+* Set a valid email address on the company settings.
+* Go to Knowledge > Categories.
+* Create a new page category and set an approver group. Make sure users belonging to that group have valid email
+ addresses.
Usage
=====
To use this module, you need to:
-* Set a valid email address on the company settings.
-* go to knowledge > Categories.
-* Create a new page category and set an approver group. Make sure users
- belonging to that group have valid email addresses.
-* go to knowledge > Pages
+* Go to Knowledge > Pages
* Create a new page and choose the previously created category.
-* A notification is sent to the group with a link to the page history to
- review.
+* A notification is sent to the approvers group with a link to the page history to review.
* Depending on the review, the page history is approved or not.
* Users reading the page see the last approved version.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
- :alt: Try me on Runbot
- :target: https://runbot.odoo-community.org/runbot/118/9.0
+ :alt: Try me on Runbot
+ :target: https://runbot.odoo-community.org/runbot/118/10.0
Known issues / Roadmap
======================
@@ -50,8 +46,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
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 `here `_.
-
+If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here `_.
Credits
=======
@@ -62,13 +57,14 @@ Contributors
* Odoo SA
* Savoir-faire Linux
* Gervais Naoussi
+* Maxime Chambreuil
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
- :alt: Odoo Community Association
- :target: https://odoo-community.org
+ :alt: Odoo Community Association
+ :target: https://odoo-community.org
This module is maintained by the OCA.
@@ -76,13 +72,4 @@ 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.
-To contribute to this module, please visit http://odoo-community.org.
-
-Changelog
----------
-
-v9.0.1.0.0
-
-Here are the modification that have been done:
-
-* The module does no depends anymore on email_template but on mail module
+To contribute to this module, please visit https://odoo-community.org.
diff --git a/document_page_approval/__init__.py b/document_page_approval/__init__.py
index 7f626589..01c2ffde 100644
--- a/document_page_approval/__init__.py
+++ b/document_page_approval/__init__.py
@@ -1,21 +1,5 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2013 Savoir-faire Linux ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2013 Savoir-faire Linux ().
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
from . import models
diff --git a/document_page_approval/__manifest__.py b/document_page_approval/__manifest__.py
index af6727f2..b3921128 100644
--- a/document_page_approval/__manifest__.py
+++ b/document_page_approval/__manifest__.py
@@ -1,33 +1,15 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2013 Savoir-faire Linux ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2013 Savoir-faire Linux ().
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Document Page Approval',
- 'version': '9.0.1.0.0',
- "author": "Savoir-faire Linux,Odoo Community Association (OCA)",
+ 'version': '10.0.1.0.0',
+ "author": "Savoir-faire Linux, Odoo Community Association (OCA)",
"website": "http://www.savoirfairelinux.com",
"license": "AGPL-3",
'category': 'Knowledge Management',
'depends': [
- 'knowledge',
'document_page',
'mail',
],
@@ -38,8 +20,6 @@
'security/document_page_security.xml',
'security/ir.model.access.csv',
],
- 'installable': False,
- 'auto_install': False,
'images': [
'images/category.png',
'images/page_history_list.png',
diff --git a/document_page_approval/data/email_template.xml b/document_page_approval/data/email_template.xml
index e31c8bcb..e3bc566d 100644
--- a/document_page_approval/data/email_template.xml
+++ b/document_page_approval/data/email_template.xml
@@ -1,20 +1,17 @@
-
+
-
-
-
-
- Automated new draft need approval Notification Mail
- ${object.create_uid.company_id.email or 'noreply@localhost.com'}
- New version of "${object.page_id.name}" to approve
- ${object.get_approvers_email}
-
-
- ${object.create_uid.partner_id.lang}
-
-
+ Automated new draft need approval Notification Mail
+ ${object.create_uid.company_id.email or 'noreply@localhost.com'}
+ New version of "${object.page_id.name}" to approve
+ ${object.get_approvers_email}
+
+
+ ${object.create_uid.partner_id.lang}
+
+ Hello,
The page "${object.page_id.name}" has been modified and need your approval.
@@ -24,8 +21,7 @@
Have a great day.
--
Odoo
]]>
-
-
+
+
-
diff --git a/document_page_approval/models/document_page_approval.py b/document_page_approval/models/document_page_approval.py
index 278f5227..193c839b 100644
--- a/document_page_approval/models/document_page_approval.py
+++ b/document_page_approval/models/document_page_approval.py
@@ -1,23 +1,6 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2013 Savoir-faire Linux ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2013 Savoir-faire Linux ().
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
diff --git a/document_page_approval/models/document_page_history_workflow.py b/document_page_approval/models/document_page_history_workflow.py
index 2eeb7e91..82ba943d 100644
--- a/document_page_approval/models/document_page_history_workflow.py
+++ b/document_page_approval/models/document_page_history_workflow.py
@@ -1,28 +1,11 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2013 Savoir-faire Linux ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2013 Savoir-faire Linux ().
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime
-from openerp.tools.translate import _
-from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
-from openerp import models, fields, api
+from odoo.tools.translate import _
+from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
+from odoo import api, fields, models
class DocumentPageHistoryWorkflow(models.Model):
diff --git a/document_page_approval/security/document_page_security.xml b/document_page_approval/security/document_page_security.xml
index d41d96f8..f0378d8e 100644
--- a/document_page_approval/security/document_page_security.xml
+++ b/document_page_approval/security/document_page_security.xml
@@ -1,9 +1,9 @@
-
+
Document approver
-
+
diff --git a/document_page_approval/views/document_page_approval.xml b/document_page_approval/views/document_page_approval.xml
index 6b0e5c91..ef834b67 100644
--- a/document_page_approval/views/document_page_approval.xml
+++ b/document_page_approval/views/document_page_approval.xml
@@ -1,5 +1,6 @@
+
document.page.history.form
document.page.history
@@ -88,4 +89,5 @@
+
diff --git a/document_page_approval/workflows/document_page_approval.xml b/document_page_approval/workflows/document_page_approval.xml
index ea8a254b..410d8a54 100644
--- a/document_page_approval/workflows/document_page_approval.xml
+++ b/document_page_approval/workflows/document_page_approval.xml
@@ -1,5 +1,6 @@
+
document.page.history.aproval.wkf
document.page.history
@@ -35,4 +36,5 @@
edit
+
diff --git a/knowledge/README.rst b/knowledge/README.rst
index 60a08124..bf93ac79 100644
--- a/knowledge/README.rst
+++ b/knowledge/README.rst
@@ -27,14 +27,13 @@ To use this module, you need to:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
- :target: https://runbot.odoo-community.org/runbot/repo/118/9.0
+ :target: https://runbot.odoo-community.org/runbot/repo/118/10.0
Known issues / Roadmap
======================
-* Add options for other OCA extension modules as they are made available.
-* `Migrate CMIS modules to version 9 `_
+* Migrate related modules to v10 and add options in the settings as soon as they are installable
Bug Tracker
===========
@@ -45,7 +44,7 @@ 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 `here `_.
+10.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
@@ -57,6 +56,8 @@ Contributors
* Odoo SA
* Savoir-faire Linux
* Gervais Naoussi
+* Leonardo Donelli
+* Maxime Chambreuil
Maintainer
----------
@@ -72,11 +73,3 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.
-
-Changelog
----------
-
-v9.0.1.0.0
-
-This module is an official module but was not present in odoo 9.0 official repository
-so we took it from Odoo 8.0 repository and add it here.
diff --git a/knowledge/__init__.py b/knowledge/__init__.py
index 282d496e..769d6e28 100644
--- a/knowledge/__init__.py
+++ b/knowledge/__init__.py
@@ -1,23 +1,5 @@
-"""Import of model's module."""
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2004-2009 Tiny SPRL ().
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
diff --git a/knowledge/__manifest__.py b/knowledge/__manifest__.py
index 122ff731..b2fbc36f 100644
--- a/knowledge/__manifest__.py
+++ b/knowledge/__manifest__.py
@@ -1,38 +1,21 @@
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2004-2009 Tiny SPRL ().
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Knowledge Management System",
- "version": "9.0.1.1.0",
- "depends": ["base_setup"],
- "author": "OpenERP SA, Odoo Community Association (OCA)",
- "category": "Hidden/Dependency",
+ "version": "10.0.1.0.0",
+ "author": "OpenERP SA, MONK Software, Odoo Community Association (OCA)",
+ "category": "Knowledge",
"license": "AGPL-3",
- "website": "https://www.odoo.com",
+ "website": "https://odoo-community.org/",
+ "depends": ["base"],
"data": [
+ "data/ir_module_category.xml",
"security/knowledge_security.xml",
- "security/ir.model.access.csv",
"views/knowledge.xml",
"views/res_config.xml",
],
"demo": ["demo/knowledge.xml"],
- 'installable': False,
+ "installable": True,
"auto_install": False,
}
diff --git a/knowledge/data/ir_module_category.xml b/knowledge/data/ir_module_category.xml
new file mode 100644
index 00000000..f17ca72f
--- /dev/null
+++ b/knowledge/data/ir_module_category.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ Knowledge
+ Manage documents and knowledge-related applications
+ 30
+
+
+
diff --git a/knowledge/demo/knowledge.xml b/knowledge/demo/knowledge.xml
index eac89cdc..85dc7508 100644
--- a/knowledge/demo/knowledge.xml
+++ b/knowledge/demo/knowledge.xml
@@ -1,8 +1,8 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/knowledge/models/__init__.py b/knowledge/models/__init__.py
index 74d0d602..244a5770 100644
--- a/knowledge/models/__init__.py
+++ b/knowledge/models/__init__.py
@@ -1,23 +1,6 @@
-"""model's module imported."""
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2004-2009 Tiny SPRL ().
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+from . import ir_attachment
from . import res_config
diff --git a/knowledge/models/ir_attachment.py b/knowledge/models/ir_attachment.py
new file mode 100644
index 00000000..481938c6
--- /dev/null
+++ b/knowledge/models/ir_attachment.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2004-2009 Tiny SPRL ().
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import fields, models
+
+
+class IrAttachment(models.Model):
+ _inherit = 'ir.attachment'
+
+ # Add index to res_model because filtering on it is a common use case
+ res_model = fields.Char(index=True)
diff --git a/knowledge/models/res_config.py b/knowledge/models/res_config.py
index 49ece8fc..44cf0de8 100644
--- a/knowledge/models/res_config.py
+++ b/knowledge/models/res_config.py
@@ -1,30 +1,11 @@
-"""KnowledgeConfigSettings class."""
# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Business Applications
-# Copyright (C) 2004-2012 OpenERP S.A. ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2004-2009 Tiny SPRL ().
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from openerp import models, fields
+from odoo import fields, models
class KnowledgeConfigSettings(models.TransientModel):
- """This class in needed to activate document management."""
_name = 'knowledge.config.settings'
_inherit = 'res.config.settings'
@@ -38,24 +19,24 @@ class KnowledgeConfigSettings(models.TransientModel):
module_document_page = fields.Boolean(
'Manage document pages (Wiki)',
help='Provide document page and category as a wiki.\n'
- '- This installs the module document_page.'
+ '- This installs the module document_page.'
)
module_document_page_approval = fields.Boolean(
'Manage documents approval',
help='Add workflow on documents per category.\n'
- '- This installs the module document_page_approval.'
+ '- This installs the module document_page_approval.'
)
module_cmis_read = fields.Boolean(
'Attach files from an external DMS into Odoo',
help='Connect Odoo with a CMIS compatible server to attach files\n'
- 'to an Odoo record.\n'
- '- This installs the module cmis_read.'
+ 'to an Odoo record.\n'
+ '- This installs the module cmis_read.'
)
module_cmis_write = fields.Boolean(
'Store attachments in an external DMS instead of the Odoo Filestore',
help='Connect Odoo with a CMIS compatible server to store files.\n'
- '- This installs the module cmis_write.'
+ '- This installs the module cmis_write.'
)
diff --git a/knowledge/security/ir.model.access.csv b/knowledge/security/ir.model.access.csv
deleted file mode 100644
index 34255019..00000000
--- a/knowledge/security/ir.model.access.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_ir_attachment_sale_manager,ir_attachment manager,base.model_ir_attachment,base.group_sale_manager,1,1,1,1
-access_ir_attachment_partner_manager,ir_attachment_partner manager,base.model_ir_attachment,base.group_partner_manager,1,1,1,1
diff --git a/knowledge/security/knowledge_security.xml b/knowledge/security/knowledge_security.xml
index d16d9120..467d1b7d 100644
--- a/knowledge/security/knowledge_security.xml
+++ b/knowledge/security/knowledge_security.xml
@@ -1,12 +1,10 @@
-
-
- User
-
-
-
+
+ Knowledge user
+
+
+
-
diff --git a/knowledge/views/knowledge.xml b/knowledge/views/knowledge.xml
index 8f45b4ae..181ab7eb 100644
--- a/knowledge/views/knowledge.xml
+++ b/knowledge/views/knowledge.xml
@@ -1,18 +1,53 @@
-
-
-
+
+ Documents
+ ir.attachment
+ kanban,tree,form
+ {'search_default_user_documents': True}
+
-
-
+
+ Documents search view: additional filters
+ ir.attachment
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/knowledge/views/res_config.xml b/knowledge/views/res_config.xml
index a3701961..d2f9feea 100644
--- a/knowledge/views/res_config.xml
+++ b/knowledge/views/res_config.xml
@@ -1,65 +1,63 @@
-
-
- Configure Knowledge
- knowledge.config.settings
-
-
-
-
+
+ Configure Knowledge
+ knowledge.config.settings
+
+
+
+
-
- Configure Knowledge
- knowledge.config.settings
- form
- inline
-
+
+ Configure Knowledge
+ knowledge.config.settings
+ form
+ inline
+
-
+
-