Move elements in view architecture instead of delete and reinsert them
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Confirmed
|
Wishlist
|
OpenERP's Framework R&D |
Bug Description
Sometimes we need to move an element to another position in the view. Other installed modules may have touched them and added or changes some attributes. If we first delete the field or group or whatever and then reinsert at the new position (with copy and paste from the "original" xml definition) we may loose those modifications.
There should be a way to simply move the element to the new position and keeping its attributes and content.
<xpath expr="/
<xpath expr="/
I figured out a way with small changes to osv/orm.
+ elif pos == 'move':
+ expr2 = spec.get('before')
+ if expr2:
+ move_after = False
+ else:
+ move_after = True
+ expr2 = spec.get('after')
+ if expr2 is None:
+ raise_view_
+ node2 = source.xpath(expr2)
+ node2 = node2[0] if node2 else None
+ if node2 is None:
+ raise_view_
+ parent2 = node2.getparent()
+ node2_index = parent2.
+ parent2.
Changed in openobject-server: | |
assignee: | nobody → OpenERP's Framework R&D (openerp-dev-framework) |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
I rewrote the code given above (and created a diff-file). Now supported move-targets are inside, before and after and (I think) the code looks more pythonic.