diff --git a/addons/multi_company/__init__.py b/addons/multi_company/__init__.py index 5856adc9616..0d29405d526 100644 --- a/addons/multi_company/__init__.py +++ b/addons/multi_company/__init__.py @@ -19,7 +19,5 @@ # ############################################################################## -import multi_company - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/multi_company/__terp__.py b/addons/multi_company/__terp__.py index b23144e56f4..83d6afa777f 100644 --- a/addons/multi_company/__terp__.py +++ b/addons/multi_company/__terp__.py @@ -36,8 +36,7 @@ ], 'init_xml': [], 'update_xml': [ - 'security/ir.model.access.csv', - 'multi_company_view.xml', + #'security/ir.model.access.csv', ], 'demo_xml': [ 'multi_company_demo.xml' diff --git a/addons/multi_company/multi_company.py b/addons/multi_company/multi_company.py deleted file mode 100644 index 6af7e342bed..00000000000 --- a/addons/multi_company/multi_company.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- 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 . -# -############################################################################## - -""" -The multicompany module add management to easily custom value by default -for each company -""" - -from osv import osv -from osv import fields -from tools.translate import _ - -class multi_company_default(osv.osv): - """ - Manage multi company default value - """ - _name = 'multi_company.default' - _description = 'Default multi company' - _order = 'company_id,sequence,id' - - _columns = { - 'sequence': fields.integer('Sequence'), - 'name': fields.char('Name', size=32, required=True, help='Name it to easily find a record'), - 'company_id': fields.many2one('res.company', 'Main Company', required=True, - help='Company where the user is connected'), - 'company_dest_id': fields.many2one('res.company', 'Default Company', required=True, - help='Company to store the current record'), - 'object_id': fields.many2one('ir.model', 'Object', required=True, - help='Object affect by this rules'), - 'expression': fields.char('Expression', size=32, required=True, - help='Expression, must be True to match'), - } - - _defaults = { - 'expression': lambda *a: 'True', - 'sequence': lambda *a: 100, - } - - def copy(self, cr, uid, id, default=None, context=None): - """ - Add (copy) in the name when duplicate record - """ - if not context: - context = {} - if not default: - default = {} - company = self.browse(cr, uid, id, context=context) - default = default.copy() - default['name'] = company.name + _(' (copy)') - return super(multi_company_default, self).copy(cr, uid, id, default, context=context) - -multi_company_default() - -class res_company(osv.osv): - """ - Change method to retrieve the company by default - """ - _inherit = 'res.company' - - def _company_default_get(self, cr, uid, object=False, context=None): - """ - Check if the object for this company have a default value - """ - if not context: - context = {} - proxy = self.pool.get('multi_company.default') - ids = proxy.search(cr, uid, [('object_id.model', '=', object)]) - for rule in proxy.browse(cr, uid, ids, context): - user = self.pool.get('res.users').browse(cr, uid, uid) - if eval(rule.expression, {'context': context, 'user': user}): - return rule.company_dest_id.id - return super(res_company, self)._company_default_get(cr, uid, object, context) - -res_company() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/multi_company/multi_company_view.xml b/addons/multi_company/multi_company_view.xml deleted file mode 100644 index b39a5ad0b7e..00000000000 --- a/addons/multi_company/multi_company_view.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - multi_company.default.tree - multi_company.default - tree - - - - - - - - - - - - - - multi_company.default.form - multi_company.default - form - - -
- - - - - - - - - - -
-
-
- - - multi_company.default.search - multi_company.default - search - - - - - - - - - - - - - Default Company per Object - ir.actions.act_window - multi_company.default - form - - - - - - - -
-
diff --git a/addons/multi_company/security/ir.model.access.csv b/addons/multi_company/security/ir.model.access.csv index 3ea1d07dcad..0343f29f43a 100644 --- a/addons/multi_company/security/ir.model.access.csv +++ b/addons/multi_company/security/ir.model.access.csv @@ -1,2 +1 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_multi_company_default user","multi_company_default User","multi_company.model_multi_company_default","base.group_user",1,0,0,0