diff --git a/addons/multi_company/__init__.py b/addons/multi_company/__init__.py index e96ecdf56e6..5856adc9616 100644 --- a/addons/multi_company/__init__.py +++ b/addons/multi_company/__init__.py @@ -21,7 +21,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 c2728db3a61..b23144e56f4 100644 --- a/addons/multi_company/__terp__.py +++ b/addons/multi_company/__terp__.py @@ -24,13 +24,24 @@ 'name': 'Multi Company', 'version': '1.0', 'category': 'Custom', - 'description': " ", - 'author': 'Tiny', - 'depends': ['base','sale','project'], + 'description': """This module add the possibility to easily manage + the default value for each object + """, + 'author': 'Tiny,SYLEAM', + 'website': 'http://www.openerp.com/', + 'depends': [ + 'base', + 'sale', + 'project' + ], + 'init_xml': [], 'update_xml': [ + 'security/ir.model.access.csv', 'multi_company_view.xml', ], - 'demo_xml': ['multi_company_demo.xml'], + 'demo_xml': [ + 'multi_company_demo.xml' + ], 'installable': True, 'active': False, } diff --git a/addons/multi_company/i18n/fr.po b/addons/multi_company/i18n/fr.po new file mode 100644 index 00000000000..4254264e1c6 --- /dev/null +++ b/addons/multi_company/i18n/fr.po @@ -0,0 +1,188 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * multi_company +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-12-08 11:46:41+0000\n" +"PO-Revision-Date: 2009-12-08 12:48+0100\n" +"Last-Translator: Christophe Chauvet \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Translate Toolkit 1.3.0\n" + +#. module: multi_company +#: help:multi_company.default,object_id:0 +msgid "Object affect by this rules" +msgstr "Objet en relation avec cette règle" + +#. module: multi_company +#: constraint:ir.model:0 +msgid "The Object name must start with x_ and not contain any special character !" +msgstr "" + +#. module: multi_company +#: constraint:product.template:0 +msgid "Error: The default UOM and the purchase UOM must be in the same category." +msgstr "" + +#. module: multi_company +#: constraint:res.partner:0 +msgid "The VAT doesn't seem to be correct." +msgstr "" + +#. module: multi_company +#: constraint:ir.actions.act_window:0 +msgid "Invalid model name in the action definition." +msgstr "" + +#. module: multi_company +#: model:res.company,overdue_msg:multi_company.res_company_odoo +#: model:res.company,overdue_msg:multi_company.res_company_oerp_be +#: model:res.company,overdue_msg:multi_company.res_company_oerp_editor +#: model:res.company,overdue_msg:multi_company.res_company_oerp_in +#: model:res.company,overdue_msg:multi_company.res_company_oerp_us +msgid "Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting department" +msgstr "" + +#. module: multi_company +#: field:multi_company.default,company_dest_id:0 +msgid "Default Company" +msgstr "Société par défaut" + +#. module: multi_company +#: field:multi_company.default,object_id:0 +msgid "Object" +msgstr "Objet" + +#. module: multi_company +#: model:ir.module.module,shortdesc:multi_company.module_meta_information +#: view:multi_company.default:0 +msgid "Multi Company" +msgstr "Multi société" + +#. module: multi_company +#: model:ir.module.module,description:multi_company.module_meta_information +msgid "" +"This module add the possibility to easily manage \n" +" the default value for each object\n" +" " +msgstr "" +"Ce module ajoute la possibilité de gérer facilement \n" +" les valeurs par défaut de chaques objets\n" +" " + +#. module: multi_company +#: field:multi_company.default,company_id:0 +msgid "Main Company" +msgstr "Société principale" + +#. module: multi_company +#: view:multi_company.default:0 +msgid "Condition" +msgstr "Condition" + +#. module: multi_company +#: help:multi_company.default,company_dest_id:0 +msgid "Company to store the current record" +msgstr "Société dans lequel l'enregistrement courant sera stocké" + +#. module: multi_company +#: constraint:ir.ui.view:0 +msgid "Invalid XML for View Architecture!" +msgstr "XML invalide pour cette vue!" + +#. module: multi_company +#: field:multi_company.default,name:0 +msgid "Name" +msgstr "Nom" + +#. module: multi_company +#: constraint:product.template:0 +msgid "Error: UOS must be in a different category than the UOM" +msgstr "" + +#. module: multi_company +#: model:product.category,name:multi_company.Odoo1 +msgid "Odoo Offers" +msgstr "Offres Odoo" + +#. module: multi_company +#: constraint:res.company:0 +msgid "Error! You can not create recursive companies." +msgstr "Erreur! Vous ne pouvez pas créer de sociétés récursives." + +#. module: multi_company +#: help:multi_company.default,name:0 +msgid "Name it to easily find a record" +msgstr "La nommer facilement de façon a trouver l'enregistrement" + +#. module: multi_company +#: model:ir.ui.menu,name:multi_company.menu_custom_multicompany +msgid "Multi company" +msgstr "Multi société" + +#. module: multi_company +#: model:ir.model,name:multi_company.model_multi_company_default +msgid "multi_company.default" +msgstr "multi_company.default" + +#. module: multi_company +#: help:multi_company.default,company_id:0 +msgid "Company where the user is connected" +msgstr "Société dans laquelle l'utilisateur est connectée" + +#. module: multi_company +#: model:ir.actions.act_window,name:multi_company.action_inventory_form +msgid "Default Company per Object" +msgstr "Société par défaut par objet" + +#. module: multi_company +#: field:multi_company.default,expression:0 +msgid "Expression" +msgstr "Expression" + +#. module: multi_company +#: model:product.template,name:multi_company.product_product_odoo1_product_template +msgid "Odoo Offer" +msgstr "Offre Odoo" + +#. module: multi_company +#: field:multi_company.default,sequence:0 +msgid "Sequence" +msgstr "Séquence" + +#. module: multi_company +#: constraint:product.category:0 +msgid "Error ! You can not create recursive categories." +msgstr "" + +#. module: multi_company +#: constraint:product.product:0 +msgid "Error: Invalid ean code" +msgstr "Erreur: code EAN invalide" + +#. module: multi_company +#: help:multi_company.default,expression:0 +msgid "Expression, must be True to match" +msgstr "L'expression doit être à True pour correspondre" + +#. module: multi_company +#: model:ir.ui.menu,name:multi_company.menu_action_inventory_form +msgid "Default company per Object" +msgstr "Société par défaut par objet" + +#. module: multi_company +#: code:addons/multi_company/multi_company.py:0 +#, python-format +msgid " (copy)" +msgstr " (copie)" + +#. module: multi_company +#: view:multi_company.default:0 +msgid "Matching" +msgstr "Critère de correspondance" + diff --git a/addons/multi_company/i18n/multi_company.pot b/addons/multi_company/i18n/multi_company.pot new file mode 100644 index 00000000000..8f3048ebafa --- /dev/null +++ b/addons/multi_company/i18n/multi_company.pot @@ -0,0 +1,185 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * multi_company +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.6\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-12-08 11:46:41+0000\n" +"PO-Revision-Date: 2009-12-08 11:46:41+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: multi_company +#: help:multi_company.default,object_id:0 +msgid "Object affect by this rules" +msgstr "" + +#. module: multi_company +#: constraint:ir.model:0 +msgid "The Object name must start with x_ and not contain any special character !" +msgstr "" + +#. module: multi_company +#: constraint:product.template:0 +msgid "Error: The default UOM and the purchase UOM must be in the same category." +msgstr "" + +#. module: multi_company +#: constraint:res.partner:0 +msgid "The VAT doesn't seem to be correct." +msgstr "" + +#. module: multi_company +#: constraint:ir.actions.act_window:0 +msgid "Invalid model name in the action definition." +msgstr "" + +#. module: multi_company +#: model:res.company,overdue_msg:multi_company.res_company_odoo +#: model:res.company,overdue_msg:multi_company.res_company_oerp_be +#: model:res.company,overdue_msg:multi_company.res_company_oerp_editor +#: model:res.company,overdue_msg:multi_company.res_company_oerp_in +#: model:res.company,overdue_msg:multi_company.res_company_oerp_us +msgid "Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting department" +msgstr "" + +#. module: multi_company +#: field:multi_company.default,company_dest_id:0 +msgid "Default Company" +msgstr "" + +#. module: multi_company +#: field:multi_company.default,object_id:0 +msgid "Object" +msgstr "" + +#. module: multi_company +#: model:ir.module.module,shortdesc:multi_company.module_meta_information +#: view:multi_company.default:0 +msgid "Multi Company" +msgstr "" + +#. module: multi_company +#: model:ir.module.module,description:multi_company.module_meta_information +msgid "This module add the possibility to easily manage \n" +" the default value for each object\n" +" " +msgstr "" + +#. module: multi_company +#: field:multi_company.default,company_id:0 +msgid "Main Company" +msgstr "" + +#. module: multi_company +#: view:multi_company.default:0 +msgid "Condition" +msgstr "" + +#. module: multi_company +#: help:multi_company.default,company_dest_id:0 +msgid "Company to store the current record" +msgstr "" + +#. module: multi_company +#: constraint:ir.ui.view:0 +msgid "Invalid XML for View Architecture!" +msgstr "" + +#. module: multi_company +#: field:multi_company.default,name:0 +msgid "Name" +msgstr "" + +#. module: multi_company +#: constraint:product.template:0 +msgid "Error: UOS must be in a different category than the UOM" +msgstr "" + +#. module: multi_company +#: model:product.category,name:multi_company.Odoo1 +msgid "Odoo Offers" +msgstr "" + +#. module: multi_company +#: constraint:res.company:0 +msgid "Error! You can not create recursive companies." +msgstr "" + +#. module: multi_company +#: help:multi_company.default,name:0 +msgid "Name it to easily find a record" +msgstr "" + +#. module: multi_company +#: model:ir.ui.menu,name:multi_company.menu_custom_multicompany +msgid "Multi company" +msgstr "" + +#. module: multi_company +#: model:ir.model,name:multi_company.model_multi_company_default +msgid "multi_company.default" +msgstr "" + +#. module: multi_company +#: help:multi_company.default,company_id:0 +msgid "Company where the user is connected" +msgstr "" + +#. module: multi_company +#: model:ir.actions.act_window,name:multi_company.action_inventory_form +msgid "Default Company per Object" +msgstr "" + +#. module: multi_company +#: field:multi_company.default,expression:0 +msgid "Expression" +msgstr "" + +#. module: multi_company +#: model:product.template,name:multi_company.product_product_odoo1_product_template +msgid "Odoo Offer" +msgstr "" + +#. module: multi_company +#: field:multi_company.default,sequence:0 +msgid "Sequence" +msgstr "" + +#. module: multi_company +#: constraint:product.category:0 +msgid "Error ! You can not create recursive categories." +msgstr "" + +#. module: multi_company +#: constraint:product.product:0 +msgid "Error: Invalid ean code" +msgstr "" + +#. module: multi_company +#: help:multi_company.default,expression:0 +msgid "Expression, must be True to match" +msgstr "" + +#. module: multi_company +#: model:ir.ui.menu,name:multi_company.menu_action_inventory_form +msgid "Default company per Object" +msgstr "" + +#. module: multi_company +#: code:addons/multi_company/multi_company.py:0 +#, python-format +msgid " (copy)" +msgstr "" + +#. module: multi_company +#: view:multi_company.default:0 +msgid "Matching" +msgstr "" + diff --git a/addons/multi_company/multi_company.py b/addons/multi_company/multi_company.py index a55e28f51a2..6af7e342bed 100644 --- a/addons/multi_company/multi_company.py +++ b/addons/multi_company/multi_company.py @@ -18,35 +18,69 @@ # along with this program. If not, see . # ############################################################################## -from mx import DateTime -import time -import netsvc -from osv import fields, osv -from tools import config + +""" +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 _ -import tools class multi_company_default(osv.osv): + """ + Manage multi company default value + """ _name = 'multi_company.default' - _order = 'sequence,id' + _description = 'Default multi company' + _order = 'company_id,sequence,id' + _columns = { - 'sequence': fields.integer('Sequence'), - 'name': fields.char('Name', size=32, required=True), - 'company_id': fields.many2one('res.company', 'Main Company', required=True), - 'company_dest_id': fields.many2one('res.company', 'Default Company', required=True), - 'object_id': fields.many2one('ir.model', 'Object', required=True), - 'expression': fields.char('Expression', size=32, required=True), - } + '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: 1 - } + '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={}): + + 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): @@ -54,7 +88,7 @@ class res_company(osv.osv): 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 index baac5b322d4..b39a5ad0b7e 100644 --- a/addons/multi_company/multi_company_view.xml +++ b/addons/multi_company/multi_company_view.xml @@ -5,14 +5,15 @@ multi_company.default.tree multi_company.default tree + - - - + + + @@ -20,26 +21,54 @@ multi_company.default.form multi_company.default form +
- - - - - - + + + + + + + + + + - + + + multi_company.default.search + multi_company.default + search + + + + + + + + + + + - Multi Company + 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 new file mode 100644 index 00000000000..3ea1d07dcad --- /dev/null +++ b/addons/multi_company/security/ir.model.access.csv @@ -0,0 +1,2 @@ +"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