Commit e68894d4 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Douglas

erp5_dms: fix archiveVersion archives already archived document

parent 5ffca5b2
...@@ -90,7 +90,7 @@ if not language:\n ...@@ -90,7 +90,7 @@ if not language:\n
# language, we can not do anything\n # language, we can not do anything\n
for old_document in portal_catalog(**search_kw):\n for old_document in portal_catalog(**search_kw):\n
old_document = old_document.getObject()\n old_document = old_document.getObject()\n
if not old_document.getLanguage():\n if old_document.getValidationState() in validation_state and not old_document.getLanguage():\n
old_document.archive()\n old_document.archive()\n
return\n return\n
\n \n
...@@ -98,7 +98,8 @@ if not language:\n ...@@ -98,7 +98,8 @@ if not language:\n
search_kw[\'language\'] = language\n search_kw[\'language\'] = language\n
for old_document in portal_catalog(**search_kw):\n for old_document in portal_catalog(**search_kw):\n
old_document = old_document.getObject()\n old_document = old_document.getObject()\n
old_document.archive()\n if old_document.getValidationState() in validation_state:\n
old_document.archive()\n
]]></string> </value> ]]></string> </value>
......
...@@ -2813,6 +2813,12 @@ return 1 ...@@ -2813,6 +2813,12 @@ return 1
self.assertEqual('archived', document_nolang_005.getValidationState()) self.assertEqual('archived', document_nolang_005.getValidationState())
self.assertEqual('shared_alive', document_nolang_006.getValidationState()) self.assertEqual('shared_alive', document_nolang_006.getValidationState())
# should ignore already archived document
document_nolang_007 = document_nolang_006.Base_createCloneDocument(batch_mode=1)
document_nolang_006.archive()
document_nolang_007.shareAlive()
self.tic()
def testFileWithNotDefinedMimeType(self): def testFileWithNotDefinedMimeType(self):
upload_file = makeFileUpload('TEST-001-en.dummy') upload_file = makeFileUpload('TEST-001-en.dummy')
kw = dict(file=upload_file, synchronous_metadata_discovery=True, kw = dict(file=upload_file, synchronous_metadata_discovery=True,
......
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