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
a34f7caa
Commit
a34f7caa
authored
Jan 24, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_prototype: Update Business Package to use ObjectPropertyTemplateItem
parent
60ebe529
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
product/ERP5/Document/BusinessPackage.py
product/ERP5/Document/BusinessPackage.py
+14
-9
No files found.
product/ERP5/Document/BusinessPackage.py
View file @
a34f7caa
...
@@ -142,7 +142,7 @@ class BusinessPackage(XMLObject):
...
@@ -142,7 +142,7 @@ class BusinessPackage(XMLObject):
def
_install
(
self
,
**
kw
):
def
_install
(
self
,
**
kw
):
self
.
_path_item
.
install
(
self
)
self
.
_path_item
.
install
(
self
)
#
self._object_property_item.install(self)
self
.
_object_property_item
.
install
(
self
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'install'
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'install'
)
install
=
_install
install
=
_install
...
@@ -158,16 +158,16 @@ class BusinessPackage(XMLObject):
...
@@ -158,16 +158,16 @@ class BusinessPackage(XMLObject):
"""
"""
if
not
no_action
:
if
not
no_action
:
self
.
storePathData
()
self
.
storePathData
()
# XXX: Explicitly calling build for items. Needs to be changed
self
.
_path_item
.
build
(
self
)
self
.
_path_item
.
build
(
self
)
self
.
_object_property_item
.
build
(
self
)
pass
pass
#self._object_property_item.build(self)
#self.setBuildingState('built')
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'storePathData'
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'storePathData'
)
def
storePathData
(
self
):
def
storePathData
(
self
):
self
.
_path_item
=
PathTemplatePackageItem
(
self
.
_getTemplatePathList
())
self
.
_path_item
=
PathTemplatePackageItem
(
self
.
_getTemplatePathList
())
#
self._object_property_item = \
self
.
_object_property_item
=
\
#
ObjectPropertyTemplatePackageItem(self._getTemplateObjectPropertyList())
ObjectPropertyTemplatePackageItem
(
self
.
_getTemplateObjectPropertyList
())
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getTemplatePathList'
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getTemplatePathList'
)
def
_getTemplateObjectPropertyList
(
self
):
def
_getTemplateObjectPropertyList
(
self
):
...
@@ -220,7 +220,7 @@ class BusinessPackage(XMLObject):
...
@@ -220,7 +220,7 @@ class BusinessPackage(XMLObject):
elif
prop_type
in
(
'lines'
,
'tokens'
):
elif
prop_type
in
(
'lines'
,
'tokens'
):
bpa
.
addObject
(
'
\
n
'
.
join
(
value
),
name
=
id
,
path
=
'bt'
,
ext
=
''
)
bpa
.
addObject
(
'
\
n
'
.
join
(
value
),
name
=
id
,
path
=
'bt'
,
ext
=
''
)
item_name_list
=
[
'_path_item'
,]
item_name_list
=
[
'_path_item'
,
'_object_property_item'
]
# Export each part
# Export each part
for
item_name
in
item_name_list
:
for
item_name
in
item_name_list
:
item
=
getattr
(
self
,
item_name
,
None
)
item
=
getattr
(
self
,
item_name
,
None
)
...
@@ -250,10 +250,12 @@ class BusinessPackage(XMLObject):
...
@@ -250,10 +250,12 @@ class BusinessPackage(XMLObject):
prop_dict
[
pid
]
=
value
or
0
prop_dict
[
pid
]
=
value
or
0
elif
prop_type
in
(
'lines'
,
'tokens'
):
elif
prop_type
in
(
'lines'
,
'tokens'
):
prop_dict
[
pid
[:
-
5
]]
=
(
value
or
''
).
splitlines
()
prop_dict
[
pid
[:
-
5
]]
=
(
value
or
''
).
splitlines
()
# XXX: This is not working, needs to be fixed so as it copies all the
# properties from BPA to the newly created Business Package
self
.
_edit
(
**
prop_dict
)
self
.
_edit
(
**
prop_dict
)
self
.
storePathData
()
self
.
storePathData
()
item_name_list
=
[
'_path_item'
,]
item_name_list
=
[
'_path_item'
,
'_object_property_item'
]
for
item_name
in
item_name_list
:
for
item_name
in
item_name_list
:
item_object
=
getattr
(
self
,
item_name
,
None
)
item_object
=
getattr
(
self
,
item_name
,
None
)
# this check is due to backwards compatability when there can be a
# this check is due to backwards compatability when there can be a
...
@@ -726,8 +728,8 @@ class PathTemplatePackageItem(Implicit, Persistent):
...
@@ -726,8 +728,8 @@ class PathTemplatePackageItem(Implicit, Persistent):
if
getattr
(
aq_base
(
obj
),
'reindexObject'
,
None
)
is
not
None
:
if
getattr
(
aq_base
(
obj
),
'reindexObject'
,
None
)
is
not
None
:
obj
.
reindexObject
()
obj
.
reindexObject
()
def
importFile
(
self
,
b
t
a
,
**
kw
):
def
importFile
(
self
,
b
p
a
,
**
kw
):
b
t
a
.
importFiles
(
self
)
b
p
a
.
importFiles
(
self
)
def
_importFile
(
self
,
file_name
,
file_obj
,
catalog_method_template_item
=
0
):
def
_importFile
(
self
,
file_name
,
file_obj
,
catalog_method_template_item
=
0
):
obj_key
,
file_ext
=
os
.
path
.
splitext
(
file_name
)
obj_key
,
file_ext
=
os
.
path
.
splitext
(
file_name
)
...
@@ -882,6 +884,9 @@ class ObjectPropertyTemplatePackageItem(Implicit, Persistent):
...
@@ -882,6 +884,9 @@ class ObjectPropertyTemplatePackageItem(Implicit, Persistent):
xml_data
=
self
.
generateXml
()
xml_data
=
self
.
generateXml
()
bpa
.
addObject
(
xml_data
,
name
=
self
.
xml_tag
,
path
=
path
)
bpa
.
addObject
(
xml_data
,
name
=
self
.
xml_tag
,
path
=
path
)
def
importFile
(
self
,
bpa
,
**
kw
):
bpa
.
importFiles
(
self
)
def
_importFile
(
self
,
file_name
,
file
):
def
_importFile
(
self
,
file_name
,
file
):
if
not
file_name
.
endswith
(
'.xml'
):
if
not
file_name
.
endswith
(
'.xml'
):
LOG
(
'Business Template'
,
0
,
'Skipping file "%s"'
%
(
file_name
,
))
LOG
(
'Business Template'
,
0
,
'Skipping file "%s"'
%
(
file_name
,
))
...
...
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