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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
b947f4f3
Commit
b947f4f3
authored
Mar 17, 2016
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Base: add isDeletable method to check if an object can be deleted
parent
1c10b4ef
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+5
-0
product/ERP5Form/Document/Preference.py
product/ERP5Form/Document/Preference.py
+5
-0
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+14
-0
No files found.
product/ERP5/ERP5Site.py
View file @
b947f4f3
...
@@ -368,6 +368,11 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
...
@@ -368,6 +368,11 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
return
self
return
self
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isDeletable'
)
def
isDeletable
(
self
,
check_relation
):
return
False
security
.
declarePrivate
(
'manage_beforeDelete'
)
security
.
declarePrivate
(
'manage_beforeDelete'
)
def
manage_beforeDelete
(
self
,
item
,
container
):
def
manage_beforeDelete
(
self
,
item
,
container
):
# skin is setup during __before_publishing_traverse__, which
# skin is setup during __before_publishing_traverse__, which
...
...
product/ERP5Form/Document/Preference.py
View file @
b947f4f3
...
@@ -95,3 +95,8 @@ class Preference( Folder ):
...
@@ -95,3 +95,8 @@ class Preference( Folder ):
def
disable
(
self
,
**
kw
):
def
disable
(
self
,
**
kw
):
"""Workflow method"""
"""Workflow method"""
self
.
_clearCache
()
self
.
_clearCache
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isDeletable'
)
def
isDeletable
(
self
,
check_relation
):
return
not
(
check_relation
and
self
.
getRelationCountForDeletion
())
product/ERP5Type/Base.py
View file @
b947f4f3
...
@@ -2684,6 +2684,20 @@ class Base( CopyContainer,
...
@@ -2684,6 +2684,20 @@ class Base( CopyContainer,
else
:
else
:
return
False
return
False
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isDeletable'
)
def
isDeletable
(
self
,
check_relation
):
"""Test if object can be delete"""
portal
=
self
.
getPortalObject
()
if
not
portal
.
portal_workflow
.
isTransitionPossible
(
self
,
'delete'
):
if
not
portal
.
portal_membership
.
checkPermission
(
'Delete objects'
,
self
.
getParentValue
()):
return
False
for
wf_id
in
getattr
(
aq_base
(
self
),
"workflow_history"
,
()):
if
wf_id
!=
'edit_workflow'
:
return
False
return
not
(
check_relation
and
self
.
getRelationCountForDeletion
())
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isDeleted'
)
'isDeleted'
)
def
isDeleted
(
self
):
def
isDeleted
(
self
):
...
...
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