From 8666a526152cd2033ca2c11d74d64bfe7b07bd2c Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Wed, 18 May 2011 12:03:56 +0200 Subject: [PATCH] [FIX] use only current company to choose a default account_id for a non-product invoice line lp bug: https://launchpad.net/bugs/784499 fixed bzr revid: leonardo.pistone@domsense.com-20110518100356-cs9gwtn663w85bpa --- addons/account_invoice_layout/account_invoice_layout.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account_invoice_layout/account_invoice_layout.py b/addons/account_invoice_layout/account_invoice_layout.py index 3337710420f..1690ac4319e 100644 --- a/addons/account_invoice_layout/account_invoice_layout.py +++ b/addons/account_invoice_layout/account_invoice_layout.py @@ -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]