Commit 5cbea03a authored by Gabriel Monnerat's avatar Gabriel Monnerat

Ignore draft accounting periods (and fix a typo)

parent cde0394c
......@@ -96,18 +96,18 @@ transaction_line_list = transaction.getMovementList(\n
portal_type=transaction.getPortalAccountingMovementTypeList())\n
\n
\n
def checkAccountingPeriodRecusivly(accounting_period, transaction_date):\n
def checkAccountingPeriodRecursivly(accounting_period, transaction_date):\n
valid = accounting_period.getSimulationState() in (\'planned\', \'started\')\n
if not valid:\n
return False\n
for sub_accounting_period in accounting_period.contentValues():\n
if sub_accounting_period.getSimulationState() in (\n
\'deleted\', \'cancelled\'):\n
\'deleted\', \'cancelled\', \'draft\'):\n
continue\n
if sub_accounting_period.getStartDate().earliestTime() <= \\\n
transaction_date <= \\\n
sub_accounting_period.getStopDate().latestTime():\n
if not checkAccountingPeriodRecusivly(sub_accounting_period,\n
if not checkAccountingPeriodRecursivly(sub_accounting_period,\n
transaction_date):\n
return False\n
return True\n
......@@ -136,7 +136,7 @@ if not skip_period_validation :\n
transaction_date = transaction.getStartDate().earliestTime()\n
valid_date = False\n
if accounting_period is not None:\n
valid_date = checkAccountingPeriodRecusivly(accounting_period,\n
valid_date = checkAccountingPeriodRecursivly(accounting_period,\n
transaction_date)\n
\n
if not valid_date:\n
......@@ -166,7 +166,7 @@ if not skip_period_validation :\n
transaction_date = transaction.getStopDate().earliestTime()\n
valid_date = False\n
if accounting_period is not None:\n
valid_date = checkAccountingPeriodRecusivly(accounting_period,\n
valid_date = checkAccountingPeriodRecursivly(accounting_period,\n
transaction_date)\n
\n
if not valid_date:\n
......
1535
\ No newline at end of file
1537
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment