Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/SUP-53947.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add external method to fix `PatrimonyCertificate` class
[jchandelle]
23 changes: 23 additions & 0 deletions src/Products/urban/Extensions/fix_moved_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,26 @@ def fix_labruyere_envclassthrees():
reindex_object(obj)

logger.info("finished.")


def fix_liege_patrimony():
from Products.urban.interfaces import IMiscDemand
from Products.urban.content.licence.PatrimonyCertificate import PatrimonyCertificate

logger.info("Start fixing PatrimonyCertificate")
portal = api.portal.get()
folder = portal.urban.patrimonycertificates

for obj_id, obj in folder.contentItems():
if not IMiscDemand.providedBy(obj):
continue
logger.info("fixing and reindexing {} ...".format(obj_id))
if obj.__class__ == PatrimonyCertificate:
continue
obj.__class__ = PatrimonyCertificate
obj.meta_type = "PatrimonyCertificate"
obj.schema = PatrimonyCertificate.schema
obj._p_changed = 1
obj.reindexObject()

logger.info("End fixing PatrimonyCertificate")