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
Hugo Ricateau
erp5
Commits
14f43740
Commit
14f43740
authored
Dec 26, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CommitTool: Use catalog to get last snapshot
parent
82c9b260
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
28 deletions
+16
-28
product/ERP5/Document/BusinessManager.py
product/ERP5/Document/BusinessManager.py
+4
-20
product/ERP5/Document/BusinessSnapshot.py
product/ERP5/Document/BusinessSnapshot.py
+12
-8
No files found.
product/ERP5/Document/BusinessManager.py
View file @
14f43740
...
...
@@ -733,22 +733,6 @@ class BusinessItem(XMLObject):
icon
=
None
isProperty
=
False
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'edit'
)
def
edit
(
self
,
item_path
=
''
,
item_sign
=
1
,
item_layer
=
0
,
*
args
,
**
kw
):
"""
Generic edit Method for all ERP5 object
"""
edited_value
=
self
.
_edit
(
item_path
=
item_path
,
item_sign
=
item_sign
,
item_layer
=
item_layer
,
*
args
,
**
kw
)
# TODO: Use activity to update follow_up of Business Item as the portal_category
# accessor is generated
# Update the follow up value for Business Manager
self
.
updateFollowUpPathList
()
def
_edit
(
self
,
item_path
=
''
,
item_sign
=
1
,
item_layer
=
0
,
*
args
,
**
kw
):
"""
Overriden function so that we can update attributes for BusinessItem objects
...
...
@@ -765,10 +749,6 @@ class BusinessItem(XMLObject):
if
'item_path'
in
self
.
_v_modified_property_dict
:
self
.
build
(
self
.
aq_parent
)
# Update the Business Manager with the path list everytime after editing
# item_path. Use activity to call this function after the activitiy for
# _edit is finished.
def
updateFollowUpPathList
(
self
):
"""
Update the path list for Follow Up Business Manager
...
...
@@ -794,6 +774,10 @@ class BusinessItem(XMLObject):
# Update the manager with new path list
manager
.
setItemPathList
(
item_path_list
)
else
:
# Complain loudly if the follow_up is not there
raise
ValueError
(
'Follow Up Business Manager is not set or defined yet'
)
def
build
(
self
,
context
,
**
kw
):
"""
Extract value for the given path from the OFS
...
...
product/ERP5/Document/BusinessSnapshot.py
View file @
14f43740
...
...
@@ -137,14 +137,16 @@ class BusinessSnapshot(Folder):
portal
=
self
.
getPortalObject
()
commit_tool
=
portal
.
portal_commits
# Get the snapshot list except the current snapshot
snapshot_list
=
[
l
for
l
in
commit_tool
.
objectValues
(
portal_type
=
'Business Snapshot'
)
if
l
!=
self
]
# XXX: Is it a good idea to be dependent on portal_catalog to get Snapshot list ?
snapshot_list
=
commit_tool
.
searchFolder
(
portal_type
=
'Business Snapshot'
,
validation_state
=
'installed'
)
if
snapshot_list
:
# Get the last created/installed snapshot comparing creation_date
return
max
(
snapshot_list
,
key
=
(
lambda
x
:
x
.
getCreationDate
()))
# There should never be more than 1 installed snapshot
if
len
(
snapshot_list
)
==
1
:
# Get the last installed snapshot
return
snapshot_list
[
0
].
getObject
()
return
None
...
...
@@ -222,7 +224,9 @@ class BusinessSnapshot(Folder):
Install the sub-objects in the commit
"""
site
=
self
.
getPortalObject
()
# While installing the last snapshot state should be changed to 'replaced'
# While installing a new snapshot, last snapshot state should be
# changed to 'replaced'
last_snapshot
=
self
.
getLastSnapshot
()
if
last_snapshot
not
in
[
None
,
self
]:
if
site
.
portal_workflow
.
isTransitionPossible
(
...
...
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