From ef08879085f2df2d66b3dcfef67dccbaf1875e41 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 9 Feb 2012 17:16:41 +0100 Subject: [PATCH] [FIX] account, fiscalyear close wizard: fix related to multi company bzr revid: qdp-launchpad@openerp.com-20120209161641-4o6pk6nw1gupjrt7 --- addons/account/wizard/account_fiscalyear_close.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py index 849a7a9f514..15182565aa5 100644 --- a/addons/account/wizard/account_fiscalyear_close.py +++ b/addons/account/wizard/account_fiscalyear_close.py @@ -78,6 +78,7 @@ class account_fiscalyear_close(osv.osv_memory): new_journal = data[0].journal_id.id new_journal = obj_acc_journal.browse(cr, uid, new_journal, context=context) + company_id = new_journal.company_id.id if not new_journal.default_credit_account_id or not new_journal.default_debit_account_id: raise osv.except_osv(_('UserError'), @@ -117,7 +118,8 @@ class account_fiscalyear_close(osv.osv_memory): LEFT JOIN account_account_type t ON (a.user_type = t.id) WHERE a.active AND a.type != 'view' - AND t.close_method = %s''', ('unreconciled', )) + AND a.company_id = %s + AND t.close_method = %s''', (company_id, 'unreconciled', )) account_ids = map(lambda x: x[0], cr.fetchall()) if account_ids: cr.execute(''' @@ -166,7 +168,8 @@ class account_fiscalyear_close(osv.osv_memory): LEFT JOIN account_account_type t ON (a.user_type = t.id) WHERE a.active AND a.type != 'view' - AND t.close_method = %s''', ('detail', )) + AND a.company_id = %s + AND t.close_method = %s''', (company_id, 'detail', )) account_ids = map(lambda x: x[0], cr.fetchall()) if account_ids: @@ -194,7 +197,8 @@ class account_fiscalyear_close(osv.osv_memory): LEFT JOIN account_account_type t ON (a.user_type = t.id) WHERE a.active AND a.type != 'view' - AND t.close_method = %s''', ('balance', )) + AND a.company_id = %s + AND t.close_method = %s''', (company_id, 'balance', )) account_ids = map(lambda x: x[0], cr.fetchall()) query_1st_part = """