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

Requested reviews:
  OpenERP Core Team (openerp)

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

Hello,

Fixed the issue of state field conflicts when there is state field in parent as 
well as one2many list view.

Demo :- Edit sale order form as follow.

<form sale order>
    <field name="client_order_ref" attrs="{'readonly': 
[('state','=','done')]}"/>
    <sale order line form></sale oreder line form>
    <sale order line tree view >
        <field name="state" invisible="1"/>
   <sale order line tree />
   <sale order state field />
</form>

Faced :- If sale order line has state done then all the field of sale order 
will also be readonly which has state based attrs.

Reason :- The is because if we set invisible="1" for sale order line then it 
will create Hidden field for state, and set id="state", and the same state 
field is on sale order which has id="state" so state id conflicts.

Hence added prefix for the hidden fields so that form_hookStateChange method of 
form_state.js can retrieve it with prefix.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-576891_stateFieldConflicts-msh/+merge/117154
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-opw-576891_stateFieldConflicts-msh.
=== modified file 'addons/openerp/static/javascript/form_state.js'
--- addons/openerp/static/javascript/form_state.js	2012-07-27 16:09:14 +0000
+++ addons/openerp/static/javascript/form_state.js	2012-07-28 10:10:25 +0000
@@ -403,7 +403,7 @@
 
     var $field = typeof(fieldName) == "string" ? jQuery(idSelector(fieldName)) : jQuery(fieldName);
 
-    if (!$field.length || parseInt($field.attr("fld_readonly"))) {
+    if (!$field.length) {
         return;
     }
 

=== modified file 'addons/openerp/widgets/listgrid.py'
--- addons/openerp/widgets/listgrid.py	2012-07-10 15:40:28 +0000
+++ addons/openerp/widgets/listgrid.py	2012-07-28 10:10:25 +0000
@@ -301,10 +301,14 @@
         if self.pageable:
             self.pager = Pager(ids=self.ids, offset=self.offset, limit=self.limit, count=self.count)
             self.pager._name = self.name
-           
+        #Add prefix for the hidden fields otherwise same field name in parent and child will conflict
+        for f, fa in self.hiddens:
+            if not isinstance(fa, int):
+                fa['prefix'] = '_terp_listfields' + ((self.name != '_terp_list' or '') and '/' + self.name)
+
         if self.editable and context.get('set_editable'):#Treeview editable by default or set_editable in context
             attrs['editable'] = "bottom"
-        
+
         # make editors
         if self.editable and attrs.get('editable') in ('top', 'bottom'):
 

_______________________________________________
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