From deb40c7b37742806effda785fa28feef25bcd0b5 Mon Sep 17 00:00:00 2001 From: Jonatan Cloutier Date: Tue, 16 Apr 2013 18:18:39 -0400 Subject: [PATCH] create document_page_approval module (../7.0pageapproval/ rev 1) --- document_page_approval/__init__.py | 24 ++++++++++++ document_page_approval/__openerp__.py | 38 ++++++++++++++++++ .../document_page_approval.py | 39 +++++++++++++++++++ document_page_approval/document_page_view.xml | 20 ++++++++++ document_page_approval/document_page_wkfl.xml | 39 +++++++++++++++++++ 5 files changed, 160 insertions(+) create mode 100644 document_page_approval/__init__.py create mode 100644 document_page_approval/__openerp__.py create mode 100644 document_page_approval/document_page_approval.py create mode 100644 document_page_approval/document_page_view.xml create mode 100644 document_page_approval/document_page_wkfl.xml diff --git a/document_page_approval/__init__.py b/document_page_approval/__init__.py new file mode 100644 index 00000000..bd56742e --- /dev/null +++ b/document_page_approval/__init__.py @@ -0,0 +1,24 @@ +# -*- encoding: 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 . +# +############################################################################## + +import document_page_approval + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/document_page_approval/__openerp__.py b/document_page_approval/__openerp__.py new file mode 100644 index 00000000..92c1f2f3 --- /dev/null +++ b/document_page_approval/__openerp__.py @@ -0,0 +1,38 @@ +# -*- encoding: 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 . +# +############################################################################## + +{ + 'name': 'Document Page Approval', + 'version': '1.0', + "author" : "Savoir-faire Linux", + "website" : "http://www.savoirfairelinux.com", + "license" : "AGPL-3", + 'category': 'Knowledge Management', + 'description': """ +Add a workflow to approve page modification and show the approved version by default + """, + 'depends': ['document_page'], + 'update_xml': ['document_page_wkfl.xml','document_page_view.xml'], + 'installable': True, + 'auto_install': False, + 'images': [], +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/document_page_approval/document_page_approval.py b/document_page_approval/document_page_approval.py new file mode 100644 index 00000000..a9844bb5 --- /dev/null +++ b/document_page_approval/document_page_approval.py @@ -0,0 +1,39 @@ +# -*- encoding: 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 . +# +############################################################################## +from openerp.osv import fields, orm + +class document_page_wkfl(orm.Model): + _inherit = 'document.page' + _columns = { + 'state': fields.selection([ + ('draft','Draft'), + ('approved','Approved')], 'State', readonly=True), + } + + def page_approval_draft(self, cr, uid, ids): + self.write(cr, uid, ids, { 'state' : 'draft' }) + return True + + def page_approval_approved(self, cr, uid, ids): + self.write(cr, uid, ids, { 'state' : 'approved' }) + return True + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/document_page_approval/document_page_view.xml b/document_page_approval/document_page_view.xml new file mode 100644 index 00000000..51705fef --- /dev/null +++ b/document_page_approval/document_page_view.xml @@ -0,0 +1,20 @@ + + + + + + document.page.form + document.page + + + +
+
+
+
+
+ +
+
diff --git a/document_page_approval/document_page_wkfl.xml b/document_page_approval/document_page_wkfl.xml new file mode 100644 index 00000000..149f5c7d --- /dev/null +++ b/document_page_approval/document_page_wkfl.xml @@ -0,0 +1,39 @@ + + + + + document.page.aproval.wkf + document.page + True + + + + + True + draft + function + page_approval_draft() + + + + + approved + function + page_approval_approved() + True + + + + + + page_approval_approve + + + + + + edit + + + +