Fixed a date bug and added amounts in currency...

This commit is contained in:
Loïc Faure-Lacroix
2015-03-30 21:41:02 +03:00
committed by Joao Alfredo Gama Batista
parent 7610705120
commit 2ccfbb82dc
2 changed files with 40 additions and 2 deletions

View File

@@ -611,11 +611,18 @@ class bank_acc_rec_statement(orm.Model):
dt_ending = datetime.strptime(
ending_date, DEFAULT_SERVER_DATE_FORMAT,
) + timedelta(days=-1)
if dt_ending.month == 1:
dt_ending = dt_ending.replace(year=dt_ending.year - 1,
month=12)
else:
dt_ending = dt_ending.replace(month=dt_ending.month - 1)
prev_month = (dt_ending.replace(day=1) - timedelta(days=1))
if dt_ending.day <= prev_month.day:
dt_ending = dt_ending.replace(month=dt_ending.month - 1)
else:
dt_ending = prev_month
val['value']['exchange_date'] = dt_ending.strftime(
DEFAULT_SERVER_DATE_FORMAT)

View File

@@ -62,7 +62,7 @@
<table style="width:100%">
<tr>
<td class="cell left_col first_item important_number_table"
colspan="2">
colspan="3">
${_("Summary account:")} ${rec.account_id.code} -
${rec.account_id.name}
</td>
@@ -71,6 +71,9 @@
<td class="left_col cell">
${_("Beginning Balance")}
</td>
<td class="cell right_col_sum">
${formatLang(rec.starting_balance_in_currency, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell right_col_sum">
${formatLang(rec.starting_balance, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
@@ -81,11 +84,16 @@
</td>
<td class="cell right_col_sum">
</td>
<td class="cell right_col_sum">
</td>
</tr>
<tr>
<td class="cell third_line left_col">
${_("Deposits and Credits")}${" - %s " % int(rec.sum_of_debits_lines)}${_("items")}
</td>
<td class="cell right_col_sum">
${formatLang(rec.sum_of_debits_in_currency, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell right_col_sum">
${formatLang(rec.sum_of_debits, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
@@ -94,6 +102,9 @@
<td class="cell third_line left_col">
${_("Cheques and Debits")}${" - %s " % int(rec.sum_of_credits_lines)}${_("items")}
</td>
<td class="cell line_sum right_col_sum">
${formatLang(-rec.sum_of_credits_in_currency, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell line_sum right_col_sum">
${formatLang(-rec.sum_of_credits, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
@@ -102,6 +113,9 @@
<td class="cell second_line left_col">
${_("Total Cleared Transactions")}
</td>
<td class="cell right_col_sum line_sum">
${formatLang(rec.cleared_balance_in_currency, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell right_col_sum line_sum">
${formatLang(rec.cleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
@@ -110,6 +124,9 @@
<td class="cell left_col">
${_("Cleared Balance")}
</td>
<td class="cell important_number_table right_col_sum">
${formatLang(rec.cleared_balance_in_currency + rec.starting_balance_in_currency, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell important_number_table right_col_sum">
${formatLang(rec.cleared_balance + rec.starting_balance, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
@@ -120,11 +137,16 @@
</td>
<td class="cell right_col_sum">
</td>
<td class="cell right_col_sum">
</td>
</tr>
<tr>
<td class="cell third_line left_col">
${_("Deposits and Credits")}${" - %s " % int(rec.sum_of_debits_lines_unclear)}${_("items")}
</td>
<td class="cell right_col_sum">
${formatLang(rec.sum_of_debits_unclear_in_currency, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell right_col_sum">
${formatLang(rec.sum_of_debits_unclear, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
@@ -133,6 +155,9 @@
<td class="cell third_line left_col">
${_("Cheques and Debits")}${" - %s " % int(rec.sum_of_credits_lines_unclear)}${_("items")}
</td>
<td class="cell right_col_sum line_sum">
${formatLang(-rec.sum_of_credits_unclear_in_currency, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell right_col_sum line_sum">
${formatLang(-rec.sum_of_credits_unclear, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
@@ -141,6 +166,9 @@
<td class="cell second_line left_col">
${_("Total Uncleared Transactions")}
</td>
<td class="cell right_col_sum line_sum">
${formatLang(rec.uncleared_balance_in_currency, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell right_col_sum line_sum">
${formatLang(rec.uncleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
@@ -149,6 +177,9 @@
<td class="cell left_col">
${_("Register Balance as of")}${" %s" % formatLang(rec.ending_date, date=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell important_number_table right_col_sum">
${formatLang(rec.starting_balance_in_currency + rec.cleared_balance_in_currency + rec.uncleared_balance_in_currency, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>
<td class="cell important_number_table right_col_sum">
${formatLang(rec.starting_balance + rec.cleared_balance + rec.uncleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)}
</td>