changeset d99557e3231b in modules/account_es:default
details:
https://hg.tryton.org/modules/account_es?cmd=changeset&node=d99557e3231b
description:
Add test for cancelled invoices in VAT Book and VAT List Reports
diffstat:
tests/scenario_reporting_cancelled_invoices.rst | 53 ++++++++++++++++++------
1 files changed, 39 insertions(+), 14 deletions(-)
diffs (91 lines):
diff -r 0a742f78ab11 -r d99557e3231b
tests/scenario_reporting_cancelled_invoices.rst
--- a/tests/scenario_reporting_cancelled_invoices.rst Thu Apr 29 11:20:15
2021 +0200
+++ b/tests/scenario_reporting_cancelled_invoices.rst Thu Apr 29 11:22:23
2021 +0200
@@ -91,17 +91,27 @@
>>> line.unit_price = Decimal('40')
>>> invoice.click('post')
-Compute VAT LIST report::
+Compute reports::
>>> VatList = Model.get('account.reporting.vat_list_es')
- >>> context = {
+ >>> VatBook = Model.get('account.reporting.vat_book_es')
+ >>> vat_list_context = {
... 'company': company.id,
... 'date': period.end_date,
... }
- >>> with config.set_context(context):
+ >>> with config.set_context(vat_list_context):
... vat_list_records = VatList.find([])
>>> len(vat_list_records)
1
+ >>> vat_book_context = {
+ ... 'company': company.id,
+ ... 'fiscalyear': fiscalyear.id,
+ ... 'es_vat_book_type': 'R',
+ ... }
+ >>> with config.set_context(vat_book_context):
+ ... vat_book_records = VatBook.find([])
+ >>> len(vat_book_records)
+ 1
Refund the invoice::
@@ -113,12 +123,17 @@
>>> invoice.state
'cancelled'
-VAT List is empty::
+Check reports::
- >>> with config.set_context(context):
+ >>> with config.set_context(vat_list_context):
... vat_list_records = VatList.find([])
- >>> len(vat_list_records)
- 0
+ >>> vat_list_record, = vat_list_records
+ >>> vat_list_record.amount
+ Decimal('0.0')
+ >>> with config.set_context(vat_book_context):
+ ... vat_book_records = VatBook.find([])
+ >>> len(vat_book_records)
+ 2
Create another invoice::
@@ -131,17 +146,27 @@
>>> line.quantity = 5
>>> line.unit_price = Decimal('40')
>>> invoice.click('post')
- >>> with config.set_context(context):
+ >>> with config.set_context(vat_list_context):
... vat_list_records = VatList.find([])
- >>> len(vat_list_records)
- 1
+ >>> vat_list_record, = vat_list_records
+ >>> vat_list_record.amount
+ Decimal('242.0')
+ >>> with config.set_context(vat_book_context):
+ ... vat_book_records = VatBook.find([])
+ >>> len(vat_book_records)
+ 3
-Cancel the invoice and check VAT List is empty::
+Cancel the invoice and check reports::
>>> invoice.click('cancel')
>>> invoice.state
'cancelled'
- >>> with config.set_context(context):
+ >>> with config.set_context(vat_list_context):
... vat_list_records = VatList.find([])
- >>> len(vat_list_records)
- 0
+ >>> vat_list_record, = vat_list_records
+ >>> vat_list_record.amount
+ Decimal('0.0')
+ >>> with config.set_context(vat_book_context):
+ ... vat_book_records = VatBook.find([])
+ >>> len(vat_book_records)
+ 2