From 2502b18a1f87c299d6164cb9583d736f9ad30c2f Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 15 Nov 2011 16:07:18 +0100 Subject: [PATCH] [FIX] account_anglo_saxon: fixed error due to bad commit in revision 5691: 'Variable not defined'. (shame on me) bzr revid: qdp-launchpad@openerp.com-20111115150718-elelutfa5qvm5k21 --- addons/account_anglo_saxon/purchase.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/account_anglo_saxon/purchase.py b/addons/account_anglo_saxon/purchase.py index b172fc11bbb..8e02cc361ef 100644 --- a/addons/account_anglo_saxon/purchase.py +++ b/addons/account_anglo_saxon/purchase.py @@ -28,13 +28,13 @@ class purchase_order(osv.osv): def prepare_inv_line(self, cr, uid, account_id, order_line, context=None): line = super(purchase_order, self).prepare_inv_line(cr, uid, account_id, order_line, context=context) - if ol.product_id and not ol.product_id.type == 'service': - oa = ol.product_id.property_stock_account_input and ol.product_id.property_stock_account_input.id + if order_line.product_id and not order_line.product_id.type == 'service': + acc_id = order_line.product_id.property_stock_account_input and order_line.product_id.property_stock_account_input.id if not oa: - oa = ol.product_id.categ_id.property_stock_account_input_categ and ol.product_id.categ_id.property_stock_account_input_categ.id - if oa: - fpos = ol.order_id.fiscal_position or False - a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) - line.update({'account_id': a}) + acc_id = order_line.product_id.categ_id.property_stock_account_input_categ and order_line.product_id.categ_id.property_stock_account_input_categ.id + if acc_id: + fpos = order_line.order_id.fiscal_position or False + new_account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, acc_id) + line.update({'account_id': new_account_id}) return line purchase_order()