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
Carlos Ramos Carreño
erp5
Commits
e6eefb3c
Commit
e6eefb3c
authored
2 years ago
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
8 months ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: explicitly cast dict keys to list.
parent
5af25451
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
16 deletions
+20
-16
bt5/erp5_immobilisation/DocumentTemplateItem/portal_components/document.erp5.AmortisationRule.py
...eItem/portal_components/document.erp5.AmortisationRule.py
+3
-2
bt5/erp5_immobilisation/TestTemplateItem/portal_components/test.erp5.testImmobilisation.py
...ateItem/portal_components/test.erp5.testImmobilisation.py
+1
-1
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.SolverProcess.py
...lateItem/portal_components/document.erp5.SolverProcess.py
+4
-4
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.ImmobilisableItem.py
...Item/portal_components/document.erp5.ImmobilisableItem.py
+3
-2
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.SimulationMovement.py
...tem/portal_components/document.erp5.SimulationMovement.py
+2
-1
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.MovementGroup.py
...mplateItem/portal_components/module.erp5.MovementGroup.py
+1
-0
product/ERP5OOo/tests/testOOoParser.py
product/ERP5OOo/tests/testOOoParser.py
+6
-6
No files found.
bt5/erp5_immobilisation/DocumentTemplateItem/portal_components/document.erp5.AmortisationRule.py
View file @
e6eefb3c
...
...
@@ -32,6 +32,7 @@ from DateTime import DateTime
from
erp5.component.module.DateUtils
import
centis
,
getClosestDate
,
addToDate
from
erp5.component.module.DateUtils
import
getDecimalNumberOfYearsBetween
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Utils
import
ensure_list
from
erp5.component.mixin.RuleMixin
import
RuleMixin
from
Products.CMFCore.utils
import
getToolByName
from
erp5.component.document.ImmobilisationMovement
import
NO_CHANGE_METHOD
...
...
@@ -659,8 +660,8 @@ class AmortisationRule(RuleMixin):
# according to these ratio : the highest ratio gets the priority, then the next
# highest is taken into account if corresponding resources are free, and so on
matching_ratio_list
.
sort
(
key
=
lambda
x
:
x
[
'ratio'
],
reverse
=
True
)
calculated_to_match
=
calculated_period_dict
.
keys
(
)
aggregated_to_match
=
aggregated_period_dict
.
keys
(
)
calculated_to_match
=
ensure_list
(
calculated_period_dict
.
keys
()
)
aggregated_to_match
=
ensure_list
(
aggregated_period_dict
.
keys
()
)
match_dict
=
{}
for
matching_ratio
in
matching_ratio_list
:
calculated
=
matching_ratio
[
'calculated_period'
]
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_immobilisation/TestTemplateItem/portal_components/test.erp5.testImmobilisation.py
View file @
e6eefb3c
...
...
@@ -2947,7 +2947,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
e_line
=
e_line_list
[
e_line_cursor
]
wrong_line
=
0
key_cursor
=
0
key_list
=
e_line
.
keys
(
)
key_list
=
list
(
e_line
.
keys
()
)
while
key_cursor
<
len
(
key_list
)
and
not
wrong_line
:
key
=
key_list
[
key_cursor
]
e_value
=
e_line
[
key
]
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.SolverProcess.py
View file @
e6eefb3c
...
...
@@ -30,6 +30,7 @@
import
zope.interface
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.Utils
import
ensure_list
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.CMFActivity.ActiveProcess
import
ActiveProcess
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
...
...
@@ -100,8 +101,7 @@ class SolverProcess(XMLObject, ActiveProcess):
if
solver
is
None
:
continue
solver_conviguration_dict
=
decision
.
getConfigurationPropertyDict
()
configuration_mapping
=
solver_conviguration_dict
.
items
()
configuration_mapping
.
sort
()
# Make sure the list is sorted in canonical way
configuration_mapping
=
sorted
(
solver_conviguration_dict
.
items
())
# Make sure the list is sorted in canonical way
configuration_mapping
=
tuple
(
configuration_mapping
)
for
movement
in
decision
.
getDeliveryValueList
():
# Detect incompatibilities
...
...
@@ -164,8 +164,8 @@ class SolverProcess(XMLObject, ActiveProcess):
for
solver
,
solver_key_dict
in
grouped_solver_dict
.
items
():
for
solver_key
,
solver_movement_dict
in
solver_key_dict
.
items
():
solver_instance
=
self
.
newContent
(
portal_type
=
solver
.
getId
())
solver_instance
.
_setDeliveryValueList
(
solver_movement_dict
.
keys
(
))
for
movement
,
configuration_list
in
s
olver_movement_dict
.
iteritems
(
):
solver_instance
.
_setDeliveryValueList
(
ensure_list
(
solver_movement_dict
.
keys
()
))
for
movement
,
configuration_list
in
s
ix
.
iteritems
(
solver_movement_dict
):
for
configuration_mapping
in
configuration_list
:
if
len
(
configuration_mapping
):
solver_instance
.
updateConfiguration
(
**
dict
(
configuration_mapping
))
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.ImmobilisableItem.py
View file @
e6eefb3c
...
...
@@ -32,6 +32,7 @@ from AccessControl import ClassSecurityInfo
from
DateTime
import
DateTime
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.Utils
import
ensure_list
from
erp5.component.interface.IImmobilisationItem
import
IImmobilisationItem
from
erp5.component.module.DateUtils
import
addToDate
,
getClosestDate
,
roundDate
from
erp5.component.module.DateUtils
import
getRoundedMonthBetween
,
millis
...
...
@@ -566,7 +567,7 @@ class ImmobilisableItem(Item, Amount):
extra_cost_price
=
current_immo_period
.
get
(
'start_extra_cost_price'
)
main_price
=
current_immo_period
.
get
(
'start_main_price'
)
current_immo_period
[
'start_price'
]
=
(
main_price
or
0.
)
+
(
extra_cost_price
or
0.
)
key_list
=
current_immo_period
.
keys
(
)
key_list
=
ensure_list
(
current_immo_period
.
keys
()
)
for
key
in
key_list
:
value
=
current_immo_period
[
key
]
if
key
.
find
(
'_'
)
!=
-
1
:
...
...
@@ -575,7 +576,7 @@ class ImmobilisableItem(Item, Amount):
else
:
# A period wich is alone only copies start values to initial ones
# So it may be invalid later
key_list
=
current_immo_period
.
keys
(
)
key_list
=
ensure_list
(
current_immo_period
.
keys
()
)
for
key
in
key_list
:
value
=
current_immo_period
[
key
]
if
key
.
find
(
'_'
)
!=
-
1
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.SimulationMovement.py
View file @
e6eefb3c
...
...
@@ -32,6 +32,7 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
interfaces
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
from
Products.ERP5Type.Utils
import
ensure_list
from
erp5.component.document.Movement
import
Movement
from
erp5.component.module.ExpandPolicy
import
policy_dict
,
TREE_DELIVERED_CACHE_KEY
...
...
@@ -287,7 +288,7 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
# applicable rule per reference. It indicates a configuration error.
applicable_rule_dict
.
setdefault
(
reference
,
rule
)
applicable_rule_list
=
applicable_rule_dict
.
values
(
)
applicable_rule_list
=
ensure_list
(
applicable_rule_dict
.
values
()
)
for
applied_rule
in
list
(
self
.
objectValues
()):
rule
=
applied_rule
.
getSpecialiseValue
()
try
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.MovementGroup.py
View file @
e6eefb3c
...
...
@@ -31,6 +31,7 @@
from
collections
import
OrderedDict
from
warnings
import
warn
from
Products.PythonScripts.Utility
import
allow_class
from
Products.ERP5Type.Utils
import
ensure_list
class
MovementGroupNode
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5OOo/tests/testOOoParser.py
View file @
e6eefb3c
...
...
@@ -43,7 +43,7 @@ class TestOOoParser(unittest.TestCase):
parser
=
OOoParser
()
parser
.
openFile
(
open
(
makeFilePath
(
'import_data_list.ods'
),
'rb'
))
mapping
=
parser
.
getSpreadsheetsMapping
()
self
.
assertEqual
([
'Person'
],
mapping
.
keys
(
))
self
.
assertEqual
([
'Person'
],
list
(
mapping
.
keys
()
))
person_mapping
=
mapping
[
'Person'
]
self
.
assertTrue
(
isinstance
(
person_mapping
,
list
))
self
.
assertTrue
(
102
,
len
(
person_mapping
))
...
...
@@ -57,14 +57,14 @@ class TestOOoParser(unittest.TestCase):
with
open
(
makeFilePath
(
'import_data_list.ods'
),
'rb'
)
as
f
:
parser
.
openFromBytes
(
f
.
read
())
mapping
=
parser
.
getSpreadsheetsMapping
()
self
.
assertEqual
([
'Person'
],
mapping
.
keys
(
))
self
.
assertEqual
([
'Person'
],
list
(
mapping
.
keys
()
))
def
test_getSpreadSheetMappingStyle
(
self
):
parser
=
OOoParser
()
with
open
(
makeFilePath
(
'import_data_list_with_style.ods'
),
'rb'
)
as
f
:
parser
.
openFile
(
f
)
mapping
=
parser
.
getSpreadsheetsMapping
()
self
.
assertEqual
([
'Feuille1'
],
mapping
.
keys
(
))
self
.
assertEqual
([
'Feuille1'
],
list
(
mapping
.
keys
()
))
self
.
assertEqual
(
mapping
[
'Feuille1'
][
1
],
[
'a line with style'
])
self
.
assertEqual
(
mapping
[
'Feuille1'
][
2
],
...
...
@@ -79,7 +79,7 @@ class TestOOoParser(unittest.TestCase):
with
open
(
makeFilePath
(
'import_data_list_data_type.ods'
),
'rb'
)
as
f
:
parser
.
openFile
(
f
)
mapping
=
parser
.
getSpreadsheetsMapping
()
self
.
assertEqual
([
'Feuille1'
],
mapping
.
keys
(
))
self
.
assertEqual
([
'Feuille1'
],
list
(
mapping
.
keys
()
))
self
.
assertEqual
(
mapping
[
'Feuille1'
][
0
],
[
'1234.5678'
])
self
.
assertEqual
(
mapping
[
'Feuille1'
][
1
],
...
...
@@ -112,7 +112,7 @@ class TestOOoParser(unittest.TestCase):
parser
=
OOoParser
()
parser
.
openFile
(
open
(
makeFilePath
(
'complex_text.ods'
),
'rb'
))
mapping
=
parser
.
getSpreadsheetsMapping
()
self
.
assertEqual
([
'Feuille1'
],
mapping
.
keys
(
))
self
.
assertEqual
([
'Feuille1'
],
list
(
mapping
.
keys
()
))
self
.
assertEqual
(
mapping
[
'Feuille1'
][
0
],
[
' leading space'
])
self
.
assertEqual
(
mapping
[
'Feuille1'
][
1
],
[
' leading space'
])
self
.
assertEqual
(
mapping
[
'Feuille1'
][
2
],
[
'tab
\
t
'
])
...
...
@@ -122,7 +122,7 @@ class TestOOoParser(unittest.TestCase):
parser
=
OOoParser
()
parser
.
openFile
(
open
(
makeFilePath
(
'empty_cells.ods'
),
'rb'
))
mapping
=
parser
.
getSpreadsheetsMapping
()
self
.
assertEqual
([
'Feuille1'
],
mapping
.
keys
(
))
self
.
assertEqual
([
'Feuille1'
],
list
(
mapping
.
keys
()
))
self
.
assertEqual
(
mapping
[
'Feuille1'
],
[
[
'A1'
,
None
,
'C1'
],
...
...
This diff is collapsed.
Click to expand it.
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