Hi again,

After fixing the Closing year widget with the code above, I needed to adapt it 
for a multi-company DB. So I add these lines of code in 
addons/account/wizard/wizard_fiscalyear_close.py to select only the account 
from the user's company and it seems to work but don't try it in a production 
DB before we're sure. Any comment or improvments ?

+++ 
/home/andre/Desktop/tinyerp-server/addons/account/wizard/wizard_fiscalyear_close.py
 2008-12-18 17:47:22.000000000 +0100
@@ -75,6 +75,11 @@
                      
          obj='account_move_line', 
context={'fiscalyear': fy_id})
                cr.execute('select 
id from account_account WHERE active')
                ids = map(lambda 
x: x[0], cr.fetchall())
+               #we give a new value to 
ids which are only the account that belong to the user company
+               user = 
pool.get('res.users').browse(cr, uid, uid)
+               ids = 
pool.get('account.account').search(cr, uid, 
[('company_id','=',user.company_id['id']),('active','=',True)])
                for account in 
pool.get('account.account').browse(cr, uid, ids,
                      
  context={'fiscalyear': fy_id}):
                      
  #print account.name


Regards

------------------------
André Kurz - www.hasa.ch - Open ERP Starter Partner
Hasa Sàrl - 1201 Genève




-------------------- m2f --------------------

--
http://www.openerp.com/forum/viewtopic.php?p=27901#27901

-------------------- m2f --------------------


_______________________________________________
Tinyerp-users mailing list
http://tiny.be/mailman/listinfo/tinyerp-users

Reply via email to