diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 6d68ccdf665..0fab3c30145 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -90,8 +90,7 @@ class purchase_order(osv.osv): res = {} for purchase in self.browse(cursor, user, ids, context=context): tot = 0.0 - - if purchase.invoice_id.state not in ('draft','cancel'): + if purchase.invoice_id and purchase.invoice_id.state not in ('draft','cancel'): tot += purchase.invoice_id.amount_untaxed if tot: res[purchase.id] = tot * 100.0 / purchase.amount_untaxed