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
Hamza
erp5
Commits
9d0aacfc
Commit
9d0aacfc
authored
Feb 16, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Update the install function
parent
ab9a0474
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
4 deletions
+30
-4
product/ERP5/Document/BusinessConfiguration.py
product/ERP5/Document/BusinessConfiguration.py
+30
-4
No files found.
product/ERP5/Document/BusinessConfiguration.py
View file @
9d0aacfc
...
...
@@ -93,6 +93,12 @@ class BusinessTemplate(XMLObject):
"""
return
self
.
status
def
setStatus
(
self
,
status
=
None
):
if
not
status
:
raise
ValueError
,
'No status provided'
else
:
self
.
status
=
status
def
applytoERP5
(
self
,
DB
):
"""Apply the flattened/reduced business template to the DB"""
portal
=
self
.
getPortalObject
()
...
...
@@ -128,8 +134,27 @@ class BusinessTemplate(XMLObject):
return
result
def
install
(
self
):
"""Install the business template"""
pass
"""Install the business template
We do installation step by step:
1. Reduction of the BT
2. Flattenning the BT
3. COpying the object at the path mentioned in BT"""
status
=
self
.
getStatus
()
if
status
==
'reduced'
:
self
.
flattenBusinessTemplate
()
self
.
install
()
elif
status
==
'flattened'
:
self
.
_install
()
else
:
self
.
reduceBusinessTemplate
()
self
.
install
()
def
_install
(
self
):
"""
Run installation
"""
for
path_item
in
self
.
_path_item_list
:
path_item
.
install
()
def
upgrade
(
self
):
"""Upgrade the business template"""
...
...
@@ -145,6 +170,8 @@ class BusinessTemplate(XMLObject):
"""
if
self
.
getStatus
()
!=
'reduced'
:
raise
ValueError
,
'Please reduce the BT before flatenning'
# XXX: Maybe call reduce function on BT by itself here rather than just
# raising the error, because there is no other choice
else
:
# TODO: Still not clear on what flattens means here
pass
...
...
@@ -191,7 +218,7 @@ class BusinessTemplate(XMLObject):
# Add both unique and seen path item and update _path_item_list attribute
reduced_path_item_list
=
seen_path_dict
.
values
()
+
unique_value_dict
.
values
()
self
.
_path_item_list
=
reduced_path_item_list
self
.
s
tatus
=
'reduced'
self
.
s
etStatus
(
'reduced'
)
class
BusinessItem
(
Implicit
,
Persistent
):
...
...
@@ -298,7 +325,6 @@ class BusinessItem(Implicit, Persistent):
obj
=
portal
.
unrestrictedTraverse
(
path
)
obj
.
setProperty
(
property_name
,
value
)
def
generateXML
(
self
):
"""
Generate XML for different objects/type/properties differently.
...
...
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