Commit 13e3a750 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Check if object already exists before making a copy in ERP5Catalog

parent d0f3d1f6
......@@ -1728,9 +1728,9 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
# Copy-paste objects from SQLCatalog to ERP5Catalog
for id in sql_catalog.objectIds():
ob = sql_catalog._getOb(id)
# Check if the object is copyable
# Check if the object is copyable and that it doesn't already exist
# The copying attributes are from OFS.CopySupport
if hasattr(ob, '_canCopy'):
if hasattr(ob, '_canCopy') and not new_erp5_catalog.has_key(id):
# Get a copy of object for new conainer, i.e. new_erp5_catalog
ob = ob._getCopy(new_erp5_catalog)
ob._setId(id)
......
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