From 6b4ea5627680517276341a795070d509909c9854 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayush.tiwari@nexedi.com> Date: Wed, 29 Mar 2017 15:22:04 +0000 Subject: [PATCH] bt5_config: Import should work for separated property objects also --- product/ERP5/Document/BusinessManager.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/product/ERP5/Document/BusinessManager.py b/product/ERP5/Document/BusinessManager.py index 6f60d7e396..576c017901 100644 --- a/product/ERP5/Document/BusinessManager.py +++ b/product/ERP5/Document/BusinessManager.py @@ -1136,25 +1136,24 @@ class BusinessItem(Implicit, Persistent): connection = self.getConnection(parent) __traceback_info__ = 'Importing %s' % file_name obj = connection.importFile(file_obj, customImporters=customImporters) + self._value = obj + + data = getTransactionalVariable().get(transactional_variable_obj_key) + if data is not None: + self._restoreSeparatelyExportedProperty(obj, data) elif file_ext != '.xml': # For ZODB Components: if .xml have been processed before, set the # source code property, otherwise store it in a transactional variable # so that it can be set once the .xml has been processed data = file_obj.read() - try: - obj = self._objects[obj_key] - except KeyError: + item = parent.getBusinessItemByPath(obj_key) + obj = item._value + if obj is None: getTransactionalVariable()[transactional_variable_obj_key] = data else: self._restoreSeparatelyExportedProperty(obj, data) - self._value = obj - - data = getTransactionalVariable().get(transactional_variable_obj_key) - if data is not None: - self._restoreSeparatelyExportedProperty(obj, data) - def _restoreSeparatelyExportedProperty(self, obj, data): unicode_data, property_name = SEPARATELY_EXPORTED_PROPERTY_DICT[ obj.__class__.__name__][1:] -- 2.30.9