Fix bug and test.

This commit is contained in:
Bernat Brunet 2023-12-13 15:20:17 +01:00
parent c1f90e09d1
commit 3d01d6a8ef
2 changed files with 8 additions and 2 deletions

View File

@ -74,6 +74,8 @@ class Invoice(metaclass=PoolMeta):
moves.append(invoice.cancel_move)
invoice.cancel_move = None
invoice.additional_moves += tuple(moves)
invoice.invoice_report_format = None
invoice.invoice_report_cache = None
# Only make the special steps for the invoices that came from 'posted'
# state or 'validated', 'cancelled' with number, so the invoice have one

View File

@ -16,6 +16,8 @@ Imports::
... create_chart, get_accounts
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences, create_payment_term
>>> from trytond.modules.account.exceptions import CancelWarning
>>> today = datetime.date.today()
Install account_invoice_posted2draft::
@ -108,7 +110,9 @@ Move it back to draft::
>>> invoice.invoice_report_cache
>>> receivable.reload()
>>> receivable.debit
Decimal('0.00')
Decimal('200.00')
>>> receivable.credit
Decimal('200.00')
Invoices can not be set to draft if period is closed::
@ -117,4 +121,4 @@ Invoices can not be set to draft if period is closed::
>>> invoice.click('draft') # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
UserError: ...
CancelWarning: ...