Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
12515e5b
Commit
12515e5b
authored
Mar 06, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Override sub for comparing 2 Business Manager objects
parent
293e0e83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
2 deletions
+58
-2
product/ERP5/Document/BusinessManager.py
product/ERP5/Document/BusinessManager.py
+13
-1
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+45
-1
No files found.
product/ERP5/Document/BusinessManager.py
View file @
12515e5b
...
...
@@ -320,6 +320,7 @@ class BusinessManager(XMLObject):
"""
Adds the Business Item objects for the given Business Manager objects
"""
import
pdb
;
pdb
.
set_trace
()
self
.
_path_item_list
.
extend
(
other
.
_path_item_list
)
template_path_list
=
list
(
self
.
template_path_list
)
+
list
(
other
.
template_path_list
)
self
.
template_path_list
=
template_path_list
...
...
@@ -327,6 +328,18 @@ class BusinessManager(XMLObject):
__radd__
=
__add__
def
__sub__
(
self
,
other
):
"""
Override subtract to find difference b/w the values in different cases.
"""
# Reverse the sign of Business Item objects for the old Business Manager
for
path_item
in
other
.
_path_item_list
:
path_item
.
_sign
=
-
1
self
.
_path_item_list
.
append
(
path_item
)
return
self
__rsub__
=
__add__
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'storeTemplateData'
)
def
storeTemplateData
(
self
):
"""
...
...
@@ -787,7 +800,6 @@ class BusinessItem(Implicit, Persistent):
return
merged_value
def
_guessFilename
(
self
,
document
,
key
,
data
):
"""
Try to guess the extension based on the id of the document
...
...
product/ERP5/Tool/TemplateTool.py
View file @
12515e5b
...
...
@@ -314,6 +314,7 @@ class TemplateTool (BaseTool):
self
.
deleteContent
(
id
)
self
.
_importObjectFromFile
(
StringIO
(
export_string
),
id
=
id
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'manage_download'
)
def
manage_download
(
self
,
url
,
id
=
None
,
REQUEST
=
None
):
"""The management interface for download.
...
...
@@ -1690,9 +1691,52 @@ class TemplateTool (BaseTool):
"""
Run installation on flattened Business Manager
"""
combinedBM
=
self
.
combineMultipleBusinessManager
(
bm_list
)
final_bm_list
=
[]
installed_bm_list
=
self
.
getInstalledBusinessManagerList
()
installed_bm_title_list
=
self
.
getInstalledBusinessManagerTitleList
()
installed_bm_dict
=
dict
(
zip
(
installed_bm_title_list
,
installed_bm_list
))
import
pdb
;
pdb
.
set_trace
()
for
bm
in
bm_list
:
if
bm
.
title
in
installed_bm_title_list
:
# Not very suitable way to look for already installed BM
installed_bm
=
installed_bm_dict
[
bm
.
title
]
# XXX: Installed BM is already reduced. For the Business Manager we
# are planning to install, we should reduce it also.
compared_bm
=
self
.
compareBusinessManager
(
bm
,
installed_bm
)
final_bm_list
.
append
(
compared_bm
)
else
:
final_bm_list
.
append
(
bm
)
combinedBM
=
self
.
combineMultipleBusinessManager
(
final_bm_list
)
self
.
installBusinessManager
(
combinedBM
)
# Explicilty change the status of Business Manager which are installed
for
bm
in
bm_list
:
bm
.
setStatus
(
'installed'
)
def
getInstalledBusinessManagerList
(
self
):
bm_list
=
self
.
objectValues
(
portal_type
=
'Business Manager'
)
installed_bm_list
=
[
bm
for
bm
in
bm_list
if
bm
.
getStatus
()
==
'installed'
]
return
installed_bm_list
def
getInstalledBusinessManagerTitleList
(
self
):
installed_bm_list
=
self
.
getInstalledBusinessManagerList
()
if
not
len
(
installed_bm_list
):
return
[]
installed_bm_title_list
=
[
bm
.
title
for
bm
in
installed_bm_list
]
return
installed_bm_title_list
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'compareMultipleBusinessManager'
)
def
compareBusinessManager
(
self
,
new_bm
,
old_bm
):
"""
Compare two business manager and return a new Business manager based on
the difference. This is specially required to comapre two versions of
Business Manager(s).
"""
compared_bm
=
new_bm
-
old_bm
return
compared_bm
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getBusinessTemplateUrl'
)
...
...
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