From a9e332fd003afeb5ad662be51c313fd562b72cf4 Mon Sep 17 00:00:00 2001 From: "mga@tinyerp.com" <> Date: Sat, 26 Jul 2008 12:23:38 +0530 Subject: [PATCH] apply context to take care for the * local update in view - no need to create a user wise view * updates from e-tiny - create a user wise view bzr revid: mga@tinyerp.com-20080726065338-e3eoh23vgenwuxjn --- bin/addons/base/ir/ir_ui_view.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/addons/base/ir/ir_ui_view.py b/bin/addons/base/ir/ir_ui_view.py index 1522917ca51..e3d23a69dc7 100644 --- a/bin/addons/base/ir/ir_ui_view.py +++ b/bin/addons/base/ir/ir_ui_view.py @@ -62,7 +62,7 @@ class view(osv.osv): 'inherit_id': fields.many2one('ir.ui.view', 'Inherited View'), 'field_parent': fields.char('Childs Field',size=64), 'user_id': fields.many2one('res.users', 'User'), - 'ref_id': fields.many2one('ir.ui.view', 'Inherited View'), + 'ref_id': fields.many2one('ir.ui.view', 'Orignal View'), } _defaults = { 'arch': lambda *a: '\n\n\t\n', @@ -74,9 +74,21 @@ class view(osv.osv): ] def write(self, cr, uid, ids, vals, context={}): + vids = self.pool.get('ir.ui.view').search(cr, uid, [('user_id','=',uid), ('ref_id','=',ids[0])]) + if not vids and context.get('tiny', True) == True: + default = {} + default['user_id'] = uid + default['ref_id'] = ids[0] + nids = super(view, self).copy(cr, uid, ids[0], default, context=context) + return True + result = super(view, self).write(cr, uid, ids, vals, context) return result + def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): + result = super(view,self).read(cr, uid, ids, fields, context, load) + return result + view() #class UserView(osv.osv):