diff --git a/brmbar3/SQL b/brmbar3/SQL index 2865c02..1d1d32f 100644 --- a/brmbar3/SQL +++ b/brmbar3/SQL @@ -4,6 +4,7 @@ CREATE TABLE currencies ( name VARCHAR(128) NOT NULL, UNIQUE(name) ); +-- Some code depends on the primary physical currency to have id 1. INSERT INTO currencies (name) VALUES ('Kč'); CREATE TYPE exchange_rate_direction AS ENUM ('source_to_target', 'target_to_source'); diff --git a/brmbar3/brmbar-cli.py b/brmbar3/brmbar-cli.py index df6b078..b6c94dd 100755 --- a/brmbar3/brmbar-cli.py +++ b/brmbar3/brmbar-cli.py @@ -28,6 +28,8 @@ Usage: brmbar-cli.py COMMAND ARGS... stats A set of various balances as shown in the Management screen of the GUI. + adduser USER + Add user (debt) account with given username. ! changestock ITEM1 +-AMT_ITEM1 ITEM2 +-AMT_ITEM2 ... Create a custom transaction that will change balance of a variety of items at once, and either deduce @@ -147,5 +149,10 @@ elif sys.argv[1] == "stats": print("Credit: {}".format(shop.credit_negbalance_str())) print("Inventory: {}".format(shop.inventory_balance_str())) +elif sys.argv[1] == "adduser": + acct = brmbar.Account.create(db, sys.argv[2], brmbar.Currency.load(db, id = 1), 'debt') + acct.add_barcode(sys.argv[2]) # will commit + print("{}: id {}".format(acct.name, acct.id)); + else: help()