Xavier ALT (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/6.1-bug-invisible_modifiers-xal into 
lp:openobject-server/6.1.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.1-bug-invisible_modifiers-xal/+merge/103075

Hi,

This fix a wrong computation of 'invisible' modifiers.

Steps:
1. Create a new "Internal Move" (Warehouse / Warehouse Management / Internal 
Moves)
2. Add some lines
3. On one line, click the "Put in current pack" button
4. The new pack is affected

Current: on step 4, the button is still present
Expected: on step 4, the button should disappear.

Under this view, button have attrs="{'invisible': [('tracking_id','<>',False)]} 
and states="draft,assigned,confirmed". If any of them evaluate to True, the 
button should be hidden, currently server consider that "both" must evaluate to 
True.

Regards,
Xavier
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/6.1-bug-invisible_modifiers-xal/+merge/103075
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/6.1-bug-invisible_modifiers-xal.
=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py	2012-03-23 11:17:50 +0000
+++ openerp/osv/orm.py	2012-04-23 10:54:17 +0000
@@ -100,8 +100,10 @@
 
     if node.get('states'):
         if 'invisible' in modifiers and isinstance(modifiers['invisible'], list):
-             # TODO combine with AND or OR, use implicit AND for now.
-             modifiers['invisible'].append(('state', 'not in', node.get('states').split(',')))
+             # combine state and normalized domain with OR because if any of them
+             # is true, node should be invisible
+             invisible_domain = expression.normalize(modifiers['invisible'])
+             modifiers['invisible'] = ['|', ('state', 'not in', node.get('states').split(','))] + invisible_domain
         else:
              modifiers['invisible'] = [('state', 'not in', node.get('states').split(','))]
 

_______________________________________________
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