Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
f96cb845
Commit
f96cb845
authored
Jan 31, 2025
by
Rafael Monnerat
👻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: Drop usage of cmp
follow changes done on upstream for erp5 code.
parent
a4edb53e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleOrder_applySaleTradeCondition.py
...ns/slapos_accounting/SaleOrder_applySaleTradeCondition.py
+11
-14
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleOrder_applySaleTradeCondition.py
View file @
f96cb845
...
...
@@ -31,33 +31,30 @@ def rank_method(trade_condition):
destination_project
=
trade_condition
.
getDestinationProject
()
if
destination_project
:
if
destination_project
==
context
.
getDestinationProject
():
rank
+
=
10
rank
-
=
10
else
:
rank
-
=
2
rank
+
=
2
destination_section
=
trade_condition
.
getDestinationSection
()
if
destination_section
:
if
destination_section
==
context
.
getDestinationSection
():
rank
+
=
10
rank
-
=
10
else
:
rank
-
=
2
rank
+
=
2
destination
=
trade_condition
.
getDestination
()
if
destination
:
if
destination
==
context
.
getDestination
():
rank
+
=
10
rank
-
=
10
else
:
rank
-
=
2
rank
+
=
2
if
trade_condition
.
getSourceProject
():
rank
+
=
1
rank
-
=
1
if
trade_condition
.
getSourceSection
():
rank
+
=
1
rank
-
=
1
if
trade_condition
.
getSource
():
rank
+
=
1
rank
+
=
len
(
trade_condition
.
getSpecialiseList
())
rank
-
=
1
rank
-
=
len
(
trade_condition
.
getSpecialiseList
())
return
rank
def
sort_method
(
a
,
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
=
[]
...
...
@@ -102,7 +99,7 @@ while count > 0 and len(trade_condition_list) == 0:
predicate_context
,
tested_base_category_list
=
tested_base_category_list
,
#[:count],
filter_method
=
filter_method
,
sort_
method
=
sort
_method
,
**
filter_kw
)
sort_
key_method
=
rank
_method
,
**
filter_kw
)
#raise NotImplementedError('trade cl %s' % str([(x, rank_method(x), x.getValidationState()) for x in trade_condition_list]))
...
...
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