Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
139
Merge Requests
139
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
bf424d9c
Commit
bf424d9c
authored
Apr 20, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BusinessTemplate: do not delete module when uninstalling ModuleTemplateItem
parent
c020b284
Pipeline
#20943
failed with stage
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
24 deletions
+41
-24
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+40
-0
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+1
-24
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
bf424d9c
...
@@ -7679,6 +7679,46 @@ class TestBusinessTemplate(BusinessTemplateMixin):
...
@@ -7679,6 +7679,46 @@ class TestBusinessTemplate(BusinessTemplateMixin):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
def
test_uninstall_module
(
self
):
"""ModuleTemplateItem are not uninstalled
"""
self
.
portal
.
newContent
(
id
=
'dummy_module'
,
portal_type
=
'Folder'
)
self
.
tic
()
bt
=
self
.
portal
.
portal_templates
.
newContent
(
portal_type
=
'Business Template'
,
title
=
'test_bt_%s'
%
self
.
id
(),
template_module_id_list
=
(
'dummy_module'
,))
self
.
tic
()
bt
.
build
()
self
.
tic
()
export_dir
=
tempfile
.
mkdtemp
()
try
:
bt
.
export
(
path
=
export_dir
,
local
=
True
)
self
.
tic
()
new_bt
=
self
.
portal
.
portal_templates
.
download
(
url
=
'file:/%s'
%
export_dir
)
finally
:
shutil
.
rmtree
(
export_dir
)
# modify the document
self
.
portal
.
manage_delObjects
(
ids
=
[
'dummy_module'
])
self
.
tic
()
# install the business template
new_bt
.
install
()
self
.
tic
()
self
.
assertIsNotNone
(
self
.
portal
.
_getOb
(
'dummy_module'
,
None
))
# uninstall the business template, the module should be kept
new_bt
.
uninstall
()
self
.
tic
()
self
.
assertIsNotNone
(
self
.
portal
.
_getOb
(
'dummy_module'
,
None
))
class
_ZodbComponentTemplateItemMixin
(
BusinessTemplateMixin
):
class
_ZodbComponentTemplateItemMixin
(
BusinessTemplateMixin
):
"""
"""
Test cases for all Test*TemplateItem test classes.
Test cases for all Test*TemplateItem test classes.
...
...
product/ERP5/Document/BusinessTemplate.py
View file @
bf424d9c
...
@@ -3794,32 +3794,9 @@ class ModuleTemplateItem(BaseTemplateItem):
...
@@ -3794,32 +3794,9 @@ class ModuleTemplateItem(BaseTemplateItem):
self
.
_objects
[
file_name
[:
-
4
]]
=
mapping
self
.
_objects
[
file_name
[:
-
4
]]
=
mapping
def
uninstall
(
self
,
context
,
**
kw
):
def
uninstall
(
self
,
context
,
**
kw
):
trash
=
kw
.
get
(
'trash'
,
0
)
# Do not remove any module for safety.
if
trash
:
return
object_path
=
kw
.
get
(
'object_path'
,
None
)
trashbin
=
kw
.
get
(
'trashbin'
,
None
)
if
object_path
is
None
:
keys
=
self
.
_archive
.
keys
()
else
:
keys
=
[
object_path
]
p
=
context
.
getPortalObject
()
id_list
=
p
.
objectIds
()
for
key
in
keys
:
if
key
in
id_list
:
try
:
if
trash
and
trashbin
is
not
None
:
container_path
=
key
.
split
(
'/'
)
self
.
portal_trash
.
backupObject
(
trashbin
,
container_path
,
key
,
save
=
1
,
keep_subobjects
=
1
)
p
.
manage_delObjects
([
key
])
except
NotFound
:
pass
BaseTemplateItem
.
uninstall
(
self
,
context
,
**
kw
)
BaseTemplateItem
.
uninstall
(
self
,
context
,
**
kw
)
def
trash
(
self
,
context
,
new_item
,
**
kw
):
# Do not remove any module for safety.
pass
# XXX-arnau: when everything has been migrated to Components, this class
# XXX-arnau: when everything has been migrated to Components, this class
# should be removed and only _ZodbComponentTemplateItem should remain
# should be removed and only _ZodbComponentTemplateItem should remain
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment