From 4bfa2880b1673f1d09e88b823ab9a87618dd03d5 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Fri, 11 Nov 2011 11:10:21 +0530 Subject: [PATCH] [IMP]:improve code and remove the loop for invoice bzr revid: ksa@tinyerp.com-20111111054021-b2sv5f6jegyjs403 --- addons/sale/stock.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 4b683dcb97b..788d5099fc5 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -142,9 +142,8 @@ class stock_picking(osv.osv): invoice_created = invoices[result[picking.id]] invoice_obj.write(cursor, user, [invoice_created.id], {'user_id': picking.sale_id and picking.sale_id.user_id and picking.sale_id.user_id.id or False}, context=context) - for inv in invoice_obj.browse(cursor, user, [invoice_created.id], context=context): - if not inv.fiscal_position: - invoice_obj.write(cursor, user, [inv.id], {'fiscal_position': picking.sale_id.fiscal_position.id}, context=context) + if not invoice_created.fiscal_position: + invoice_obj.write(cursor, user, [invoice_created.id], {'fiscal_position': picking.sale_id.fiscal_position.id}, context=context) if picking.sale_id.client_order_ref: inv_name = picking.sale_id.client_order_ref + " : " + invoice_created.name invoice_obj.write(cursor, user, [invoice_created.id], {'name': inv_name}, context=context)