@@ -21,7 +21,5 @@
|
||||
|
||||
import multi_company
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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 <christophe.chauvet@syleam.fr>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\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"
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
@@ -18,35 +18,69 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
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:
|
||||
|
||||
@@ -5,14 +5,15 @@
|
||||
<field name="name">multi_company.default.tree</field>
|
||||
<field name="model">multi_company.default</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="8"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Multi Company">
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="company_dest_id"/>
|
||||
<field name="object_id"/>
|
||||
<field name="expression" />
|
||||
<field name="sequence"/>
|
||||
<field name="company_dest_id"/>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -20,26 +21,54 @@
|
||||
<field name="name">multi_company.default.form</field>
|
||||
<field name="model">multi_company.default</field>
|
||||
<field name="type">form</field>
|
||||
<field name="priority" eval="8"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Multi Company">
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="company_dest_id"/>
|
||||
<field name="object_id"/>
|
||||
<field name="expression" />
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" colspan="6"/>
|
||||
<separator string="Matching" colspan="6"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="object_id"/>
|
||||
<field name="company_dest_id"/>
|
||||
<separator string="Condition" colspan="6"/>
|
||||
<field name="expression" colspan="4"/>
|
||||
<field name="sequence"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_inventory_search" model="ir.ui.view">
|
||||
<field name="name">multi_company.default.search</field>
|
||||
<field name="model">multi_company.default</field>
|
||||
<field name="type">search</field>
|
||||
<field name="priority" eval="8"/>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Multi Company">
|
||||
<field name="name" select="1"/>
|
||||
<field name="company_id" select="1" widget="selection"/>
|
||||
<field name="company_dest_id" select="1" widget="selection"/>
|
||||
<field name="object_id" select="1"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_inventory_form" model="ir.actions.act_window">
|
||||
<field name="name">Multi Company</field>
|
||||
<field name="name">Default Company per Object</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">multi_company.default</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="search_view_id" ref="view_inventory_search"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_inventory_form" id="menu_action_inventory_form" parent="base.menu_action_res_company_tree"/>
|
||||
|
||||
|
||||
<menuitem id="menu_custom_multicompany"
|
||||
name="Multi company"
|
||||
parent="base.menu_custom"
|
||||
sequence="50"/>
|
||||
|
||||
<menuitem id="menu_action_inventory_form"
|
||||
action="action_inventory_form"
|
||||
parent="menu_custom_multicompany"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -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
|
||||
|
Reference in New Issue
Block a user