|
@@ -5,6 +5,8 @@
|
|
|
#
|
|
|
# THIS SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTY
|
|
|
import itertools
|
|
|
+from dateutil.parser import parse as parse_time
|
|
|
+from dateutil.parser._parser import ParserError
|
|
|
from decimal import Decimal, InvalidOperation
|
|
|
from itertools import chain
|
|
|
from typing import Callable, Union
|
|
@@ -108,6 +110,10 @@ class TransactionEditor(FocusWidget):
|
|
|
def update(self):
|
|
|
data = self.data
|
|
|
date, store = data['ts'], data['store']
|
|
|
+ try:
|
|
|
+ parse_time(date)
|
|
|
+ except ParserError:
|
|
|
+ date = None
|
|
|
self.text_fields['dbview'].set_text(
|
|
|
self.query_manager.get_session_transactions(date, store) if None not in (
|
|
|
date or None, store or None
|
|
@@ -186,7 +192,7 @@ class TransactionEditor(FocusWidget):
|
|
|
if len(options):
|
|
|
widget._emit('open', options)
|
|
|
return
|
|
|
-
|
|
|
+
|
|
|
new_product_activity = self.activity_manager.get('new_product')
|
|
|
current_activity = self.activity_manager.current()
|
|
|
if current_activity is not new_product_activity and name in (
|
|
@@ -194,7 +200,7 @@ class TransactionEditor(FocusWidget):
|
|
|
):
|
|
|
self.new_product_callback(name)
|
|
|
return
|
|
|
-
|
|
|
+
|
|
|
def new_product_callback(self, name):
|
|
|
cur = self.activity_manager.current()
|
|
|
txn = self.activity_manager.get('transaction')
|