[FIX] account: bank statement reconciliation widget: correct multicurrency display
This commit is contained in:
parent
76080efdbc
commit
43f29b2b13
|
@ -799,51 +799,45 @@ class account_move_line(osv.osv):
|
||||||
# Amount residual can be negative
|
# Amount residual can be negative
|
||||||
debit = line.debit
|
debit = line.debit
|
||||||
credit = line.credit
|
credit = line.credit
|
||||||
total_amount = abs(debit - credit)
|
amount = line.amount_residual
|
||||||
total_amount_currency = line.amount_currency
|
amount_currency = line.amount_residual_currency
|
||||||
amount_residual = line.amount_residual
|
|
||||||
amount_residual_currency = line.amount_residual_currency
|
|
||||||
if line.amount_residual < 0:
|
if line.amount_residual < 0:
|
||||||
debit, credit = credit, debit
|
debit, credit = credit, debit
|
||||||
amount_residual = -amount_residual
|
amount = -amount
|
||||||
amount_residual_currency = -amount_residual_currency
|
amount_currency = -amount_currency
|
||||||
|
|
||||||
# Get right debit / credit:
|
# Get right debit / credit:
|
||||||
|
target_currency = target_currency or company_currency
|
||||||
line_currency = line.currency_id or company_currency
|
line_currency = line.currency_id or company_currency
|
||||||
amount_currency_str = ""
|
amount_currency_str = ""
|
||||||
total_amount_currency_str = ""
|
total_amount_currency_str = ""
|
||||||
if line.currency_id and line.amount_currency:
|
if line_currency != company_currency:
|
||||||
amount_currency_str = rml_parser.formatLang(amount_residual_currency, currency_obj=line.currency_id)
|
total_amount = line.amount_currency
|
||||||
total_amount_currency_str = rml_parser.formatLang(total_amount_currency, currency_obj=line.currency_id)
|
actual_debit = debit > 0 and amount_currency or 0.0
|
||||||
if target_currency and line_currency == target_currency and target_currency != company_currency:
|
actual_credit = credit > 0 and amount_currency or 0.0
|
||||||
debit = debit > 0 and amount_residual_currency or 0.0
|
|
||||||
credit = credit > 0 and amount_residual_currency or 0.0
|
|
||||||
amount_currency_str = rml_parser.formatLang(amount_residual, currency_obj=company_currency)
|
|
||||||
total_amount_currency_str = rml_parser.formatLang(total_amount, currency_obj=company_currency)
|
|
||||||
amount_str = rml_parser.formatLang(debit or credit, currency_obj=target_currency)
|
|
||||||
total_amount_str = rml_parser.formatLang(total_amount_currency, currency_obj=target_currency)
|
|
||||||
else:
|
else:
|
||||||
debit = debit > 0 and amount_residual or 0.0
|
total_amount = abs(debit - credit)
|
||||||
credit = credit > 0 and amount_residual or 0.0
|
actual_debit = debit > 0 and amount or 0.0
|
||||||
amount_str = rml_parser.formatLang(debit or credit, currency_obj=company_currency)
|
actual_credit = credit > 0 and amount or 0.0
|
||||||
total_amount_str = rml_parser.formatLang(total_amount, currency_obj=company_currency)
|
if line_currency != target_currency:
|
||||||
if target_currency and target_currency != company_currency:
|
amount_currency_str = rml_parser.formatLang(actual_debit or actual_credit, currency_obj=line_currency)
|
||||||
amount_currency_str = rml_parser.formatLang(debit or credit, currency_obj=line_currency)
|
|
||||||
total_amount_currency_str = rml_parser.formatLang(total_amount, currency_obj=line_currency)
|
total_amount_currency_str = rml_parser.formatLang(total_amount, currency_obj=line_currency)
|
||||||
|
ret_line['credit_currency'] = actual_credit
|
||||||
|
ret_line['debit_currency'] = actual_debit
|
||||||
ctx = context.copy()
|
ctx = context.copy()
|
||||||
if target_date:
|
if target_date:
|
||||||
ctx.update({'date': target_date})
|
ctx.update({'date': target_date})
|
||||||
debit = currency_obj.compute(cr, uid, company_currency.id, target_currency.id, debit, context=ctx)
|
total_amount = currency_obj.compute(cr, uid, line_currency.id, target_currency.id, total_amount, context=ctx)
|
||||||
credit = currency_obj.compute(cr, uid, company_currency.id, target_currency.id, credit, context=ctx)
|
actual_debit = currency_obj.compute(cr, uid, line_currency.id, target_currency.id, actual_debit, context=ctx)
|
||||||
amount_str = rml_parser.formatLang(debit or credit, currency_obj=target_currency)
|
actual_credit = currency_obj.compute(cr, uid, line_currency.id, target_currency.id, actual_credit, context=ctx)
|
||||||
total_amount = currency_obj.compute(cr, uid, company_currency.id, target_currency.id, total_amount, context=ctx)
|
amount_str = rml_parser.formatLang(actual_debit or actual_credit, currency_obj=target_currency)
|
||||||
total_amount_str = rml_parser.formatLang(total_amount, currency_obj=target_currency)
|
total_amount_str = rml_parser.formatLang(total_amount, currency_obj=target_currency)
|
||||||
|
|
||||||
ret_line['credit'] = credit
|
ret_line['debit'] = actual_debit
|
||||||
ret_line['debit'] = debit
|
ret_line['credit'] = actual_credit
|
||||||
ret_line['amount_str'] = amount_str
|
ret_line['amount_str'] = amount_str
|
||||||
|
ret_line['total_amount_str'] = total_amount_str
|
||||||
ret_line['amount_currency_str'] = amount_currency_str
|
ret_line['amount_currency_str'] = amount_currency_str
|
||||||
ret_line['total_amount_str'] = total_amount_str # For partial reconciliations
|
|
||||||
ret_line['total_amount_currency_str'] = total_amount_currency_str
|
ret_line['total_amount_currency_str'] = total_amount_currency_str
|
||||||
ret.append(ret_line)
|
ret.append(ret_line)
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Reference in New Issue