Ila Rana(Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-6014-ira into
lp:openobject-addons/6.0.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-6014-ira/+merge/63238
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-6014-ira/+merge/63238
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-6014-ira.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py 2011-05-20 10:29:05 +0000
+++ account_voucher/account_voucher.py 2011-06-02 14:02:30 +0000
@@ -705,6 +705,10 @@
line_total = line_total + currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount, context=context_multi_currency)
for line in inv.line_ids:
+ if company_currency <> current_currency:
+ final_curr=line.move_line_id.currency_id.id
+ else:
+ final_curr= current_currency
#create one move line per voucher line where amount is not 0.0
if not line.amount:
continue
@@ -712,7 +716,7 @@
if line.amount == line.amount_unreconciled:
amount = line.move_line_id.amount_residual #residual amount in company currency
else:
- amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context_multi_currency)
+ amount = currency_pool.compute(cr, uid, final_curr, company_currency, line.untax_amount or line.amount, context=context_multi_currency)
move_line = {
'journal_id': inv.journal_id.id,
'period_id': inv.period_id.id,
@@ -720,7 +724,7 @@
'account_id': line.account_id.id,
'move_id': move_id,
'partner_id': inv.partner_id.id,
- 'currency_id': company_currency <> current_currency and current_currency or False,
+ 'currency_id': final_curr,
'analytic_account_id': line.account_analytic_id and line.account_analytic_id.id or False,
'quantity': 1,
'credit': 0.0,
@@ -750,7 +754,7 @@
if not (tax_data.base_code_id and tax_data.tax_code_id):
raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to configure account base code and account tax code on the '%s' tax!") % (tax_data.name))
sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1
- move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0
+ move_line['amount_currency'] = final_curr and sign * line.amount or 0.0
voucher_line = move_line_pool.create(cr, uid, move_line)
if line.move_line_id.id:
rec_ids = [voucher_line, line.move_line_id.id]
@@ -773,8 +777,8 @@
'date': inv.date,
'credit': diff > 0 and diff or 0.0,
'debit': diff < 0 and -diff or 0.0,
- #'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0,
- #'currency_id': company_currency <> current_currency and current_currency or False,
+ 'amount_currency': final_curr and currency_pool.compute(cr, uid, final_curr, company_currency, diff * -1, context=context_multi_currency) or 0.0,
+ 'currency_id': final_curr,
}
move_line_pool.create(cr, uid, move_line)
self.write(cr, uid, [inv.id], {
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp