[MERGE] [FIX] account: fixed amount in foreign currency for opening entries

When generating fiscal year opening entries, if the account uses a different currency, the amount_currency should contains only the entries of the current year and not the previous one. Courtesy of Matthieu Dietrich (camptocamp)

bzr revid: mat@openerp.com-20140113132209-jpva50a714xfxx30
This commit is contained in:
Martin Trigaux 2014-01-13 14:22:09 +01:00
commit 892f1d5fe5
1 changed files with 1 additions and 9 deletions

View File

@ -224,14 +224,6 @@ class account_fiscalyear_close(osv.osv_memory):
query_2nd_part = ""
query_2nd_part_args = []
for account in obj_acc_account.browse(cr, uid, account_ids, context={'fiscalyear': fy_id}):
balance_in_currency = 0.0
if account.currency_id:
cr.execute('SELECT sum(COALESCE(amount_currency,0.0)) as balance_in_currency FROM account_move_line ' \
'WHERE account_id = %s ' \
'AND ' + query_line + ' ' \
'AND currency_id = %s', (account.id, account.currency_id.id))
balance_in_currency = cr.dictfetchone()['balance_in_currency']
company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id
if not currency_obj.is_zero(cr, uid, company_currency_id, abs(account.balance)):
if query_2nd_part:
@ -246,7 +238,7 @@ class account_fiscalyear_close(osv.osv_memory):
period.id,
account.id,
account.currency_id and account.currency_id.id or None,
balance_in_currency,
account.foreign_balance if account.currency_id else 0.0,
account.company_id.id,
'draft')
if query_2nd_part: