From 1d2295bbed2123449dc42500702eb2d64cde05a9 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Mon, 20 Dec 2010 11:40:35 +0100 Subject: [PATCH] [FIX] account: men should be allow to see only the taxes related to the current company used. This fix the problem of a product company neutral with several taxes defined (one for each existing company): previously the onchange was setting all the taxes on invoice/SO/PO/... lines instead of just the one for the current company bzr revid: qdp-launchpad@tinyerp.com-20101220104035-j5hfqylqyyqb137c --- addons/account/invoice.py | 16 +++------------- addons/account/security/account_security.xml | 2 +- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 6f39652..b6d8fcb 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -1397,30 +1397,20 @@ class account_invoice_line(osv.osv): a = res.product_tmpl_id.property_account_expense.id if not a: a = res.categ_id.property_account_expense_categ.id - a = fpos_obj.map_account(cr, uid, fpos, a) if a: result['account_id'] = a - tax_ids = tax_obj.search(cr, uid, [('company_id', '=', company_id)]) if type in ('out_invoice', 'out_refund'): - sale_taxes_def = map(lambda x: x.id, res.taxes_id) - sale_tax_ids = [tax for tax in tax_ids if tax in sale_taxes_def] - sale_taxes = tax_obj.browse(cr, uid, sale_tax_ids) - sale_taxes_all = sale_taxes and sale_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) - tax_id = fpos_obj.map_tax(cr, uid, fpos, sale_taxes_all) + taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False) else: - pur_taxes_def = map(lambda x: x.id, res.supplier_taxes_id) - pur_tax_ids = [tax for tax in tax_ids if tax in pur_taxes_def] - pur_taxes = tax_obj.browse(cr, uid, pur_tax_ids) - pur_taxes_all = pur_taxes and pur_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) - tax_id = fpos_obj.map_tax(cr, uid, fpos, pur_taxes_all) + taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False) + tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes) if type in ('in_invoice', 'in_refund'): result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} ) else: result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id}) -# if not name: result['name'] = res.partner_ref domain = {} diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml index 347a82e..5f42927 100644 --- a/addons/account/security/account_security.xml +++ b/addons/account/security/account_security.xml @@ -79,7 +79,7 @@ Tax multi-company - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + ['|',('company_id','=',False),('company_id','=',user.company_id.id)] -- 1.7.10.4