forked from brmlab/brmbar-github
brmbarv3 Receipt: New view for entering and paying receipts
This commit is contained in:
parent
9c1c8d381b
commit
b315a8359c
4 changed files with 206 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue