Mohammed Shekha(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/6.0-opw-17629-msh into 
lp:openobject-client-web/6.0.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-17629-msh/+merge/79393

Hello,

Let me explain how to generate the issue.

Create two objects for e.g. object1 and object2, object2 should contain 
many2one field which has relation with object1. Now create security.csv file 
which contains security as follow.


"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"object2_all","object2_name","model_object2","",1,0,0,0
"object1_admin","object1_name","model_object1","base.group_partner_manager",1,0,0,0

Now here you can see we have given read permission to all the user for object2 
which contains many2one field, and we have given read permission on object1 to 
only  base.group_partner_manager.

Now login with Demo user and try to open form view of object2 in which we have 
displayed many2one field.

Problem :- You will not find many2one value instead of that you will get 
==Access Error==.

Reason :- This problem occurs due to revision 4634, Here in revision 4634 there 
is a code to just return id of many2one field while the time of read(fields) in 
_form.py and due to that when setValue of many2one is called while the time of 
creating many2one widget it will call "name_get" method because we have only id 
so we have to get the value for many2one and name_get will refers relational 
object, so there will be an Access Error from server due to no read permission 
to Demo User on object1.

Expected: Demo User should able to show value of many2one as GTK behave but he 
should not able to open that many2one record.


What if we revert this revision 4634 ?:- 

Demo:- Sales -> address -> Customer -> Create Bank details -> Save

Observed :- Error 

Reason :- In address country field passes (id, Value), there must be only id.

So changed the code accordingly so that both problem get solved.

Kindly share your views about this.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-17629-msh/+merge/79393
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-opw-17629-msh.
=== modified file 'addons/openerp/controllers/search.py'
--- addons/openerp/controllers/search.py	2011-09-20 07:53:51 +0000
+++ addons/openerp/controllers/search.py	2011-10-14 11:24:24 +0000
@@ -167,6 +167,10 @@
                 if val is None:
                     context[key] = False
 
+        #ctx contains evaluated value which are evaluated by TinyForm(**kw).to_python() so replace context value by value of ctx.
+        for key, val in context.items():
+            if key in ctx:
+                context[key] = ctx[key]
         if isinstance(context, dict):
             context = expr_eval(context, ctx)
         parent_context.update(context)

=== modified file 'addons/openerp/widgets/form/_form.py'
--- addons/openerp/widgets/form/_form.py	2011-09-23 11:33:06 +0000
+++ addons/openerp/widgets/form/_form.py	2011-10-14 11:24:24 +0000
@@ -771,11 +771,7 @@
                 if lval:
                     values = lval[0]
                     self.id = ids[0]
-                    
-                    for f in fields:
-                        if fields[f]['type'] == 'many2one' and isinstance(values[f], tuple):
-                            values[f] = values[f][0]
-                            
+                                               
                     ConcurrencyInfo.update(self.model, [values])
 
             elif 'datas' in view: # wizard data

_______________________________________________
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