Commit a7965ea3 authored by Aurel's avatar Aurel

do no failed when upgrading portal type with empty action

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13874 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cfceb417
......@@ -682,9 +682,12 @@ class ObjectTemplateItem(BaseTemplateItem):
# set actions
action_list = subobjects_dict['action_list']
for action in action_list:
action_text = action.action
if isinstance(action_text, Expression):
action_text = action_text.text
obj.addAction(id = action.id
, name = action.title
, action = action.action.text
, action = action_text
, condition = action.getCondition()
, permission = action.permissions
, category = action.category
......
......@@ -981,6 +981,22 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
, priority = 2.0 )
sequence.edit(first_action_id='become_geek')
def stepCreateEmptyAction(self, sequence=None, sequence_list=None, **kw):
"""
Create an empty action
"""
pt = self.getTypeTool()
object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id)
object_pt.addAction(id = ''
, name = ' Nerd'
, action = ''
, condition = ''
, permission = ()
, category = ''
, visible = 1
, priority = 1.2)
def stepCreateSecondAction(self, sequence=None, sequence_list=None, **kw):
"""
Create a second action
......@@ -2551,6 +2567,54 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
def test_07_BusinessTemplateWithEmptyAction(self, quiet=quiet, run=run_all_test):
if not run: return
if not quiet:
message = 'Test Business Template Upgrade With Empty Action'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ', 0, message)
sequence_list = SequenceList()
sequence_string = '\
CreatePortalType \
CreateFirstAction \
CreateNewBusinessTemplate \
UseExportBusinessTemplate \
CheckModifiedBuildingState \
CheckNotInstalledInstallationState \
AddPortalTypeToBusinessTemplate \
FillPortalTypesFields \
BuildBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
CheckObjectPropertiesInBusinessTemplate \
SaveBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
RemoveBusinessTemplate \
RemoveAllTrashBins \
CreateEmptyAction \
ImportBusinessTemplate \
UseImportBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
InstallBusinessTemplate \
Tic \
CheckInstalledInstallationState \
CheckBuiltBuildingState \
CheckSkinsLayers \
CheckPortalTypeExists \
CheckFirstActionExists \
UninstallBusinessTemplate \
CheckBuiltBuildingState \
CheckNotInstalledInstallationState \
CheckPortalTypeRemoved \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
def test_08_BusinessTemplateWithTwoActions(self, quiet=quiet, run=run_all_test):
if not run: return
if not quiet:
......
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