+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()
+