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
1
Issues
1
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
Roque
erp5
Commits
1b8dbe1f
Commit
1b8dbe1f
authored
Sep 08, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_trade: drop trade condition with not matching categories
parent
b9db0af5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_applySaleTradeCondition.py
...tal_skins/erp5_trade/SaleOrder_applySaleTradeCondition.py
+17
-2
No files found.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_applySaleTradeCondition.py
View file @
1b8dbe1f
...
@@ -8,9 +8,10 @@ trade_condition_portal_type = 'Sale Trade Condition'
...
@@ -8,9 +8,10 @@ trade_condition_portal_type = 'Sale Trade Condition'
trade_condition_list
=
order
.
getSpecialiseValueList
(
trade_condition_list
=
order
.
getSpecialiseValueList
(
portal_type
=
trade_condition_portal_type
)
portal_type
=
trade_condition_portal_type
)
all_category_list
=
(
'source_section'
,
'source'
,
'source_project'
,
'destination_section'
,
'destination'
,
'destination_project'
)
tested_base_category_list
=
[
]
tested_base_category_list
=
[
]
for
base_category
in
(
'source_section'
,
'source'
,
'source_project'
,
for
base_category
in
all_category_list
:
'destination_section'
,
'destination'
,
'destination_project'
):
if
context
.
getProperty
(
base_category
):
if
context
.
getProperty
(
base_category
):
tested_base_category_list
.
append
(
base_category
)
tested_base_category_list
.
append
(
base_category
)
...
@@ -56,11 +57,25 @@ def rank_method(trade_condition):
...
@@ -56,11 +57,25 @@ def rank_method(trade_condition):
def
sort_method
(
a
,
b
):
def
sort_method
(
a
,
b
):
return
-
cmp
(
rank_method
(
a
),
rank_method
(
b
))
return
-
cmp
(
rank_method
(
a
),
rank_method
(
b
))
def
filter_method
(
trade_condition_list
):
# Reject trade condition which has a non different value than the order
filtered_trade_condition_list
=
[]
for
trade_condition
in
trade_condition_list
:
matching
=
True
for
base_category
in
all_category_list
:
if
trade_condition
.
getProperty
(
base_category
):
if
trade_condition
.
getProperty
(
base_category
)
!=
order
.
getProperty
(
base_category
):
matching
=
False
if
matching
:
filtered_trade_condition_list
.
append
(
trade_condition
)
return
filtered_trade_condition_list
while
count
>
0
and
len
(
trade_condition_list
)
==
0
:
while
count
>
0
and
len
(
trade_condition_list
)
==
0
:
count
-=
1
count
-=
1
trade_condition_list
=
context
.
portal_domains
.
searchPredicateList
(
trade_condition_list
=
context
.
portal_domains
.
searchPredicateList
(
predicate_context
,
portal_type
=
trade_condition_portal_type
,
predicate_context
,
portal_type
=
trade_condition_portal_type
,
tested_base_category_list
=
tested_base_category_list
[:
count
],
tested_base_category_list
=
tested_base_category_list
[:
count
],
filter_method
=
filter_method
,
sort_method
=
sort_method
)
sort_method
=
sort_method
)
keep_items
=
{}
keep_items
=
{}
...
...
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