Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
3162e38c
Commit
3162e38c
authored
Sep 08, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Update reduceBusinessManager function
parent
31a3ecde
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
product/ERP5/Document/BusinessManager.py
product/ERP5/Document/BusinessManager.py
+13
-7
No files found.
product/ERP5/Document/BusinessManager.py
View file @
3162e38c
...
...
@@ -520,8 +520,7 @@ class BusinessManager(Folder):
A Business Manager BT is said to be reduced if and only if:
reduce(BT) = BT
"""
path_list
=
list
(
set
([
path_item
.
getBusinessPath
()
for
path_item
in
self
.
objectValues
()]))
path_list
=
self
.
getPathList
()
reduced_path_item_list
=
[]
...
...
@@ -536,14 +535,14 @@ 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
.
objectValues
():
if
path_
item
.
getProperty
(
'item_path'
)
in
seen_path_list
:
for
item
in
self
.
objectValues
():
if
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
.
getProperty
(
'item_path'
)].
append
(
path_
item
)
seen_path_dict
[
item
.
getProperty
(
'item_path'
)].
append
(
item
)
else
:
# If the path is unique, add them in the list of reduced Business Item
reduced_path_item_list
.
append
(
path_
item
)
reduced_path_item_list
.
append
(
item
)
# Reduce the values and get the merged result out of it
for
path
,
path_item_list
in
seen_path_dict
.
items
():
...
...
@@ -565,6 +564,9 @@ class BusinessManager(Folder):
in
prioritized_path_item
if
item
.
getProperty
(
'item_sign'
)
<
0
]
# XXX: TODO: Look at the correct merge
raise
ValueErrror
(
'Recheck how this is gonna work'
)
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
)
...
...
@@ -590,7 +592,11 @@ class BusinessManager(Folder):
else
:
reduced_path_item_list
.
append
(
prioritized_path_item
[
0
])
self
.
_path_item_list
=
reduced_path_item_list
for
item
in
reduced_path_item_list
:
item
.
isIndexable
=
ConstantGetter
(
'isIndexable'
,
value
=
False
)
new_id
=
self
.
generateNewId
()
self
.
_setObject
(
new_id
,
aq_base
(
item
),
suppress_events
=
True
)
def
_simplifyValueIntersection
(
self
,
added_value
,
subtracted_value
):
"""
...
...
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