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)