diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py
index 51a9be37e3a7054b7728ab13ba1d47bb820b908c..5b3e224054beec663192b9d63c2ef4909eb7381a 100644
--- a/product/ERP5/tests/testBusinessTemplate.py
+++ b/product/ERP5/tests/testBusinessTemplate.py
@@ -8225,6 +8225,95 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
     sequence_list.addSequenceString(sequence_string)
     sequence_list.play(self)
 
+  def stepCheckDocumentMigrationFailWithConsistencyError(self, sequence=None, **kw):
+    current_bt = sequence['current_bt']
+    self.assertRaises(RuntimeError,
+                      current_bt.migrateSourceCodeFromFilesystem,
+                      # version must not start with '_'
+                      version='_invalid_version')
+
+  def test_BusinessTemplateUpgradeDocumentFromFilesystemToZodbWithConsistencyError(self):
+    """
+    Check that component.checkConsistency() (called before "validating" a ZODB
+    Component) is done when migrating Document from filesystem to ZODB
+    """
+    sequence_list = SequenceList()
+    sequence_string = """
+      CreateDocument
+      CreateNewBusinessTemplate
+      UseExportBusinessTemplate
+      AddDocumentToBusinessTemplate
+      CheckModifiedBuildingState
+      CheckNotInstalledInstallationState
+      BuildBusinessTemplate
+      CheckBuiltBuildingState
+      CheckNotInstalledInstallationState
+      CheckObjectPropertiesInBusinessTemplate
+      UseCurrentBusinessTemplateForInstall
+      InstallWithoutForceBusinessTemplate
+      Tic
+      CheckInstalledInstallationState
+      CheckBuiltBuildingState
+      CheckSkinsLayers
+      CheckDocumentExists
+
+      CopyBusinessTemplate
+      CheckDocumentMigrationFailWithConsistencyError
+      """
+    sequence_list.addSequenceString(sequence_string)
+    sequence_list.play(self)
+
+  def stepCheckDocumentMigrationFailWithSourceCodeError(self, sequence=None, **kw):
+    current_bt = sequence['current_bt']
+
+    from Products.ERP5Type.mixin.component import ComponentMixin
+    orig_checkSourceCode = ComponentMixin.checkSourceCode
+    try:
+      ComponentMixin.checkSourceCode = lambda *args, **kwargs: [
+        {'type': 'E', 'row': 1, 'column': 1,
+         'text': 'Source Code Error for Unit Test'}]
+      self.assertRaises(RuntimeError, current_bt.migrateSourceCodeFromFilesystem,
+                        version='erp5')
+
+      ComponentMixin.checkSourceCode = lambda *args, **kwargs: [
+        {'type': 'F', 'row': 1, 'column': 1,
+         'text': 'Source Code Error for Unit Test'}]
+      self.assertRaises(RuntimeError, current_bt.migrateSourceCodeFromFilesystem,
+                        version='erp5')
+    finally:
+      ComponentMixin.checkSourceCode = orig_checkSourceCode
+
+  def test_BusinessTemplateUpgradeDocumentFromFilesystemToZodbWithSyntaxError(self):
+    """
+    Check that component.checkSourceCode() (called before "validating" a ZODB
+    Component) is done when migrating Document from filesystem to ZODB
+    """
+    sequence_list = SequenceList()
+    sequence_string = """
+      CreateDocument
+      CreateNewBusinessTemplate
+      UseExportBusinessTemplate
+      AddDocumentToBusinessTemplate
+      CheckModifiedBuildingState
+      CheckNotInstalledInstallationState
+      BuildBusinessTemplate
+      CheckBuiltBuildingState
+      CheckNotInstalledInstallationState
+      CheckObjectPropertiesInBusinessTemplate
+      UseCurrentBusinessTemplateForInstall
+      InstallWithoutForceBusinessTemplate
+      Tic
+      CheckInstalledInstallationState
+      CheckBuiltBuildingState
+      CheckSkinsLayers
+      CheckDocumentExists
+
+      CopyBusinessTemplate
+      CheckDocumentMigrationFailWithSourceCodeError
+      """
+    sequence_list.addSequenceString(sequence_string)
+    sequence_list.play(self)
+
 class TestConstraintTemplateItem(TestDocumentTemplateItem):
   document_title = 'UnitTest'
   document_data = ' \nclass UnitTest: \n  """ \n  Fake constraint for unit test \n \
@@ -8369,6 +8458,12 @@ TestConstraintTemplateItem.test_BusinessTemplateWithZodbDocumentMigrated = \
 TestConstraintTemplateItem.test_BusinessTemplateUpgradeDocumentFromFilesystemToZodb = \
     skip('Not implemented yet')(TestConstraintTemplateItem.test_BusinessTemplateUpgradeDocumentFromFilesystemToZodb)
 
+TestConstraintTemplateItem.test_BusinessTemplateUpgradeDocumentFromFilesystemToZodbWithConsistencyError = \
+    skip('Not implemented yet')(TestConstraintTemplateItem.test_BusinessTemplateUpgradeDocumentFromFilesystemToZodbWithConsistencyError)
+
+TestConstraintTemplateItem.test_BusinessTemplateUpgradeDocumentFromFilesystemToZodbWithSyntaxError = \
+    skip('Not implemented yet')(TestConstraintTemplateItem.test_BusinessTemplateUpgradeDocumentFromFilesystemToZodbWithSyntaxError)
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestBusinessTemplate))
diff --git a/product/ERP5Type/mixin/component.py b/product/ERP5Type/mixin/component.py
index 6b02c789861cd93d34f837d6106e0a98a93ef09b..8c9ceff1da087bce973c0eeeb7233b163ab43873 100644
--- a/product/ERP5Type/mixin/component.py
+++ b/product/ERP5Type/mixin/component.py
@@ -367,10 +367,20 @@ class ComponentMixin(PropertyRecordableMixin, Base):
                                        text_content=source_code,
                                        portal_type=cls.portal_type)
 
-    # Validate the Component once it is imported so it can be used
-    # straightaway as there should be no error
-    new_component.validate()
+    # XXX-ARNAU: checkConsistency() is also called before commit in
+    # Component_checkSourceCodeAndValidateAfterModified. Also, everything
+    # should be done in checkConsistency()...
+    error_message_list = [ m for m in new_component.checkSourceCode()
+                           if m['type'] in ('F', 'E') ]
+    if error_message_list:
+      raise SyntaxError(error_message_list)
+
+    consistency_message_list = new_component.checkConsistency()
+    if consistency_message_list:
+      from Products.DCWorkflow.DCWorkflow import ValidationFailed
+      raise ValidationFailed(consistency_message_list)
 
+    new_component.validate()
     return new_component
 
 InitializeClass(ComponentMixin)