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
91f543a1
Commit
91f543a1
authored
Jun 22, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: test tax line in printout with testTradeModelLine
parent
e9c7b8c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
product/ERP5/tests/testTradeModelLine.py
product/ERP5/tests/testTradeModelLine.py
+46
-1
No files found.
product/ERP5/tests/testTradeModelLine.py
View file @
91f543a1
...
...
@@ -38,6 +38,7 @@ from Products.ERP5Type.Base import Base
from
Products.ERP5Type.Utils
import
simple_decorator
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5OOo.tests.utils
import
Validator
def
save_result_as
(
name
):
...
...
@@ -92,6 +93,8 @@ class TestTradeModelLineMixin(TestBPMMixin, UserDict):
def
afterSetUp
(
self
):
UserDict
.
__init__
(
self
)
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
().
setPreferredTaxUseList
([
'use/tax'
])
self
.
tic
()
return
super
(
TestTradeModelLineMixin
,
self
).
afterSetUp
()
def
beforeTearDown
(
self
):
...
...
@@ -963,6 +966,7 @@ return lambda *args, **kw: 1""")
price
=
.
15
,
resource_value
=
tax
,
trade_phase
=
'default/tax'
,
use
=
'tax'
,
base_application
=
'base_amount/tax'
),
))
source
=
self
.
createNode
()
...
...
@@ -976,10 +980,50 @@ return lambda *args, **kw: 1""")
source_section_value
=
source
,
destination_section_value
=
destination
)
def
checkVATOnOrderPrintout
(
order
):
# BBB invoice printout has been improved to display
# tax in a table grouping each tax togetherr, but order printout
# not yet and uses a sligthly different data model
data_dict
=
order
.
_getTypeBasedMethod
(
'getODTDataDict'
)()
self
.
assertEqual
(
data_dict
[
'total_price'
],
1000.0
)
self
.
assertEqual
(
data_dict
[
'total_price_novat'
],
1000.0
)
self
.
assertEqual
(
[
vat
.
getTotalPrice
()
for
vat
in
data_dict
[
'vat_list'
]],
[
150.0
])
# rendering template does not fail and is valid ODF
self
.
assertFalse
(
Validator
().
validate
(
order
.
_getTypeBasedMethod
(
'viewAsODT'
)()))
def
checkVATOnInvoicePrintout
(
invoice
):
data_dict
=
invoice
.
_getTypeBasedMethod
(
'getODTDataDict'
)()
self
.
assertEqual
(
data_dict
[
'total_price_exclude_tax'
],
1000.0
)
self
.
assertEqual
(
data_dict
[
'total_tax_price'
],
150.0
)
self
.
assertEqual
(
data_dict
[
'total_price'
],
1150.0
)
self
.
assertEqual
(
[
(
line_tax
[
'total_quantity'
],
line_tax
[
'base_price'
],
line_tax
[
'total_price'
],
)
for
line_tax
in
data_dict
[
'line_not_tax'
]
],
[(
10.0
,
100.0
,
1000.0
)])
self
.
assertEqual
(
[
(
line_tax
[
'total_quantity'
],
line_tax
[
'base_price'
],
line_tax
[
'total_price'
],
)
for
line_tax
in
data_dict
[
'line_tax'
]
],
[(
1000.0
,
0.15
,
150.0
)])
# rendering template does not fail and is valid ODF
self
.
assertFalse
(
Validator
().
validate
(
order
.
_getTypeBasedMethod
(
'viewAsODT'
)()))
checkVATOnOrderPrintout
(
order
)
order
.
plan
()
order
.
confirm
()
self
.
tic
()
self
.
buildPackingLists
()
checkVATOnOrderPrintout
(
order
)
packing_list
=
order
.
getCausalityRelatedValue
(
portal_type
=
self
.
packing_list_portal_type
)
...
...
@@ -999,9 +1043,10 @@ return lambda *args, **kw: 1""")
self
.
assertEqual
(
1150
,
invoice
.
getTotalPrice
())
self
.
assertEqual
([],
invoice
.
getDivergenceList
())
checkVATOnInvoicePrintout
(
invoice
)
invoice
.
start
()
self
.
tic
()
checkVATOnInvoicePrintout
(
invoice
)
self
.
assertEqual
([],
invoice
.
getDivergenceList
())
accounting_line_list
=
invoice
.
getMovementList
(
portal_type
=
self
.
invoice_transaction_line_portal_type
)
...
...
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