Issue 9977

Title
Test fails when executed on 31/12
Priority
bug
Status
chatting
Nosy list
albertca, ced
Assigned to
Keywords

Created on 2020-12-31.12:07:32 by albertca, last changed 2 weeks ago by ced.

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-01-01.22:12:15
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-12-31.16:06:44

I think the best would be to call create_fiscalyear with today=tomorrow but for that create_fiscalyear should take care to check if there is not yet a fiscalyear covering the date.

Author: [hidden] (albertca) Tryton committer
Date: 2020-12-31.12:07:32

If the test of commission module is executed today (31/12/2020) the scenario will crash because there's no period created for tomorrow:

https://hg.tryton.org/modules/commission/file/tip/tests/scenario_commission.rst#l177

I'm not sure what's the best/easiest way to solve this.

Here's the backtrace:

Traceback (most recent call last):
File "/usr/lib/python3.7/doctest.py", line 2196, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for scenario_commission.rst
File "/tryton/trytond/trytond/modules/commission/tests/scenario_commission.rst", line 0

----------------------------------------------------------------------
File "/tryton/trytond/trytond/modules/commission/tests/scenario_commission.rst", line 178, in scenario_commission.rst
Failed example:
pay.execute('choice')
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python3.7/doctest.py", line 1329, in __run
compileflags, 1), test.globs)
File "", line 1, in
pay.execute('choice')
File "/tryton/proteus/proteus/__init__.py", line 1234, in execute
ctx)
File "/tryton/proteus/proteus/config.py", line 188, in __call__
result = rpc.result(meth(*args, **kwargs))
File "/tryton/trytond/trytond/wizard/wizard.py", line 314, in execute
return wizard._execute(state_name)
File "/tryton/trytond/trytond/wizard/wizard.py", line 345, in _execute
result = self._execute(transition())
File "/tryton/trytond/trytond/wizard/wizard.py", line 345, in _execute
result = self._execute(transition())
File "/tryton/trytond/trytond/modules/account_invoice/invoice.py", line 2892, in transition_pay
second_currency, overpayment)
File "/tryton/trytond/trytond/modules/account_invoice/invoice.py", line 1303, in pay_invoice
period_id = Period.find(self.company.id, date=date)
File "/tryton/trytond/trytond/modules/account/period.py", line 188, in find
date=lang.strftime(date)))
trytond.modules.account.exceptions.PeriodNotFoundError: To continue, you must create a period for the date "01/01/2021". - 
History
Date User Action Args
2021-01-01 22:12:15cedsetcomponent: + account_payment_clearing
messages: + msg63728
2020-12-31 16:06:44cedsetmessages: + msg63727
nosy: + ced
status: unread -> chatting
2020-12-31 12:07:32albertcacreate

Showing 10 items. Show all history (warning: this could be VERY long)