diff --git a/document_page_multi_company/__init__.py b/document_page_multi_company/__init__.py new file mode 100644 index 00000000..5c8245ab --- /dev/null +++ b/document_page_multi_company/__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 . +# +############################################################################## + +from . import document_page_multi_company + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/document_page_multi_company/__openerp__.py b/document_page_multi_company/__openerp__.py new file mode 100644 index 00000000..3dd0017b --- /dev/null +++ b/document_page_multi_company/__openerp__.py @@ -0,0 +1,43 @@ +# -*- 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 Multi-Company', + 'version': '1.0', + "author": "Savoir-faire Linux", + "website": "http://www.savoirfairelinux.com", + "license": "AGPL-3", + 'category': 'Knowledge Management', + 'description': """ +This module adds a company field to document page and the multi-company rule. + """, + 'depends': [ + 'document_page', + ], + 'data': [ + 'security/document_page_security.xml', + 'document_page_multi_company_view.xml', + ], + 'installable': True, + 'auto_install': False, + 'images': [], +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/document_page_multi_company/document_page_multi_company.py b/document_page_multi_company/document_page_multi_company.py new file mode 100644 index 00000000..aed9d939 --- /dev/null +++ b/document_page_multi_company/document_page_multi_company.py @@ -0,0 +1,48 @@ +# -*- 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_history(orm.Model): + _inherit = 'document.page.history' + _columns = { + 'company_id': fields.many2one('res.company', 'Company') + } + + _defaults = { + 'company_id': lambda self, cr, uid, c: self.pool.get('res.company') + ._company_default_get(cr, uid, 'document_page_history', context=c) + } + + +class document_page(orm.Model): + _inherit = 'document.page' + _columns = { + 'company_id': fields.many2one('res.company', 'Company') + } + + _defaults = { + 'company_id': lambda self, cr, uid, c: self.pool.get('res.company') + ._company_default_get(cr, uid, 'document_page', context=c) + } + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/document_page_multi_company/document_page_multi_company_view.xml b/document_page_multi_company/document_page_multi_company_view.xml new file mode 100644 index 00000000..62b24bf7 --- /dev/null +++ b/document_page_multi_company/document_page_multi_company_view.xml @@ -0,0 +1,55 @@ + + + + + + + + document.page.history.tree + document.page.history + + + + + + + + + + document.page.history.form + document.page.history + + + + + + + + + + document.page.form + document.page + + + + + + + + + + document.page.tree + document.page + + + + + + + + + + diff --git a/document_page_multi_company/i18n/document_page_multi_company.pot b/document_page_multi_company/i18n/document_page_multi_company.pot new file mode 100644 index 00000000..e9582225 --- /dev/null +++ b/document_page_multi_company/i18n/document_page_multi_company.pot @@ -0,0 +1,33 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * document_page_multi_company +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-08-28 14:33+0000\n" +"PO-Revision-Date: 2013-08-28 14:33+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: document_page_multi_company +#: field:document.page,company_id:0 +#: field:document.page.history,company_id:0 +msgid "Company" +msgstr "" + +#. module: document_page_multi_company +#: model:ir.model,name:document_page_multi_company.model_document_page +msgid "Document Page" +msgstr "" + +#. module: document_page_multi_company +#: model:ir.model,name:document_page_multi_company.model_document_page_history +msgid "Document Page History" +msgstr "" + diff --git a/document_page_multi_company/security/document_page_security.xml b/document_page_multi_company/security/document_page_security.xml new file mode 100644 index 00000000..55c1c8ec --- /dev/null +++ b/document_page_multi_company/security/document_page_security.xml @@ -0,0 +1,20 @@ + + + + + + document_page multi-company + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + + + document_page_history multi-company + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + + +