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
138
Merge Requests
138
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
3d2761c1
Commit
3d2761c1
authored
Dec 28, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CommitTool: Build snapshot after checking if the transition is possible or not
parent
fe89ccd1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
product/ERP5/Document/BusinessCommit.py
product/ERP5/Document/BusinessCommit.py
+7
-3
product/ERP5/Document/BusinessSnapshot.py
product/ERP5/Document/BusinessSnapshot.py
+1
-1
product/ERP5/Tool/CommitTool.py
product/ERP5/Tool/CommitTool.py
+3
-3
No files found.
product/ERP5/Document/BusinessCommit.py
View file @
3d2761c1
...
...
@@ -124,17 +124,21 @@ class BusinessCommit(Folder):
"""
This function uses the current commit to create a new snapshot
"""
portal_commit
=
self
.
aq_parent
site
=
self
.
getPortalObject
()
portal_commits
=
self
.
aq_parent
# Create empty snapshot
snapshot
=
portal_commit
.
newContent
(
portal_type
=
'Business Snapshot'
)
snapshot
=
portal_commit
s
.
newContent
(
portal_type
=
'Business Snapshot'
)
# Add the current commit as predecessor. This way we can have the BI
# BPI in that commit to the Business Snapshot also.
snapshot
.
setSimilarValue
(
self
)
self
.
setSimilarValue
(
snapshot
)
# Build the snapshot
snapshot
.
buildSnapshot
()
if
snapshot
not
in
[
None
,
self
]:
if
site
.
portal_workflow
.
isTransitionPossible
(
snapshot
,
'build'
):
snapshot
.
build
()
return
snapshot
...
...
product/ERP5/Document/BusinessSnapshot.py
View file @
3d2761c1
...
...
@@ -150,7 +150,7 @@ class BusinessSnapshot(Folder):
return
None
def
build
Snapshot
(
self
):
def
build
(
self
,
**
kwargs
):
"""
Using equivalent commit, create a snapshot of ZODB state
"""
...
...
product/ERP5/Tool/CommitTool.py
View file @
3d2761c1
...
...
@@ -179,7 +179,7 @@ class CommitTool (BaseTool):
return
self
.
objectValues
(
portal_type
=
'Business Snapshot'
)
security
.
declarePublic
(
'newContent'
)
def
newContent
(
self
,
id
=
None
,
**
kw
):
def
newContent
(
self
,
id
=
None
,
portal_type
=
None
,
**
kw
):
"""
Override newContent so as to use 'id' generated like hash
Also, create new commit only when all old commits are committed
...
...
@@ -189,13 +189,13 @@ class CommitTool (BaseTool):
all_commited
=
all
([
l
.
getTranslatedValidationState
()
==
'commited'
for
l
in
old_commit_list
])
if
not
all_commited
:
if
not
all_commited
and
(
portal_type
==
'Business Commit'
)
:
raise
ValueError
(
'Please commit your last commit before creating new one'
)
if
id
is
None
:
id
=
uuid
.
uuid1
()
new_obj
=
super
(
CommitTool
,
self
).
newContent
(
id
,
**
kw
)
new_obj
=
super
(
CommitTool
,
self
).
newContent
(
id
,
portal_type
,
**
kw
)
# Add the last commit as its predecessor
commit_list
=
[
l
for
l
...
...
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