> I thought it was good but it is not...
> 
> If you have a global filter, when you create a user-specific filter with the
> same name, the global one is overwritten, making it user-specific. So after
> that there is no more the global filter.
> 
> Probably leaving out the case
> 
>   or ('user_id','=',False)
> 
> in the domain should do the trick.

Hello,

If we do so then we are back to the position from where we begin.... :)

instead we can just Only the user_specific filters.if any !

nch@nch-laptop:~/workspace/OpenERP2011/rdtools/server/trunk-bug-802976-nch$ bzr 
diff
=== modified file 'openerp/addons/base/ir/ir_filters.py'
--- openerp/addons/base/ir/ir_filters.py        2011-06-29 11:36:36 +0000
+++ openerp/addons/base/ir/ir_filters.py        2011-06-30 06:29:45 +0000
@@ -39,13 +39,19 @@
         return my_acts
 
     def create_or_replace(self, cr, uid, vals, context=None):
+        ## Search all filters i.e global and user_specific matching the
+        ## new filter name order by user_id so that not null values
+        ## will be at first.
         filter_domain = [('name', '=', vals['name'].lower()),
                          ('model_id','=', vals['model_id']),
                          '|',('user_id','=',uid),('user_id','=',False)]
         filter_ids = self.search(cr, uid, filter_domain, order='user_id', 
context=context)
+        ## Only update the user_specific filters.
         if filter_ids:
-            self.write(cr, uid, filter_ids[0], vals, context)
-            return False
+            filter_rec = self.browse(cr, uid, filter_ids[0], context)
+            if filter_rec.user_id:
+                self.write(cr, uid, filter_ids[0], vals, context)
+                return False
         return self.create(cr, uid, vals, context)
 
     def _auto_init(self, cr, context={}):
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-bug-802976-nch/+merge/66246
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/trunk-bug-802976-nch.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to