[FIX] multi currency reconciliations on bank statements weren't properly displayed
[FIX] multi currency payments weren't correctly computed on invoice's residual amount bzr revid: qdp@cyan-20090907164012-eufzzqls4gqlkbv6
This commit is contained in:
parent
f6566b12b5
commit
c0adc624b5
|
@ -213,6 +213,11 @@ class account_bank_statement(osv.osv):
|
|||
amount = res_currency_obj.compute(cr, uid, st.currency.id,
|
||||
company_currency_id, move.amount, context=context,
|
||||
account=acc_cur)
|
||||
if st.currency.id <> company_currency_id:
|
||||
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
|
||||
st.currency.id, amount, context=context,
|
||||
account=acc_cur)
|
||||
val['amount_currency'] = -amount_cur
|
||||
|
||||
if move.account_id and move.account_id.currency_id and move.account_id.currency_id.id <> company_currency_id:
|
||||
val['currency_id'] = move.account_id.currency_id.id
|
||||
|
@ -430,7 +435,17 @@ class account_bank_statement_reconcile(osv.osv):
|
|||
def name_get(self, cursor, user, ids, context=None):
|
||||
res= []
|
||||
for o in self.browse(cursor, user, ids, context=context):
|
||||
res.append((o.id, '[%.2f]' % (o.total_entry - o.total_new,)))
|
||||
result = 0.0
|
||||
res_currency = ''
|
||||
for line in o.line_ids:
|
||||
if line.amount_currency and line.currency_id:
|
||||
result += line.amount_currency
|
||||
res_currency = line.currency_id.code
|
||||
else:
|
||||
result += line.debit - line.credit
|
||||
if res_currency:
|
||||
res_currency = ' ' + res_currency
|
||||
res.append((o.id, '[%.2f'% (result - o.total_new,) + res_currency + ']' ))
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
|
|
|
@ -221,6 +221,8 @@
|
|||
<field name="journal_id"/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="currency_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
@ -306,6 +308,8 @@
|
|||
<field name="journal_id" groups="base.group_user"/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="currency_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
|
|
@ -107,7 +107,10 @@ class account_invoice(osv.osv):
|
|||
paid_amt = 0.0
|
||||
to_pay = inv.amount_total
|
||||
for lines in inv.move_lines:
|
||||
paid_amt = paid_amt - lines.credit + lines.debit
|
||||
if lines.amount_currency and lines.currency_id:
|
||||
paid_amt += lines.amount_currency
|
||||
else:
|
||||
paid_amt += lines.credit + lines.debit
|
||||
res[inv.id] = round(to_pay - abs(paid_amt),int(config['price_accuracy']))
|
||||
return res
|
||||
|
||||
|
|
Loading…
Reference in New Issue