Cleanup the dev startup logic a bit
This commit is contained in:
parent
8f937d040a
commit
27dca66a0f
|
@ -65,18 +65,31 @@ def main(page: ft.Page):
|
||||||
handler = app.get_batch_handler('pos')
|
handler = app.get_batch_handler('pos')
|
||||||
session = app.make_session()
|
session = app.make_session()
|
||||||
user = session.get(model.User, page.shared['user_uuid'])
|
user = session.get(model.User, page.shared['user_uuid'])
|
||||||
# TODO: should also filter this by terminal
|
if user:
|
||||||
batch = handler.get_current_batch(user, create=False)
|
# TODO: should also filter this by terminal
|
||||||
if batch:
|
batch = handler.get_current_batch(user, create=False)
|
||||||
page.shared['txn_display'] = batch.id_str
|
if batch:
|
||||||
page.shared['cust_uuid'] = batch.customer_uuid
|
page.shared['txn_display'] = batch.id_str
|
||||||
if batch.customer:
|
page.shared['cust_uuid'] = batch.customer_uuid
|
||||||
key = app.get_customer_key_field()
|
if batch.customer:
|
||||||
value = getattr(batch.customer, key)
|
key = app.get_customer_key_field()
|
||||||
page.shared['cust_display'] = str(value or '') or None
|
value = getattr(batch.customer, key)
|
||||||
|
page.shared['cust_display'] = str(value or '') or None
|
||||||
|
else:
|
||||||
|
page.shared['cust_display'] = None
|
||||||
else:
|
else:
|
||||||
|
page.shared['txn_display'] = None
|
||||||
|
page.shared['cust_uuid'] = None
|
||||||
page.shared['cust_display'] = None
|
page.shared['cust_display'] = None
|
||||||
|
else:
|
||||||
|
page.shared['user_uuid'] = None
|
||||||
|
page.shared['user_display'] = None
|
||||||
|
page.shared['txn_display'] = None
|
||||||
|
page.shared['cust_uuid'] = None
|
||||||
|
page.shared['cust_display'] = None
|
||||||
session.close()
|
session.close()
|
||||||
|
else:
|
||||||
|
page.shared['user_display'] = None
|
||||||
|
|
||||||
def clean_exit():
|
def clean_exit():
|
||||||
if not config.production():
|
if not config.production():
|
||||||
|
|
Loading…
Reference in a new issue