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
Laurent S
erp5
Commits
dc232b4f
Commit
dc232b4f
authored
Feb 02, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_prototype: Add workflow status methods for BP%
parent
2d96e897
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
product/ERP5/Document/BusinessPackage.py
product/ERP5/Document/BusinessPackage.py
+54
-0
No files found.
product/ERP5/Document/BusinessPackage.py
View file @
dc232b4f
...
...
@@ -47,6 +47,7 @@ from OFS import SimpleItem, XMLExportImport
from
Acquisition
import
Implicit
,
aq_base
,
aq_inner
,
aq_parent
from
Products.ERP5Type.dynamic.lazy_class
import
ERP5BaseBroken
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.CMFCore.utils
import
getToolByName
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
interfaces
from
Products.PythonScripts.PythonScript
import
PythonScript
from
AccessControl
import
ClassSecurityInfo
,
Unauthorized
,
getSecurityManager
...
...
@@ -139,16 +140,45 @@ class BusinessPackage(XMLObject):
,
PropertySheet
.
XMLObject
,
PropertySheet
.
SimpleItem
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Version
,
PropertySheet
.
BusinessPackage
)
def
__init__
(
self
,
*
args
,
**
kw
):
XMLObject
.
__init__
(
self
,
*
args
,
**
kw
)
security
.
declarePrivate
(
'manage_afterAdd'
)
def
manage_afterAdd
(
self
,
item
,
container
):
"""
This is called when a new business package is added or imported.
"""
portal_workflow
=
getToolByName
(
self
,
'portal_workflow'
)
if
portal_workflow
is
not
None
:
# Make sure that the installation state is "not installed".
if
portal_workflow
.
getStatusOf
(
'business_package_installation_workflow'
,
self
)
is
not
None
:
# XXX Not good to access the attribute directly,
# but there is no API for clearing the history.
self
.
workflow_history
[
'business_package_installation_workflow'
]
=
None
def
_install
(
self
,
**
kw
):
self
.
_path_item
.
install
(
self
)
self
.
_object_property_item
.
install
(
self
)
workflow_tool
=
self
.
getPortalObject
().
portal_workflow
workflow_tool
.
business_package_installation_workflow
.
notifyWorkflowMethod
(
self
,
'install'
,
kw
=
{
'comment'
:
'Installed'
})
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'install'
)
install
=
_install
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getShortRevision'
)
def
getShortRevision
(
self
):
"""Returned a shortened revision"""
r
=
self
.
getRevision
()
return
r
and
r
[:
5
]
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'preinstall'
)
def
preinstall
(
self
,
check_dependencies
=
1
,
**
kw
):
return
{}
...
...
@@ -257,6 +287,10 @@ class BusinessPackage(XMLObject):
self
.
_edit
(
**
prop_dict
)
self
.
storePathData
()
workflow_tool
=
self
.
getPortalObject
().
portal_workflow
workflow_tool
.
business_package_building_workflow
.
notifyWorkflowMethod
(
self
,
'edit'
,
kw
=
{
'comment'
:
'Downloaded'
})
item_name_list
=
[
'_path_item'
,
'_object_property_item'
]
for
item_name
in
item_name_list
:
item_object
=
getattr
(
self
,
item_name
,
None
)
...
...
@@ -266,6 +300,26 @@ class BusinessPackage(XMLObject):
if
item_object
is
not
None
:
item_object
.
importFile
(
bpa
)
def
getBuildingState
(
self
,
default
=
None
,
id_only
=
1
):
"""
Returns the current state in building
"""
portal_workflow
=
getToolByName
(
self
,
'portal_workflow'
)
wf
=
portal_workflow
.
getWorkflowById
(
'business_package_building_workflow'
)
return
wf
.
_getWorkflowStateOf
(
self
,
id_only
=
id_only
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getInstallationState'
)
def
getInstallationState
(
self
,
default
=
None
,
id_only
=
1
):
"""
Returns the current state in installation
"""
portal_workflow
=
getToolByName
(
self
.
getPortalObject
(),
'portal_workflow'
)
wf
=
portal_workflow
.
getWorkflowById
(
'business_package_installation_workflow'
)
return
wf
.
_getWorkflowStateOf
(
self
,
id_only
=
id_only
)
class
BusinessPackageException
(
Exception
):
pass
...
...
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