Commit face5b89 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

if a base category is removed, it should be listed in 'reinstall business...

if a base category is removed, it should be listed in 'reinstall business template' listbox, before it raised an Exception.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38936 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 17dd2cb5
......@@ -1517,8 +1517,14 @@ class CategoryTemplateItem(ObjectTemplateItem):
BaseTemplateItem.build(self, context, **kw)
p = context.getPortalObject()
for relative_url in self._archive.keys():
try:
obj = p.unrestrictedTraverse(relative_url)
obj = obj._getCopy(context)
except (KeyError, AttributeError):
if self.is_bt_for_diff:
continue
else:
raise ValueError, "%s not found" % relative_url
_recursiveRemoveUid(obj)
obj = self.removeProperties(obj, 1)
include_sub_categories = obj.__of__(context).getProperty('business_template_include_sub_categories', 0)
......
......@@ -3474,6 +3474,37 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
def test_06_BusinessTemplateReInstallWithBaseCategory(self, quiet=quiet, run=run_all_test):
if not run: return
if not quiet:
message = 'Test Business Template reinstall after removing Base Category'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ', 0, message)
sequence_list = SequenceList()
sequence_string = '\
CreateBaseCategory \
CreateNewBusinessTemplate \
UseExportBusinessTemplate \
AddBaseCategoryToBusinessTemplate \
CheckModifiedBuildingState \
CheckNotInstalledInstallationState \
BuildBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
CheckObjectPropertiesInBusinessTemplate \
SaveBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
ImportBusinessTemplate \
UseImportBusinessTemplate \
InstallBusinessTemplate \
Tic \
RemoveBaseCategory \
CheckPreinstallReturnSomething \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
# test of actions
def test_07_BusinessTemplateWithOneAction(self, quiet=quiet, run=run_all_test):
if not run: return
......
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