Commit 567f065d authored by Kevin Deldycke's avatar Kevin Deldycke

* Mark ERP5 Form objects as modified when one of its widget is modified. This...

* Mark ERP5 Form objects as modified when one of its widget is modified. This will keep the layout and the widget order when update.
* Auto-clean the code.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5762 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7ecbfc6f
...@@ -882,6 +882,21 @@ class SkinTemplateItem(ObjectTemplateItem): ...@@ -882,6 +882,21 @@ class SkinTemplateItem(ObjectTemplateItem):
def __init__(self, id_list, tool_id='portal_skins', **kw): def __init__(self, id_list, tool_id='portal_skins', **kw):
ObjectTemplateItem.__init__(self, id_list, tool_id=tool_id, **kw) ObjectTemplateItem.__init__(self, id_list, tool_id=tool_id, **kw)
def preinstall(self, context, installed_bt, **kw):
modified_object_list = ObjectTemplateItem.preinstall(self, context, installed_bt, **kw)
# We must install/update an ERP5 Form if one of its widget is modified.
# This allow to keep the widget order and the form layout after an update
# from a BT to another one.
for (bt_obj_path, bt_obj) in self._objects.items():
if getattr(bt_obj, 'meta_type', None) == 'ERP5 Form':
# search sub-objects of ERP5 Forms that are marked as "modified"
for upd_obj_path in modified_object_list.keys():
if upd_obj_path.startswith(bt_obj_path):
# a child of the ERP5 Form must be updated, so the form too
if not modified_object_list.has_key(bt_obj_path):
modified_object_list.update({bt_obj_path: ['Modified', self.__class__.__name__[:-12]]})
return modified_object_list
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
ObjectTemplateItem.install(self, context, trashbin, **kw) ObjectTemplateItem.install(self, context, trashbin, **kw)
update_dict = kw.get('object_to_update') update_dict = kw.get('object_to_update')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment