mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 13:24:01 +02:00
brmbar-cli: Add support for adduser action
This commit is contained in:
parent
bacb9b1791
commit
13bc4d6f60
2 changed files with 8 additions and 0 deletions
|
@ -4,6 +4,7 @@ CREATE TABLE currencies (
|
||||||
name VARCHAR(128) NOT NULL,
|
name VARCHAR(128) NOT NULL,
|
||||||
UNIQUE(name)
|
UNIQUE(name)
|
||||||
);
|
);
|
||||||
|
-- Some code depends on the primary physical currency to have id 1.
|
||||||
INSERT INTO currencies (name) VALUES ('Kč');
|
INSERT INTO currencies (name) VALUES ('Kč');
|
||||||
|
|
||||||
CREATE TYPE exchange_rate_direction AS ENUM ('source_to_target', 'target_to_source');
|
CREATE TYPE exchange_rate_direction AS ENUM ('source_to_target', 'target_to_source');
|
||||||
|
|
|
@ -28,6 +28,8 @@ Usage: brmbar-cli.py COMMAND ARGS...
|
||||||
stats
|
stats
|
||||||
A set of various balances as shown in the Management
|
A set of various balances as shown in the Management
|
||||||
screen of the GUI.
|
screen of the GUI.
|
||||||
|
adduser USER
|
||||||
|
Add user (debt) account with given username.
|
||||||
! changestock ITEM1 +-AMT_ITEM1 ITEM2 +-AMT_ITEM2 ...
|
! changestock ITEM1 +-AMT_ITEM1 ITEM2 +-AMT_ITEM2 ...
|
||||||
Create a custom transaction that will change balance
|
Create a custom transaction that will change balance
|
||||||
of a variety of items at once, and either deduce
|
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("Credit: {}".format(shop.credit_negbalance_str()))
|
||||||
print("Inventory: {}".format(shop.inventory_balance_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:
|
else:
|
||||||
help()
|
help()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue