Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
cd2d3ee6
Verified
Commit
cd2d3ee6
authored
Oct 06, 2019
by
Sli
Browse files
django2.2: fix tests for accounting
parent
81fcf411
Changes
4
Hide whitespace changes
Inline
Side-by-side
accounting/templates/accounting/journal_statement_accounting.jinja
View file @
cd2d3ee6
...
...
@@ -20,14 +20,14 @@
{%
for
k
,
v
in
statement.items
()
%}
<tr>
<td>
{{
k
}}
</td>
<td>
{{
v
}}
</td>
<td>
{{
"%.2f"
%
v
}}
</td>
</tr>
{%
endfor
%}
</tbody>
</table>
<p><strong>
{%
trans
%}
Amount:
{%
endtrans
%}
</strong>
{{
object.amount
}}
€
</p>
<p><strong>
{%
trans
%}
Effective amount:
{%
endtrans
%}
</strong>
{{
object.effective_amount
}}
€
</p>
<p><strong>
{%
trans
%}
Amount:
{%
endtrans
%}
</strong>
{{
"%.2f"
%
object.amount
}}
€
</p>
<p><strong>
{%
trans
%}
Effective amount:
{%
endtrans
%}
</strong>
{{
"%.2f"
%
object.effective_amount
}}
€
</p>
</div>
{%
endblock
%}
accounting/templates/accounting/journal_statement_nature.jinja
View file @
cd2d3ee6
...
...
@@ -18,12 +18,12 @@
{%
for
k
,
v
in
dict
[
'CREDIT'
]
.
items
()
%}
<tr>
<td>
{{
k
}}
</td>
<td>
{{
v
}}
</td>
<td>
{{
"%.2f"
%
v
}}
</td>
</tr>
{%
endfor
%}
</tbody>
</table>
{%
trans
%}
Total:
{%
endtrans
%}{{
dict
[
'CREDIT_sum'
]
}}
{%
trans
%}
Total:
{%
endtrans
%}{{
"%.2f"
%
dict
[
'CREDIT_sum'
]
}}
<h6>
{%
trans
%}
Debit
{%
endtrans
%}
</h6>
<table>
...
...
@@ -37,19 +37,19 @@
{%
for
k
,
v
in
dict
[
'DEBIT'
]
.
items
()
%}
<tr>
<td>
{{
k
}}
</td>
<td>
{{
v
}}
</td>
<td>
{{
"%.2f"
%
v
}}
</td>
</tr>
{%
endfor
%}
</tbody>
</table>
{%
trans
%}
Total:
{%
endtrans
%}{{
dict
[
'DEBIT_sum'
]
}}
{%
trans
%}
Total:
{%
endtrans
%}{{
"%.2f"
%
dict
[
'DEBIT_sum'
]
}}
{%
endmacro
%}
{%
block
content
%}
<h3>
{%
trans
%}
Statement by nature:
{%
endtrans
%}
{{
object.name
}}
</h3>
{%
for
k
,
v
in
statement.items
()
%}
<h4
style=
"background: lightblue; padding: 4px;"
>
{{
k
}}
:
{{
v
[
'CREDIT_sum'
]
-
v
[
'DEBIT_sum'
]
}}
</h4>
<h4
style=
"background: lightblue; padding: 4px;"
>
{{
k
}}
:
{{
"%.2f"
%
(
v
[
'CREDIT_sum'
]
-
v
[
'DEBIT_sum'
]
)
}}
</h4>
{{
display_tables
(
v
)
}}
<hr>
{%
endfor
%}
...
...
accounting/templates/accounting/journal_statement_person.jinja
View file @
cd2d3ee6
...
...
@@ -28,14 +28,14 @@
{%
else
%}
<td></td>
{%
endif
%}
<td>
{{
credit_statement
[
key
]
}}
</td>
<td>
{{
"%.2f"
%
credit_statement
[
key
]
}}
</td>
</tr>
{%
endfor
%}
</tbody>
</table>
<p>
Total :
{{
total_credit
}}
</p>
<p>
Total :
{{
"%.2f"
%
total_credit
}}
</p>
<h4>
{%
trans
%}
Debit
{%
endtrans
%}
</h4>
...
...
@@ -56,13 +56,13 @@
{%
else
%}
<td></td>
{%
endif
%}
<td>
{{
debit_statement
[
key
]
}}
</td>
<td>
{{
"%.2f"
%
debit_statement
[
key
]
}}
</td>
</tr>
{%
endfor
%}
</tbody>
</table>
<p>
Total :
{{
total_debit
}}
</p>
<p>
Total :
{{
"%.2f"
%
total_debit
}}
</p>
</div>
{%
endblock
%}
accounting/tests.py
View file @
cd2d3ee6
...
...
@@ -272,30 +272,50 @@ class OperationTest(TestCase):
def
test_nature_statement
(
self
):
self
.
client
.
login
(
username
=
"comptable"
,
password
=
"plop"
)
response
_get
=
self
.
client
.
get
(
response
=
self
.
client
.
get
(
reverse
(
"accounting:journal_nature_statement"
,
args
=
[
self
.
journal
.
id
])
)
self
.
assertTrue
(
"bob (Troll Pench
\\
xc3
\\
xa9) : 3.00"
in
str
(
response_get
.
content
)
)
self
.
assertContains
(
response
,
"bob (Troll Penché) : 3.00"
,
status_code
=
200
)
def
test_person_statement
(
self
):
self
.
client
.
login
(
username
=
"comptable"
,
password
=
"plop"
)
response
_get
=
self
.
client
.
get
(
response
=
self
.
client
.
get
(
reverse
(
"accounting:journal_person_statement"
,
args
=
[
self
.
journal
.
id
])
)
self
.
assertTrue
(
"<td>3.00</td>"
in
str
(
response_get
.
content
)
and
'<td><a href="/user/1/">S' Kia</a></td>'
in
str
(
response_get
.
content
)
self
.
assertContains
(
response
,
"Total : 5575.72"
,
status_code
=
200
)
self
.
assertContains
(
response
,
"Total : 71.42"
)
self
.
assertContains
(
response
,
"""
<td><a href="/user/1/">S' Kia</a></td>
<td>3.00</td>"""
,
)
self
.
assertContains
(
response
,
"""
<td><a href="/user/1/">S' Kia</a></td>
<td>823.00</td>"""
,
)
def
test_accounting_statement
(
self
):
self
.
client
.
login
(
username
=
"comptable"
,
password
=
"plop"
)
response
_get
=
self
.
client
.
get
(
response
=
self
.
client
.
get
(
reverse
(
"accounting:journal_accounting_statement"
,
args
=
[
self
.
journal
.
id
])
)
self
.
assertTrue
(
"<td>443 - Cr
\\
xc3
\\
xa9dit - Ce code n'existe pas</td>"
in
str
(
response_get
.
content
)
self
.
assertContains
(
response
,
"""
<tr>
<td>443 - Crédit - Ce code n'existe pas</td>
<td>3.00</td>
</tr>"""
,
status_code
=
200
,
)
self
.
assertContains
(
response
,
"""
<p><strong>Montant : </strong>-5504.30 €</p>
<p><strong>Montant effectif: </strong>-5504.30 €</p>"""
,
)
Write
Preview
Supports
Markdown
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