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
6f9566f2
Commit
6f9566f2
authored
Jan 16, 2018
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TemplateTool: Add fucntion for getting insalled Business Tempalte V2
parent
36492618
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
12 deletions
+25
-12
product/ERP5/Document/BusinessCommit.py
product/ERP5/Document/BusinessCommit.py
+12
-12
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+13
-0
No files found.
product/ERP5/Document/BusinessCommit.py
View file @
6f9566f2
...
@@ -147,23 +147,23 @@ class BusinessCommit(Folder):
...
@@ -147,23 +147,23 @@ class BusinessCommit(Folder):
Installation:
Installation:
- Check if the status is committed (Done by constraint of Business Commit
- Check if the status is committed (Done by constraint of Business Commit
portal_type)
portal_type)
- Check if there are installed Business
Manager
(s) because they will be
- Check if there are installed Business
Template V2
(s) because they will be
required in building new Business Snapshot. Raise if there are None.
required in building new Business Snapshot. Raise if there are None.
- Create an equivalent snapshot (using items of this commit and predecessors
- Create an equivalent snapshot (using items of this commit and predecessors
belonging to installed Business
Manager
s)
belonging to installed Business
Template V2
s)
- TODO: Compare the snapshot with the last snapshot
- TODO: Compare the snapshot with the last snapshot
- Install the snapshot
- Install the snapshot
"""
"""
site
=
self
.
getPortalObject
()
site
=
self
.
getPortalObject
()
portal_templates
=
site
.
portal_templates
portal_templates
=
site
.
portal_templates
installed_b
m_list
=
portal_templates
.
getInstalledBusinessManager
List
()
installed_b
t_list
=
portal_templates
.
getInstalledBusinessTemplateV2
List
()
# Should raise if there is no installed BM in ZODB. Should install BM via
# Should raise if there is no installed BM in ZODB. Should install BM via
# portal_templates first.
# portal_templates first.
# XXX: Maybe instead of raising, we can provide an option to install BM
# XXX: Maybe instead of raising, we can provide an option to install BM
# here only. So that a new user don't get confused ?
# here only. So that a new user don't get confused ?
if
not
installed_b
m
_list
:
if
not
installed_b
t
_list
:
raise
ValueError
(
'There is no installed B
M
to create snapshot'
)
raise
ValueError
(
'There is no installed B
T
to create snapshot'
)
successor_list
=
self
.
getPredecessorRelatedValueList
()
successor_list
=
self
.
getPredecessorRelatedValueList
()
...
@@ -185,17 +185,17 @@ class BusinessCommit(Folder):
...
@@ -185,17 +185,17 @@ class BusinessCommit(Folder):
def
getItemPathList
(
self
):
def
getItemPathList
(
self
):
return
[
l
.
getProperty
(
'item_path'
)
for
l
in
self
.
objectValues
()]
return
[
l
.
getProperty
(
'item_path'
)
for
l
in
self
.
objectValues
()]
def
getBusiness
Manager
List
(
self
):
def
getBusiness
TemplateV2
List
(
self
):
"""
"""
Give the list of all Business
Manager
(s) being touched by this Business
Give the list of all Business
Template V2
(s) being touched by this Business
Commit
Commit
"""
"""
manager
_list
=
[]
template
_list
=
[]
for
item
in
self
.
objectValues
():
for
item
in
self
.
objectValues
():
manager
_list
.
extend
(
item
.
getFollowUpValueList
())
template
_list
.
extend
(
item
.
getFollowUpValueList
())
return
list
(
set
(
manager
_list
))
return
list
(
set
(
template
_list
))
def
getBusiness
Manager
TitleList
(
self
):
def
getBusiness
TemplateV2
TitleList
(
self
):
title_list
=
[
l
.
getTitle
()
for
l
in
self
.
getBusiness
Manager
List
()]
title_list
=
[
l
.
getTitle
()
for
l
in
self
.
getBusiness
TemplateV2
List
()]
return
title_list
return
title_list
product/ERP5/Tool/TemplateTool.py
View file @
6f9566f2
...
@@ -2420,6 +2420,19 @@ class TemplateTool (BaseTool):
...
@@ -2420,6 +2420,19 @@ class TemplateTool (BaseTool):
installed_bm_title_list
=
[
bm
.
title
for
bm
in
installed_bm_list
]
installed_bm_title_list
=
[
bm
.
title
for
bm
in
installed_bm_list
]
return
installed_bm_title_list
return
installed_bm_title_list
def
getInstalledBusinessTemplateV2List
(
self
):
bt_list
=
self
.
objectValues
(
portal_type
=
'Business Template V2'
)
installed_bt_list
=
[
bt
for
bt
in
bt_list
if
bt
.
getAvailabilityState
()
==
'installable'
]
return
installed_bt_list
def
getInstalledBusinessTemplateV2TitleList
(
self
):
installed_bt_list
=
self
.
getInstalledBusinessManagerV2List
()
if
not
len
(
installed_bt_list
):
return
[]
installed_bt_title_list
=
[
bt
.
getTitle
()
for
bt
in
installed_bt_list
]
return
installed_bt_title_list
security
.
declareProtected
(
Permissions
.
ManagePortal
,
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getBusinessTemplateUrl'
)
'getBusinessTemplateUrl'
)
def
getBusinessTemplateUrl
(
self
,
base_url_list
,
bt5_title
):
def
getBusinessTemplateUrl
(
self
,
base_url_list
,
bt5_title
):
...
...
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