[FIX] Point_of_sale: [trunk] POS: creating invoice for partner with empty address

lp bug: https://launchpad.net/bugs/731787 fixed

bzr revid: ara@tinyerp.com-20110309134355-p62rr19fyewvq2p1
This commit is contained in:
ARA (OpenERP)
2011-03-09 19:13:55 +05:30
parent 50c25ec820
commit 96415dbeb7
@@ -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)