brmbarv3 Receipt: New view for entering and paying receipts

This commit is contained in:
Petr Baudis 2012-09-29 00:23:26 +02:00
parent 9c1c8d381b
commit b315a8359c
4 changed files with 206 additions and 4 deletions

View file

@ -138,6 +138,14 @@ class ShopAdapter(QtCore.QObject):
db.commit()
return { "dbid": acct.id, "cost": (currency.str(cost) if cost != "" else "") }
@QtCore.Slot('QVariant', 'QVariant', 'QVariant', result='QVariant')
def newReceipt(self, userid, description, amount):
if (description == "" or amount == ""):
return None
user = brmbar.Account.load(db, id = userid)
shop.receipt_to_credit(user, amount, description)
return user.negbalance_str()
db = psycopg2.connect("dbname=brmbar")
shop = brmbar.Shop.new_with_defaults(db)
currency = shop.currency