[FIX] account, fiscalyear close wizard: fix related to multi company

bzr revid: qdp-launchpad@openerp.com-20120209161641-4o6pk6nw1gupjrt7
This commit is contained in:
Quentin (OpenERP) 2012-02-09 17:16:41 +01:00
parent 934954d63a
commit ef08879085
1 changed files with 7 additions and 3 deletions

View File

@ -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 = """