[Erp5-users] About object Import
Franck Martin
franck.martin.nice at gmail.com
Mon Jun 26 17:18:51 CEST 2006
Hi Kevin,
I modify the ERP5Site_getModulePortalTypeSortedPropertyList and
ERP5Site_importPersonObjectFromOOo to permit import of relation
(relationStringField) and categories. But when the imported property
string was not transcode from unicode ("xxx".encode('utf8') or
"xxx".encode('ascii') ) your script won't configure categories and
relation in imported objects, only the stringfield.
I don't know if it's a bug because your
ERP5Site_getModulePortalTypeSortedPropertyList script don't include
categories.
---for ERP5Site_getModulePortalTypeSortedPropertyList ---
module = context
property_list = []
+additionnal_property_list = ["Person.career_subordination",
"Person.gender", "Person.nationality"]
for portal_type in module.allowedContentTypes():
for property in portal_type.getInstancePropertyMap():
property_string = "%s.%s" % (portal_type.id, property['id'])
property_list.append(property_string)
+for property in additionnal_property_list :
+ property_list.append(property)
+
property_list.sort()
return [('-- Ignore this Property --', '')] + map(lambda x: (x,x),
property_list)
--- end ---
--- for ERP5Site_importPersonObjectFromOOo ---
@@ -103,7 +103,7 @@
object_list[property_module][property_pt] = []
# Create a new property value
- new_object_property_dict[property_id] = property_value
+ new_object_property_dict[property_id] =
property_value.encode('utf8')
if len(new_object_property_dict.keys()) > 0:
object_list[property_module][property_pt].append(new_object_property_dict)
~
---end ---
--
Franck Martin
06000 Nice
More information about the Erp5-users
mailing list