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
Labels
Merge Requests
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
f2dc2ce5
Commit
f2dc2ce5
authored
Apr 21, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trade: pylint py3
parent
dd921eb1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
48 deletions
+38
-48
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.DeliveryRootSimulationRule.py
...al_components/document.erp5.DeliveryRootSimulationRule.py
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InternalOrder_applyTradeCondition.py
...tal_skins/erp5_trade/InternalOrder_applyTradeCondition.py
+10
-13
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PurchaseOrder_applyPurchaseTradeCondition.py
...s/erp5_trade/PurchaseOrder_applyPurchaseTradeCondition.py
+9
-12
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_applySaleTradeCondition.py
...tal_skins/erp5_trade/SaleOrder_applySaleTradeCondition.py
+12
-15
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_fastInput.py
...Item/portal_skins/erp5_trade/SalePackingList_fastInput.py
+0
-1
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testInventory.py
...TemplateItem/portal_components/test.erp5.testInventory.py
+1
-1
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testPackingList.py
...mplateItem/portal_components/test.erp5.testPackingList.py
+4
-4
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testResource.py
...tTemplateItem/portal_components/test.erp5.testResource.py
+1
-1
No files found.
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.DeliveryRootSimulationRule.py
View file @
f2dc2ce5
...
@@ -87,7 +87,7 @@ class DeliveryRuleMovementGenerator(MovementGeneratorMixin):
...
@@ -87,7 +87,7 @@ class DeliveryRuleMovementGenerator(MovementGeneratorMixin):
# This is bad XXX-JPS - use use
# This is bad XXX-JPS - use use
"""
"""
return
None
return
()
def
_getInputMovementList
(
self
,
movement_list
=
None
,
rounding
=
None
):
def
_getInputMovementList
(
self
,
movement_list
=
None
,
rounding
=
None
):
"""Input movement list comes from delivery"""
"""Input movement list comes from delivery"""
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InternalOrder_applyTradeCondition.py
View file @
f2dc2ce5
...
@@ -29,40 +29,37 @@ def rank_method(trade_condition):
...
@@ -29,40 +29,37 @@ def rank_method(trade_condition):
if
destination_section
:
if
destination_section
:
destination_section_group
=
trade_condition
.
getDestinationSectionValue
().
getGroup
()
destination_section_group
=
trade_condition
.
getDestinationSectionValue
().
getGroup
()
if
destination_section
==
context
.
getDestinationSection
():
if
destination_section
==
context
.
getDestinationSection
():
rank
+
=
10
rank
-
=
10
else
:
else
:
rank
-
=
2
rank
+
=
2
destination
=
trade_condition
.
getDestination
()
destination
=
trade_condition
.
getDestination
()
if
destination
:
if
destination
:
if
destination
==
context
.
getDestination
():
if
destination
==
context
.
getDestination
():
rank
+
=
10
rank
-
=
10
else
:
else
:
rank
-
=
2
rank
+
=
2
if
trade_condition
.
getSourceSection
():
if
trade_condition
.
getSourceSection
():
rank
+
=
1
rank
-
=
1
if
destination_section_group
:
if
destination_section_group
:
source_section_group
=
trade_condition
.
getSourceSectionValue
().
getGroup
()
source_section_group
=
trade_condition
.
getSourceSectionValue
().
getGroup
()
if
source_section_group
:
if
source_section_group
:
if
source_section_group
.
startswith
(
destination_section_group
)
\
if
source_section_group
.
startswith
(
destination_section_group
)
\
or
destination_section_group
.
startswith
(
source_section_group
):
or
destination_section_group
.
startswith
(
source_section_group
):
# trade conditions where both sections are in the same group must have high priority
# trade conditions where both sections are in the same group must have high priority
rank
+
=
20
rank
-
=
20
if
trade_condition
.
getSource
():
if
trade_condition
.
getSource
():
rank
+
=
1
rank
-
=
1
rank
+
=
len
(
trade_condition
.
getSpecialiseList
())
rank
-
=
len
(
trade_condition
.
getSpecialiseList
())
if
trade_condition
.
getValidationState
()
==
'validated'
:
if
trade_condition
.
getValidationState
()
==
'validated'
:
rank
+
=
2
rank
-
=
2
return
rank
return
rank
def
sort_method
(
a
,
b
):
return
-
cmp
(
rank_method
(
a
),
rank_method
(
b
))
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_list
,
predicate_context
,
portal_type
=
trade_condition_portal_type_list
,
tested_base_category_list
=
tested_base_category_list
[:
count
],
tested_base_category_list
=
tested_base_category_list
[:
count
],
sort_
method
=
sort
_method
)
sort_
key_method
=
rank
_method
)
keep_items
=
{}
keep_items
=
{}
if
len
(
trade_condition_list
)
==
0
:
if
len
(
trade_condition_list
)
==
0
:
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PurchaseOrder_applyPurchaseTradeCondition.py
View file @
f2dc2ce5
...
@@ -27,33 +27,30 @@ def rank_method(trade_condition):
...
@@ -27,33 +27,30 @@ def rank_method(trade_condition):
source_section
=
trade_condition
.
getSourceSection
()
source_section
=
trade_condition
.
getSourceSection
()
if
source_section
:
if
source_section
:
if
source_section
==
context
.
getSourceSection
():
if
source_section
==
context
.
getSourceSection
():
rank
+
=
10
rank
-
=
10
else
:
else
:
rank
-
=
2
rank
+
=
2
source
=
trade_condition
.
getSource
()
source
=
trade_condition
.
getSource
()
if
source
:
if
source
:
if
source
==
context
.
getSource
():
if
source
==
context
.
getSource
():
rank
+
=
10
rank
-
=
10
else
:
else
:
rank
-
=
2
rank
+
=
2
if
trade_condition
.
getDestinationSection
():
if
trade_condition
.
getDestinationSection
():
rank
+
=
1
rank
-
=
1
if
trade_condition
.
getDestination
():
if
trade_condition
.
getDestination
():
rank
+
=
1
rank
-
=
1
rank
+
=
len
(
trade_condition
.
getSpecialiseList
())
rank
-
=
len
(
trade_condition
.
getSpecialiseList
())
if
trade_condition
.
getValidationState
()
==
'validated'
:
if
trade_condition
.
getValidationState
()
==
'validated'
:
rank
+
=
2
rank
-
=
2
return
rank
return
rank
def
sort_method
(
a
,
b
):
return
-
cmp
(
rank_method
(
a
),
rank_method
(
b
))
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
],
sort_
method
=
sort
_method
)
sort_
key_method
=
rank
_method
)
keep_items
=
{}
keep_items
=
{}
if
len
(
trade_condition_list
)
==
0
:
if
len
(
trade_condition_list
)
==
0
:
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_applySaleTradeCondition.py
View file @
f2dc2ce5
...
@@ -28,35 +28,32 @@ def rank_method(trade_condition):
...
@@ -28,35 +28,32 @@ def rank_method(trade_condition):
destination_project
=
trade_condition
.
getDestinationProject
()
destination_project
=
trade_condition
.
getDestinationProject
()
if
destination_project
:
if
destination_project
:
if
destination_project
==
context
.
getDestinationProject
():
if
destination_project
==
context
.
getDestinationProject
():
rank
+
=
10
rank
-
=
10
else
:
else
:
rank
-
=
2
rank
+
=
2
destination_section
=
trade_condition
.
getDestinationSection
()
destination_section
=
trade_condition
.
getDestinationSection
()
if
destination_section
:
if
destination_section
:
if
destination_section
==
context
.
getDestinationSection
():
if
destination_section
==
context
.
getDestinationSection
():
rank
+
=
10
rank
-
=
10
else
:
else
:
rank
-
=
2
rank
+
=
2
destination
=
trade_condition
.
getDestination
()
destination
=
trade_condition
.
getDestination
()
if
destination
:
if
destination
:
if
destination
==
context
.
getDestination
():
if
destination
==
context
.
getDestination
():
rank
+
=
10
rank
-
=
10
else
:
else
:
rank
-
=
2
rank
+
=
2
if
trade_condition
.
getSourceProject
():
if
trade_condition
.
getSourceProject
():
rank
+
=
1
rank
-
=
1
if
trade_condition
.
getSourceSection
():
if
trade_condition
.
getSourceSection
():
rank
+
=
1
rank
-
=
1
if
trade_condition
.
getSource
():
if
trade_condition
.
getSource
():
rank
+
=
1
rank
-
=
1
rank
+
=
len
(
trade_condition
.
getSpecialiseList
())
rank
-
=
len
(
trade_condition
.
getSpecialiseList
())
if
trade_condition
.
getValidationState
()
==
'validated'
:
if
trade_condition
.
getValidationState
()
==
'validated'
:
rank
+
=
2
rank
-
=
2
return
rank
return
rank
def
sort_method
(
a
,
b
):
return
-
cmp
(
rank_method
(
a
),
rank_method
(
b
))
def
filter_method
(
trade_condition_list
):
def
filter_method
(
trade_condition_list
):
# Reject trade condition which has a non different value than the order
# Reject trade condition which has a non different value than the order
filtered_trade_condition_list
=
[]
filtered_trade_condition_list
=
[]
...
@@ -76,7 +73,7 @@ while count > 0 and len(trade_condition_list) == 0:
...
@@ -76,7 +73,7 @@ while count > 0 and len(trade_condition_list) == 0:
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
,
filter_method
=
filter_method
,
sort_
method
=
sort
_method
)
sort_
key_method
=
rank
_method
)
keep_items
=
{}
keep_items
=
{}
if
len
(
trade_condition_list
)
==
0
:
if
len
(
trade_condition_list
)
==
0
:
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_fastInput.py
View file @
f2dc2ce5
...
@@ -70,7 +70,6 @@ with ImmediateReindexContextManager() as immediate_reindex_context_manager:
...
@@ -70,7 +70,6 @@ with ImmediateReindexContextManager() as immediate_reindex_context_manager:
line_variation_base_category_list
=
line_variation_base_category_dict
.
keys
()
line_variation_base_category_list
=
line_variation_base_category_dict
.
keys
()
# construct new content (container_line)
# construct new content (container_line)
resource_url
=
resource_url
new_container_line_id
=
str
(
container
.
generateNewId
())
new_container_line_id
=
str
(
container
.
generateNewId
())
container_line
=
container
.
newContent
(
container_line
=
container
.
newContent
(
immediate_reindex
=
immediate_reindex_context_manager
,
immediate_reindex
=
immediate_reindex_context_manager
,
...
...
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testInventory.py
View file @
f2dc2ce5
...
@@ -429,7 +429,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
...
@@ -429,7 +429,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
sequence
.
edit
(
variation_2
=
cell_key
)
sequence
.
edit
(
variation_2
=
cell_key
)
quantity
=
3
quantity
=
3
cell
.
edit
(
cell
.
edit
(
quantity
=
quantity
,
quantity
=
quantity
,
# pylint:disable=used-before-assignment
predicate_category_list
=
cell_key
,
predicate_category_list
=
cell_key
,
variation_category_list
=
cell_key
,
variation_category_list
=
cell_key
,
mapped_value_property_list
=
[
'quantity'
],
mapped_value_property_list
=
[
'quantity'
],
...
...
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testPackingList.py
View file @
f2dc2ce5
...
@@ -1799,7 +1799,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
...
@@ -1799,7 +1799,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
sale_packing_list2
.
getUid
()))]
sale_packing_list2
.
getUid
()))]
self
.
assertEqual
({
self
.
default_quantity
-
4
,
self
.
default_quantity
-
3
},
self
.
assertEqual
({
self
.
default_quantity
-
4
,
self
.
default_quantity
-
3
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list1
.
getMovementList
()]))
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list1
.
getMovementList
()]))
self
.
assertEqual
({
1
,
1
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list3
.
getMovementList
()]))
self
.
assertEqual
({
1
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list3
.
getMovementList
()]))
self
.
assertEqual
(
"solved"
,
sale_packing_list3
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list3
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list1
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list1
.
getCausalityState
())
def
getSolverProcessStateList
(
delivery
):
def
getSolverProcessStateList
(
delivery
):
...
@@ -1811,7 +1811,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
...
@@ -1811,7 +1811,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
self
.
assertEqual
({
self
.
default_quantity
-
4
,
self
.
default_quantity
-
3
},
self
.
assertEqual
({
self
.
default_quantity
-
4
,
self
.
default_quantity
-
3
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list1
.
getMovementList
()]))
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list1
.
getMovementList
()]))
self
.
assertEqual
({
1
,
2
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list2
.
getMovementList
()]))
self
.
assertEqual
({
1
,
2
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list2
.
getMovementList
()]))
self
.
assertEqual
({
2
,
2
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list3
.
getMovementList
()]))
self
.
assertEqual
({
2
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list3
.
getMovementList
()]))
self
.
assertEqual
(
"solved"
,
sale_packing_list1
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list1
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list2
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list2
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list3
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list3
.
getCausalityState
())
...
@@ -1822,7 +1822,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
...
@@ -1822,7 +1822,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
self
.
assertEqual
({
self
.
default_quantity
-
5
,
self
.
default_quantity
-
4
},
self
.
assertEqual
({
self
.
default_quantity
-
5
,
self
.
default_quantity
-
4
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list1
.
getMovementList
()]))
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list1
.
getMovementList
()]))
self
.
assertEqual
({
2
,
3
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list2
.
getMovementList
()]))
self
.
assertEqual
({
2
,
3
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list2
.
getMovementList
()]))
self
.
assertEqual
({
2
,
2
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list3
.
getMovementList
()]))
self
.
assertEqual
({
2
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list3
.
getMovementList
()]))
self
.
assertEqual
(
"solved"
,
sale_packing_list1
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list1
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list2
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list2
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list3
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list3
.
getCausalityState
())
...
@@ -1837,7 +1837,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
...
@@ -1837,7 +1837,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
self
.
assertEqual
({
self
.
default_quantity
-
6
,
self
.
default_quantity
-
5
},
self
.
assertEqual
({
self
.
default_quantity
-
6
,
self
.
default_quantity
-
5
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list1
.
getMovementList
()]))
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list1
.
getMovementList
()]))
self
.
assertEqual
({
2
,
3
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list2
.
getMovementList
()]))
self
.
assertEqual
({
2
,
3
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list2
.
getMovementList
()]))
self
.
assertEqual
({
3
,
3
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list3
.
getMovementList
()]))
self
.
assertEqual
({
3
},
set
([
x
.
getQuantity
()
for
x
in
sale_packing_list3
.
getMovementList
()]))
self
.
assertEqual
(
"solved"
,
sale_packing_list1
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list1
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list2
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list2
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list3
.
getCausalityState
())
self
.
assertEqual
(
"solved"
,
sale_packing_list3
.
getCausalityState
())
...
...
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testResource.py
View file @
f2dc2ce5
...
@@ -849,7 +849,7 @@ class TestResource(ERP5TypeTestCase):
...
@@ -849,7 +849,7 @@ class TestResource(ERP5TypeTestCase):
destination_section_value
=
node
)
destination_section_value
=
node
)
supply
.
validate
()
supply
.
validate
()
if
0
:
if
0
:
# pylint:disable=using-constant-test
# XXX if both a supply line for the resource and a supply cell for
# XXX if both a supply line for the resource and a supply cell for
# the resource with the exact variation can be applied, one of them
# the resource with the exact variation can be applied, one of them
# is choosen randomly. It looks like a bug, but I'm not sure we
# is choosen randomly. It looks like a bug, but I'm not sure we
...
...
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