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
Frederic Thoma
erp5
Commits
3706aeb7
Commit
3706aeb7
authored
Jun 06, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Update reduction function for Business Manager
parent
fd91e7fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
product/ERP5/Document/BusinessManager.py
product/ERP5/Document/BusinessManager.py
+13
-11
No files found.
product/ERP5/Document/BusinessManager.py
View file @
3706aeb7
...
...
@@ -337,7 +337,9 @@ class BusinessManager(Folder):
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'storeTemplateData'
)
def
storeTemplateData
(
self
,
isBuild
=
False
,
**
kw
):
"""
Store data for objects in the ERP5
Store data for objects in the ERP5.
Create Business Item sub-objects after resolving the paths. Also, add
layers to all Business Item objects
"""
portal
=
self
.
getPortalObject
()
LOG
(
'Business Manager'
,
INFO
,
'Storing Manager Data'
)
...
...
@@ -507,7 +509,7 @@ class BusinessManager(Folder):
reduce(BT) = BT
"""
path_list
=
list
(
set
([
path_item
.
getBusinessPath
()
for
path_item
in
self
.
_path_item_list
]))
in
self
.
objectValues
()
]))
reduced_path_item_list
=
[]
...
...
@@ -522,11 +524,11 @@ class BusinessManager(Folder):
# Create an extra dict for values on path which are repeated in the path list
seen_path_dict
=
{
path
:
[]
for
path
in
seen_path_list
}
for
path_item
in
self
.
_path_item_list
:
if
path_item
.
path
in
seen_path_list
:
for
path_item
in
self
.
objectValues
()
:
if
path_item
.
getProperty
(
'item_path'
)
in
seen_path_list
:
# In case the path is repeated keep the path_item in a separate dict
# for further arithmetic
seen_path_dict
[
path_item
.
path
].
append
(
path_item
)
seen_path_dict
[
path_item
.
getProperty
(
'item_path'
)
].
append
(
path_item
)
else
:
# If the path is unique, add them in the list of reduced Business Item
reduced_path_item_list
.
append
(
path_item
)
...
...
@@ -535,27 +537,27 @@ class BusinessManager(Folder):
for
path
,
path_item_list
in
seen_path_dict
.
items
():
# Create separate list of list items with highest priority
higest_priority_layer
=
max
(
path_item_list
,
key
=
attrgetter
(
'
layer'
)).
layer
higest_priority_layer
=
max
(
path_item_list
,
key
=
attrgetter
(
'
item_layer'
)).
item_
layer
prioritized_path_item
=
[
path_item
for
path_item
in
path_item_list
if
path_item
.
layer
==
higest_priority_layer
]
if
path_item
.
item_
layer
==
higest_priority_layer
]
# Separate the positive and negative sign path_item
if
len
(
prioritized_path_item
)
>
1
:
path_item_list_add
=
[
item
for
item
in
prioritized_path_item
if
item
.
sign
>
0
]
if
item
.
getProperty
(
'item_sign'
)
>
0
]
path_item_list_subtract
=
[
item
for
item
in
prioritized_path_item
if
item
.
sign
<
0
]
if
item
.
getProperty
(
'item_sign'
)
<
0
]
combined_added_path_item
=
reduce
(
lambda
x
,
y
:
x
+
y
,
path_item_list_add
)
combined_subtracted_path_item
=
reduce
(
lambda
x
,
y
:
x
+
y
,
path_item_list_subtract
)
added_value
=
combined_added_path_item
.
value
subtracted_value
=
combined_subtracted_path_item
.
value
added_value
=
combined_added_path_item
.
objectValues
()
subtracted_value
=
combined_subtracted_path_item
.
objectValues
()
if
added_value
!=
subtracted_value
:
# Append the arithmetically combined path_item objects in the final
...
...
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