mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 13:24:01 +02:00
Search functionality added to Stock Management.
This commit is contained in:
parent
fb6eadf031
commit
ba4d8686f6
3 changed files with 94 additions and 9 deletions
|
@ -131,10 +131,11 @@ class Shop:
|
|||
def inventory_balance_str(self):
|
||||
return self.currency.str(self.inventory_balance())
|
||||
|
||||
def account_list(self, acctype):
|
||||
def account_list(self, acctype, like_str="%%"):
|
||||
"""list all accounts (people or items, as per acctype)"""
|
||||
accts = []
|
||||
cur = self.db.execute_and_fetchall("SELECT id FROM accounts WHERE acctype = %s ORDER BY name ASC", [acctype])
|
||||
cur = self.db.execute_and_fetchall("SELECT id FROM accounts WHERE acctype = %s AND name ILIKE %s ORDER BY name ASC", [acctype, like_str])
|
||||
#FIXME: sanitize input like_str ^
|
||||
for inventory in cur:
|
||||
accts += [ Account.load(self.db, id = inventory[0]) ]
|
||||
return accts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue