[MRG] Add document_page_multi_company

This commit is contained in:
Maxime Chambreuil 2013-09-02 11:37:50 -04:00
commit cd7c378a5c
6 changed files with 223 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import document_page_multi_company
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,43 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'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:

View File

@ -0,0 +1,48 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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:

View File

@ -0,0 +1,55 @@
<?xml version="1.0"?>
<openerp>
<data>
<!-- History -->
<record id="wiki_history_tree_inherit" model="ir.ui.view">
<field name="name">document.page.history.tree</field>
<field name="model">document.page.history</field>
<field name="inherit_id" ref="document_page.view_wiki_history_tree"/>
<field name="arch" type="xml">
<field name="page_id" position="after">
<field name="company_id" groups="base.group_multi_company"/>
</field>
</field>
</record>
<record id="wiki_history_form_inherit" model="ir.ui.view">
<field name="name">document.page.history.form</field>
<field name="model">document.page.history</field>
<field name="inherit_id" ref="document_page.wiki_history_form"/>
<field name="arch" type="xml">
<field name="create_date" position="after">
<label for="company_id" class="oe_edit_only" groups="base.group_multi_company"/>
<field name="company_id" groups="base.group_multi_company"/>
</field>
</field>
</record>
<!-- Page -->
<record id="wiki_form_inherit" model="ir.ui.view">
<field name="name">document.page.form</field>
<field name="model">document.page</field>
<field name="inherit_id" ref="document_page.view_wiki_form"/>
<field name="arch" type="xml">
<field name="parent_id" position="after">
<field name="company_id" groups="base.group_multi_company"/>
</field>
</field>
</record>
<record id="view_wiki_tree_inherit" model="ir.ui.view">
<field name="name">document.page.tree</field>
<field name="model">document.page</field>
<field name="inherit_id" ref="document_page.view_wiki_tree"/>
<field name="arch" type="xml">
<field name="write_date" position="after">
<field name="company_id" groups="base.group_multi_company"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -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 ""

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record model="ir.rule" id="document_page_rule">
<field name="name">document_page multi-company</field>
<field name="model_id" ref="model_document_page"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record model="ir.rule" id="document_page_history_rule">
<field name="name">document_page_history multi-company</field>
<field name="model_id" ref="model_document_page_history"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</data>
</openerp>