raise a Warning if funds in wallet are insufficient for label

This commit is contained in:
Harald Welte 2017-01-10 15:26:50 +01:00
parent 6403eb7151
commit 6738c68324
1 changed files with 2 additions and 0 deletions

View File

@ -123,6 +123,8 @@ class DPDeliveryCarrier(models.Model):
im.clear_positions()
position = im.build_position(service.code, im_sender, im_recipient)
im.add_position(position)
if im.wallet_balance < im.compute_total():
raise Warning("Wallet balance %f is less than label cost %f!" % (im.wallet_balance/100, im.compute_total()/100)
r = im.checkoutPNG()
voucher = r.shoppingCart.voucherList.voucher[0]
filename = 'DP'+voucher.voucherId+'.png'