Merge lp:~openerp-dev/openobject-addons/trunk-opw-576210-port-mma into lp:openobject-addons

Proposed by Mayur Maheshwari(OpenERP)
Status: Merged
Merged at revision: 8001
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-opw-576210-port-mma
Merge into: lp:openobject-addons
Diff against target: 14 lines (+2/-1)
1 file modified
account/wizard/account_fiscalyear_close.py (+2/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-opw-576210-port-mma
Reviewer Review Type Date Requested Status
Fabien (Open ERP) Disapprove
Review via email: mp+132490@code.launchpad.net

Description of the change

Hello,

If you pay foreign currency invoices with foreign currency, it will generate debit and credit entry with amount 0.0. Due to this, Generate Opening Entries" wizard generates credit and debit entries with amount 0.0 at the time of balance transfer before closing the year.

   This fixes the issue.
   Code is forward port from 6.1

Thanks,
Mayur

To post a comment you must log in.
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

The fix was not clean, I had to do this:

=== modified file 'account/wizard/account_fiscalyear_close.py'
--- account/wizard/account_fiscalyear_close.py 2012-08-07 11:34:14 +0000
+++ account/wizard/account_fiscalyear_close.py 2012-11-12 08:48:12 +0000
@@ -226,7 +226,7 @@
         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(amount_currency) as balance_in_currency FROM account_move_line ' \
+ 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))

I merged the clean fix.

review: Disapprove
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

It's not bad to have debit=credit=0.0

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/wizard/account_fiscalyear_close.py'
2--- account/wizard/account_fiscalyear_close.py 2012-08-07 11:34:14 +0000
3+++ account/wizard/account_fiscalyear_close.py 2012-11-01 10:00:41 +0000
4@@ -226,8 +226,9 @@
5 for account in obj_acc_account.browse(cr, uid, account_ids, context={'fiscalyear': fy_id}):
6 balance_in_currency = 0.0
7 if account.currency_id:
8- cr.execute('SELECT sum(amount_currency) as balance_in_currency FROM account_move_line ' \
9+ cr.execute('SELECT COALESCE(sum(amount_currency),0.0) as balance_in_currency FROM account_move_line ' \
10 'WHERE account_id = %s ' \
11+ 'AND (debit <> 0.0 and credit <> 0.0) ' \
12 'AND ' + query_line + ' ' \
13 'AND currency_id = %s', (account.id, account.currency_id.id))
14 balance_in_currency = cr.dictfetchone()['balance_in_currency']

Subscribers

People subscribed via source and target branches

to all changes: