[FIX] use only current company to choose a default account_id for a non-product invoi...
authorLeonardo Pistone <leonardo.pistone@domsense.com>
Wed, 18 May 2011 10:03:56 +0000 (12:03 +0200)
committerLeonardo Pistone <leonardo.pistone@domsense.com>
Wed, 18 May 2011 10:03:56 +0000 (12:03 +0200)
lp bug: https://launchpad.net/bugs/784499 fixed

bzr revid: leonardo.pistone@domsense.com-20110518100356-cs9gwtn663w85bpa

addons/account_invoice_layout/account_invoice_layout.py

index 3337710..1690ac4 100644 (file)
@@ -165,7 +165,8 @@ class account_invoice_line(osv.osv):
     }
 
     def _default_account(self, cr, uid, context=None):
-        cr.execute("select id from account_account where parent_id IS NULL LIMIT 1")
+        current_company = self.pool.get('res.users').browse(cr,uid,uid).company_id.id
+        cr.execute("select id from account_account where company_id = %s and parent_id IS NULL LIMIT 1", [current_company])
         res = cr.fetchone()
         return res[0]