From 3954affc302143e98c98b2cc334c42d803f72847 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 9 May 2016 17:35:18 +0200 Subject: [PATCH] [FIX] account_anglo_saxon: default account value The default account value set for purchases invoices lines for product of type Service was wrong: It used the stock account, which is wrong as a Service as no stock. Instead, it should left the product expense account, as usual. opw-676110 --- addons/account_anglo_saxon/invoice.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py index a330210b456..acd7ec998eb 100644 --- a/addons/account_anglo_saxon/invoice.py +++ b/addons/account_anglo_saxon/invoice.py @@ -50,13 +50,14 @@ class account_invoice_line(osv.osv): return res if type in ('in_invoice','in_refund'): product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context) - oa = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id - if not oa: - oa = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id - if oa: - fpos = fposition_id and fiscal_pool.browse(cr, uid, fposition_id, context=context) or False - a = fiscal_pool.map_account(cr, uid, fpos, oa) - res['value'].update({'account_id':a}) + if product_obj.type in ('consu', 'product'): + oa = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id + if not oa: + oa = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id + if oa: + fpos = fposition_id and fiscal_pool.browse(cr, uid, fposition_id, context=context) or False + a = fiscal_pool.map_account(cr, uid, fpos, oa) + res['value'].update({'account_id':a}) return res def _get_price(self, cr, uid, inv, company_currency, i_line, price_unit):