Sananaz (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/6.0-bug-16706-sma 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-bug-16706-sma/+merge/76547

Hello,

Problem is related to context evaluation on button action, for form view and 
list view.
1. Install hr_evaluation module
2. Click on Human Resources module Evaluations > Evaluations 
3. Create or edit records > create new Interview Evaluation 
4. Click on 'interview evaluation' button action

Here it shows only one field in wizard. Need to pass each record 'survey_id' on 
button context.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-bug-16706-sma/+merge/76547
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-bug-16706-sma.
=== 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-09-22 10:20:54 +0000
@@ -18,6 +18,7 @@
 #  You can see the MPL licence at: http://www.mozilla.org/MPL/MPL-1.1.html
 #
 ###############################################################################
+import cherrypy
 import simplejson
 from openerp.utils import rpc, expr_eval, TinyDict, TinyForm, TinyFormError
 
@@ -137,6 +138,8 @@
             active_id=params.active_id or False,
             active_ids=params.active_ids or [])
 
+        ctx.update(getattr(cherrypy.request, 'o2m_context', {}))
+
         ctx.update(
             parent=pctx,
             context=parent_context,

=== modified file 'addons/openerp/static/javascript/form.js'
--- addons/openerp/static/javascript/form.js	2011-08-03 11:02:15 +0000
+++ addons/openerp/static/javascript/form.js	2011-09-22 10:20:54 +0000
@@ -259,7 +259,7 @@
     }
 
     var req = eval_domain_context_request({
-        source: "",
+        source: name,
         domain: "[]",
         context: context
     });

=== modified file 'addons/openerp/utils/utils.py'
--- addons/openerp/utils/utils.py	2011-05-31 10:41:41 +0000
+++ addons/openerp/utils/utils.py	2011-09-22 10:20:54 +0000
@@ -21,6 +21,7 @@
 import itertools
 import re
 
+import cherrypy
 from openerp import validators
 import formencode
 import openobject
@@ -254,6 +255,10 @@
     def __init__(self, **kwargs):
 
         self.data = {}
+        # For one2many inline context when button action perform
+        self.context = kwargs.get('_terp_context')
+        self.active_id = kwargs.get('_terp_active_id')
+
         for k, v in kwargs.items():
             if '_terp_' not in k:
                 try:
@@ -288,7 +293,15 @@
                         relation_objects = Relation.read(o2m_ids, [], rpc.session.context)
                         relation_fields = Relation.fields_get(False, rpc.session.context)
                         for relation_record in relation_objects:
+                            flag = False
+                            if int(relation_record['id']) == int(self.active_id):
+                                flag = True
                             for field_name, field_value in relation_record.items():
+                                if flag and (field_name in self.context):
+                                    if isinstance(field_value, tuple):
+                                        cherrypy.request.o2m_context = {field_name: field_value[0]}
+                                    else:
+                                        cherrypy.request.o2m_context = {field_name: field_value}
                                 if field_name in relation_fields and relation_fields[field_name]['type'] == 'many2many':
                                     relation_record[field_name] = [OneToMany.replace_all(*field_value)]
 

_______________________________________________
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