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
ff5593c4
Commit
ff5593c4
authored
Dec 22, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Business Manager: Ude property_sheet instead of creating useless attributes
parent
307c24d1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
27 deletions
+58
-27
product/ERP5/Document/BusinessManager.py
product/ERP5/Document/BusinessManager.py
+58
-27
No files found.
product/ERP5/Document/BusinessManager.py
View file @
ff5593c4
...
...
@@ -189,7 +189,6 @@ class BusinessManager(Folder):
,
'filter_content_types'
:
1
}
item_path_list
=
[]
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
...
...
@@ -207,12 +206,6 @@ class BusinessManager(Folder):
# XXX: This explicit setter and getter should be replaced using property
# sheet.
def
setItemPathList
(
self
,
value
):
self
.
item_path_list
=
value
def
getItemPathList
(
self
):
return
self
.
item_path_list
def
getShortRevision
(
self
):
return
None
...
...
@@ -221,6 +214,23 @@ class BusinessManager(Folder):
# this is used to find missing dependency list
return
'5.4.7'
def
install
(
self
,
**
kw
):
"""
We have to create the snapshot state to find out what is going to be
installed and thus install only those paths which cater to the right commit
i.e, find the latest commit which modifies this Business Manager and
install it
"""
# Get all Business Item which corresponds to this Business Manager
business_item_list
=
self
.
getFollowUpRelatedValueList
()
# Get the commits corresponding to the Business Item
commit_list
=
[
l
.
aq_parent
for
l
in
business_item_list
]
if
commit_list
:
# Get the most recent Business Commit and install it
latest_commit
=
max
(
commit_list
,
key
=
(
lambda
x
:
x
.
getCreationDate
()))
latest_commit
.
install
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getBuildingState'
)
def
getBuildingState
(
self
,
default
=
None
,
id_only
=
1
):
...
...
@@ -722,7 +732,22 @@ class BusinessItem(XMLObject):
meta_type
=
'Business Item'
icon
=
None
isProperty
=
False
isIndexable
=
False
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'edit'
)
def
edit
(
self
,
item_path
=
''
,
item_sign
=
1
,
item_layer
=
0
,
*
args
,
**
kw
):
"""
Generic edit Method for all ERP5 object
"""
edited_value
=
self
.
_edit
(
item_path
=
item_path
,
item_sign
=
item_sign
,
item_layer
=
item_layer
,
*
args
,
**
kw
)
# TODO: Use activity to update follow_up of Business Item as the portal_category
# accessor is generated
# Update the follow up value for Business Manager
self
.
updateFollowUpPathList
()
def
_edit
(
self
,
item_path
=
''
,
item_sign
=
1
,
item_layer
=
0
,
*
args
,
**
kw
):
"""
...
...
@@ -741,7 +766,13 @@ class BusinessItem(XMLObject):
self
.
build
(
self
.
aq_parent
)
# Update the Business Manager with the path list everytime after editing
# item_path
# item_path. Use activity to call this function after the activitiy for
# _edit is finished.
def
updateFollowUpPathList
(
self
):
"""
Update the path list for Follow Up Business Manager
"""
manager
=
self
.
getFollowUpValue
()
# Check if the manager has already been set or not
if
manager
:
...
...
@@ -761,7 +792,7 @@ class BusinessItem(XMLObject):
item_path_list
.
append
(
self
.
getProperty
(
'item_path'
))
# Update the manager with new path list
manager
.
setProperty
(
'item_path_list'
,
item_path_list
)
manager
.
setItemPathList
(
item_path_list
)
def
build
(
self
,
context
,
**
kw
):
"""
...
...
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