diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py index 8d8a6f8465a..787c13deea3 100644 --- a/addons/point_of_sale/wizard/pos_payment.py +++ b/addons/point_of_sale/wizard/pos_payment.py @@ -142,6 +142,7 @@ class pos_make_payment(osv.osv_memory): if the order is paid print invoice (if wanted) or ticket. """ order_obj = self.pool.get('pos.order') + obj_partner = self.pool.get('res.partner') if context is None: context = {} active_id = context and context.get('active_id', False) @@ -156,6 +157,9 @@ class pos_make_payment(osv.osv_memory): order_obj.add_payment(cr, uid, active_id, data, context=context) if order_obj.test_paid(cr, uid, [active_id]): + partner = obj_partner.browse(cr, uid, data['partner_id'], context=context) + if not partner.address: + raise osv.except_osv(_('Error!'),_("Partner doesn't have an address to make the invoice.")) if data['partner_id'] and data['invoice_wanted']: order_obj.action_invoice(cr, uid, [active_id], context=context) order_obj.create_picking(cr, uid, [active_id], context=context)