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
amrani
erp5
Commits
8bc6d650
Commit
8bc6d650
authored
May 05, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Add migration function
parent
423608ef
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
73 deletions
+150
-73
product/ERP5/Document/BusinessManager.py
product/ERP5/Document/BusinessManager.py
+29
-4
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+1
-0
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+120
-69
No files found.
product/ERP5/Document/BusinessManager.py
View file @
8bc6d650
...
@@ -335,7 +335,7 @@ class BusinessManager(Folder):
...
@@ -335,7 +335,7 @@ class BusinessManager(Folder):
__rsub__
=
__sub__
__rsub__
=
__sub__
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'storeTemplateData'
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'storeTemplateData'
)
def
storeTemplateData
(
self
,
isBuild
=
False
):
def
storeTemplateData
(
self
,
isBuild
=
False
,
**
kw
):
"""
"""
Store data for objects in the ERP5
Store data for objects in the ERP5
"""
"""
...
@@ -451,10 +451,16 @@ class BusinessManager(Folder):
...
@@ -451,10 +451,16 @@ class BusinessManager(Folder):
"""Creates new values for business item from the values from
"""Creates new values for business item from the values from
OFS Database"""
OFS Database"""
LOG
(
'Business Manager'
,
INFO
,
'Building Business Manager'
)
LOG
(
'Business Manager'
,
INFO
,
'Building Business Manager'
)
removable_sub_object_path_list
=
kw
.
get
(
'removable_sub_object_path'
,
[])
removable_property_dict
=
kw
.
get
(
'removable_property'
,
{})
if
not
no_action
:
if
not
no_action
:
self
.
storeTemplateData
(
isBuild
=
True
)
self
.
storeTemplateData
(
isBuild
=
True
,
**
kw
)
for
path_item
in
self
.
objectValues
():
for
path_item
in
self
.
objectValues
():
path_item
.
build
(
self
,
**
kw
)
kwargs
=
{}
item_path
=
path_item
.
getProperty
(
'item_path'
)
kwargs
[
'removable_property_list'
]
=
removable_property_dict
.
get
(
item_path
,
[])
kwargs
[
'remove_sub_objects'
]
=
item_path
in
removable_sub_object_path_list
path_item
.
build
(
self
,
**
kwargs
)
self
.
status
=
'built'
self
.
status
=
'built'
return
self
return
self
...
@@ -652,6 +658,19 @@ class BusinessItem(XMLObject):
...
@@ -652,6 +658,19 @@ class BusinessItem(XMLObject):
for
relative_url
in
self
.
_resolvePath
(
p
,
[],
path
.
split
(
'/'
)):
for
relative_url
in
self
.
_resolvePath
(
p
,
[],
path
.
split
(
'/'
)):
obj
=
p
.
unrestrictedTraverse
(
relative_url
)
obj
=
p
.
unrestrictedTraverse
(
relative_url
)
obj
=
obj
.
_getCopy
(
context
)
obj
=
obj
.
_getCopy
(
context
)
# We should remove the extra properties of object so that there
# shouldn't be redundancy of the proeprties
removable_property_list
=
kw
.
get
(
'removable_property_list'
)
# We should also add extra parameter to remove sub-objects by removing
# `_tree` for any erp5 object. This way we can have control over adding
# sub-objects as new Business Item objects
remove_sub_objects
=
kw
.
get
(
'remove_sub_objects'
)
if
remove_sub_objects
:
removable_property_list
.
append
(
'_tree'
)
obj
=
self
.
removeProperties
(
obj
,
1
,
properties
=
removable_property_list
)
obj
=
obj
.
__of__
(
context
)
obj
=
obj
.
__of__
(
context
)
# XXX: '_recursiveRemoveUid' is not working as expected
# XXX: '_recursiveRemoveUid' is not working as expected
_recursiveRemoveUid
(
obj
)
_recursiveRemoveUid
(
obj
)
...
@@ -888,7 +907,13 @@ class BusinessItem(XMLObject):
...
@@ -888,7 +907,13 @@ class BusinessItem(XMLObject):
for
attr
in
obj
.
__dict__
.
keys
():
for
attr
in
obj
.
__dict__
.
keys
():
if
attr
in
attr_set
or
attr
.
startswith
(
'_cache_cookie_'
):
if
attr
in
attr_set
or
attr
.
startswith
(
'_cache_cookie_'
):
try
:
delattr
(
obj
,
attr
)
delattr
(
obj
,
attr
)
except
AttributeError
:
# XXX: Continue in cases where we want to delete some properties which
# are not in attribute list
# Raise an error
continue
if
classname
==
'PDFForm'
:
if
classname
==
'PDFForm'
:
if
not
obj
.
getProperty
(
'business_template_include_content'
,
1
):
if
not
obj
.
getProperty
(
'business_template_include_content'
,
1
):
...
...
product/ERP5/ERP5Site.py
View file @
8bc6d650
...
@@ -2412,6 +2412,7 @@ class ERP5Generator(PortalGenerator):
...
@@ -2412,6 +2412,7 @@ class ERP5Generator(PortalGenerator):
continue
continue
url
=
getBootstrapBusinessTemplateUrl
(
bt
)
url
=
getBootstrapBusinessTemplateUrl
(
bt
)
bt
=
template_tool
.
download
(
url
)
bt
=
template_tool
.
download
(
url
)
if
bt
.
getPortalType
()
==
'Business Manager'
:
if
bt
.
getPortalType
()
==
'Business Manager'
:
template_tool
.
updateInstallationState
([
bt
])
template_tool
.
updateInstallationState
([
bt
])
else
:
else
:
...
...
product/ERP5/Tool/TemplateTool.py
View file @
8bc6d650
This diff is collapsed.
Click to expand it.
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