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
a6c371f7
Commit
a6c371f7
authored
Jan 30, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testTradeModelLine py3
parent
0b29d6b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
bt5/erp5_simplified_invoicing/TestTemplateItem/portal_components/test.erp5.testTradeModelLine.py
...ateItem/portal_components/test.erp5.testTradeModelLine.py
+8
-5
No files found.
bt5/erp5_simplified_invoicing/TestTemplateItem/portal_components/test.erp5.testTradeModelLine.py
View file @
a6c371f7
...
...
@@ -29,6 +29,7 @@
##############################################################################
from
six.moves
import
UserDict
import
functools
import
random
import
unittest
from
unittest
import
expectedFailure
...
...
@@ -815,7 +816,7 @@ return getBaseAmountQuantity""")
reference
=
'tax3'
),
))
def
createCells
(
line
,
matrix
,
base_application
=
(),
base_contribution
=
()):
range_list
=
[
set
()
for
x
in
iter
(
matrix
).
next
(
)]
range_list
=
[
set
()
for
x
in
next
(
iter
(
matrix
)
)]
for
index
in
matrix
:
for
x
,
y
in
zip
(
range_list
,
index
):
x
.
add
(
y
)
...
...
@@ -884,7 +885,7 @@ return context""" % (base_amount, base_amount))
))
total_price
=
order
.
getTotalPrice
()
total_ratio
=
reduce
(
lambda
x
,
y
:
x
*
(
1
-
y
),
discount_list
,
1.2
)
total_ratio
=
functools
.
reduce
(
lambda
x
,
y
:
x
*
(
1
-
y
),
discount_list
,
1.2
)
amount_list
=
order
.
getAggregatedAmountList
()
self
.
assertAlmostEqual
(
total_price
*
total_ratio
,
sum
((
x
.
getTotalPrice
()
for
x
in
amount_list
),
total_price
))
...
...
@@ -902,7 +903,7 @@ return context""" % (base_amount, base_amount))
}
for
index
,
application
,
contribution
in
lines
]
def
check
():
resolver
(
delivery_amount
,
property_dict_list
)
self
.
assertEqual
(
range
(
len
(
property_dict_list
)),
self
.
assertEqual
(
list
(
range
(
len
(
property_dict_list
)
)),
[
x
[
'index'
]
for
x
in
property_dict_list
])
# Case 1: calculation of some base_amount depends on others.
...
...
@@ -1291,9 +1292,11 @@ return lambda *args, **kw: 1""")
self
.
assertEqual
(
3333
*
0.05
+
171
*
0.05
,
amount
.
getTotalPrice
())
# 175.2
# check the result with rounding
amount_list
=
order
.
getAggregatedAmountList
(
rounding
=
True
)
# XXX Mark it as expectedFailure until we have clear specification
# XXX next assertion is commented out until we have clear specification
# of what we wish with rounding
expectedFailure
(
self
.
assertEqual
)(
2
,
len
(
amount_list
))
# XXX 1 or 2 ???
# self.assertEqual(2, len(amount_list)) # XXX 1 or 2 ???
self
.
assertEqual
(
174
,
getTotalAmount
(
amount_list
))
# check getAggregatedAmountList result of each movement
...
...
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