Change the way content is added to the folder, so our chosen id is kept
This commit is contained in:
parent
52d2c54389
commit
f87dc75c98
|
@ -36,11 +36,12 @@ class Migrate(BrowserView):
|
|||
# first step is to create a "courrier entrant" object
|
||||
typename = 'courrier_entrant'
|
||||
factory = DexterityFactory(portal_type=typename)
|
||||
if hasattr(self.context, doc.get('id')):
|
||||
ob = getattr(self.context, doc.get('id'))
|
||||
else:
|
||||
|
||||
if not hasattr(self.context, doc.get('id')):
|
||||
ob = factory(id=doc.get('id'), title=doc.get('title'))
|
||||
addContentToContainer(self.context, ob)
|
||||
self.context._setObject(ob.id, ob)
|
||||
|
||||
ob = getattr(self.context, doc.get('id'))
|
||||
|
||||
ob.date_reception = datetime.datetime.strptime(doc.get('deliverydate'), '%Y-%m-%d').date()
|
||||
ob.numero_courrier = doc.get('mailnumber')
|
||||
|
|
Reference in New Issue