Commit 9b43b904 authored by Jérome Perrin's avatar Jérome Perrin

fixes account balance calculation in some case

- we only want to sum transaction in the period when there is a from date.
- when from date is passed, really get period start date from from date
parent cc349e74
...@@ -109,11 +109,14 @@ if section_category:\n ...@@ -109,11 +109,14 @@ if section_category:\n
# calculate the period_start_date for this section\n # calculate the period_start_date for this section\n
# note that reports that precalculate a section_uid but no section_category\n # note that reports that precalculate a section_uid but no section_category\n
# will have to calculate period_start_date themselves.\n # will have to calculate period_start_date themselves.\n
if from_date or at_date:\n period_start_date = selection_params.get(\'period_start_date\')\n
params[\'period_start_date\'] = \\\n if not period_start_date and (from_date or at_date):\n
period_start_date = \\\n
context.Base_getAccountingPeriodStartDateForSectionCategory(\n context.Base_getAccountingPeriodStartDateForSectionCategory(\n
section_category=section_category, date=from_date or at_date)\n section_category=section_category, date=from_date or at_date)\n
\n if period_start_date:\n
params[\'period_start_date\'] = period_start_date\n
\n
# if we have a section uid, it haves priority\n # if we have a section uid, it haves priority\n
section_uid = selection_params.get(\'section_uid\', None)\n section_uid = selection_params.get(\'section_uid\', None)\n
if section_uid:\n if section_uid:\n
......
...@@ -137,7 +137,7 @@ if period_start_date and params.get(\'node_uid\'):\n ...@@ -137,7 +137,7 @@ if period_start_date and params.get(\'node_uid\'):\n
# if we are in the regular user interface, we only limit\n # if we are in the regular user interface, we only limit\n
if \'from_date\' in kw:\n if \'from_date\' in kw:\n
params[\'from_date\'] = min(kw[\'from_date\'], period_start_date)\n params[\'from_date\'] = min(kw[\'from_date\'], period_start_date)\n
else:\n elif kw.get(\'from_date\'):\n
# for other account, we calculate the initial balance as the "absolute"\n # for other account, we calculate the initial balance as the "absolute"\n
# balance at the beginning of the period, plus debit or credit from this\n # balance at the beginning of the period, plus debit or credit from this\n
# beginning of period to the from_date\n # beginning of period to the from_date\n
......
1562 1563
\ No newline at end of file \ 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