forked from brmlab/brmbar-github
brmbar v3 StockMgmt: New view listing inventory with edit buttons (non-functional yet)
This commit is contained in:
parent
d897edd6ed
commit
42ce11de32
3 changed files with 114 additions and 0 deletions
|
@ -23,6 +23,7 @@ class ShopAdapter(QtCore.QObject):
|
|||
def acct_inventory_map(self, acct):
|
||||
buy, sell = acct.currency.rates(currency)
|
||||
map = acct.__dict__.copy()
|
||||
map["buy_price"] = str(buy)
|
||||
map["price"] = str(sell)
|
||||
return map
|
||||
|
||||
|
@ -90,6 +91,10 @@ class ShopAdapter(QtCore.QObject):
|
|||
def userList(self):
|
||||
return [ self.acct_debt_map(a) for a in shop.account_list("debt") ]
|
||||
|
||||
@QtCore.Slot(result='QVariant')
|
||||
def itemList(self):
|
||||
return [ self.acct_inventory_map(a) for a in shop.account_list("inventory") ]
|
||||
|
||||
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