Merge lp:~openerp-dev/openobject-server/6.1-bug-invisible_modifiers-xal into lp:openobject-server/6.1

Proposed by Xavier ALT
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/6.1-bug-invisible_modifiers-xal
Merge into: lp:openobject-server/6.1
Diff against target: 15 lines (+4/-2)
1 file modified
openerp/osv/orm.py (+4/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.1-bug-invisible_modifiers-xal
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+103075@code.launchpad.net

Description of the change

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

To post a comment you must log in.

Unmerged revisions

4151. By Xavier ALT

[FIX] orm: 'invisible' modifiers should be set True, if any of 'states' or attrs 'invisible' domain eval to True

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/osv/orm.py'
2--- openerp/osv/orm.py 2012-03-23 11:17:50 +0000
3+++ openerp/osv/orm.py 2012-04-23 10:54:17 +0000
4@@ -100,8 +100,10 @@
5
6 if node.get('states'):
7 if 'invisible' in modifiers and isinstance(modifiers['invisible'], list):
8- # TODO combine with AND or OR, use implicit AND for now.
9- modifiers['invisible'].append(('state', 'not in', node.get('states').split(',')))
10+ # combine state and normalized domain with OR because if any of them
11+ # is true, node should be invisible
12+ invisible_domain = expression.normalize(modifiers['invisible'])
13+ modifiers['invisible'] = ['|', ('state', 'not in', node.get('states').split(','))] + invisible_domain
14 else:
15 modifiers['invisible'] = [('state', 'not in', node.get('states').split(','))]
16