Do not void txn if there is none
This commit is contained in:
parent
207de81e51
commit
a7ab1b5882
|
@ -841,39 +841,63 @@ class POSView(WuttaView):
|
||||||
session.close()
|
session.close()
|
||||||
|
|
||||||
self.clear_all()
|
self.clear_all()
|
||||||
|
self.main_input.value = ''
|
||||||
self.main_input.focus()
|
self.main_input.focus()
|
||||||
self.page.update()
|
self.page.update()
|
||||||
|
|
||||||
def cancel(e):
|
def cancel(e):
|
||||||
dlg.open = False
|
dlg.open = False
|
||||||
|
self.main_input.focus()
|
||||||
self.page.update()
|
self.page.update()
|
||||||
|
|
||||||
dlg = ft.AlertDialog(
|
session = self.app.make_session()
|
||||||
# modal=True,
|
batch = self.get_current_batch(session, create=False)
|
||||||
title=ft.Text("Confirm VOID"),
|
session.close()
|
||||||
content=ft.Text("Really VOID this transaction?"),
|
|
||||||
actions=[
|
if batch:
|
||||||
ft.Container(content=ft.Text("Yes, VOID",
|
|
||||||
size=self.default_font_size,
|
dlg = ft.AlertDialog(
|
||||||
color='black',
|
title=ft.Text("Confirm VOID"),
|
||||||
weight=ft.FontWeight.BOLD),
|
content=ft.Text("Really VOID this transaction?"),
|
||||||
height=self.default_button_size,
|
actions=[
|
||||||
width=self.default_button_size * 2.5,
|
ft.Container(content=ft.Text("Yes, VOID",
|
||||||
alignment=ft.alignment.center,
|
size=self.default_font_size,
|
||||||
bgcolor='red',
|
color='black',
|
||||||
border=ft.border.all(1, 'black'),
|
weight=ft.FontWeight.BOLD),
|
||||||
border_radius=ft.border_radius.all(5),
|
height=self.default_button_size,
|
||||||
on_click=confirm),
|
width=self.default_button_size * 2.5,
|
||||||
ft.Container(content=ft.Text("Cancel",
|
alignment=ft.alignment.center,
|
||||||
size=self.default_font_size,
|
bgcolor='red',
|
||||||
weight=ft.FontWeight.BOLD),
|
border=ft.border.all(1, 'black'),
|
||||||
height=self.default_button_size,
|
border_radius=ft.border_radius.all(5),
|
||||||
width=self.default_button_size * 2.5,
|
on_click=confirm),
|
||||||
alignment=ft.alignment.center,
|
ft.Container(content=ft.Text("Cancel",
|
||||||
border=ft.border.all(1, 'black'),
|
size=self.default_font_size,
|
||||||
border_radius=ft.border_radius.all(5),
|
weight=ft.FontWeight.BOLD),
|
||||||
on_click=cancel),
|
height=self.default_button_size,
|
||||||
])
|
width=self.default_button_size * 2.5,
|
||||||
|
alignment=ft.alignment.center,
|
||||||
|
border=ft.border.all(1, 'black'),
|
||||||
|
border_radius=ft.border_radius.all(5),
|
||||||
|
on_click=cancel),
|
||||||
|
])
|
||||||
|
|
||||||
|
else: # nothing to void
|
||||||
|
|
||||||
|
dlg = ft.AlertDialog(
|
||||||
|
title=ft.Text("No Transaction"),
|
||||||
|
content=ft.Text("You do not have a transaction open currently.", size=20),
|
||||||
|
actions=[
|
||||||
|
ft.Container(content=ft.Text("Close",
|
||||||
|
size=self.default_font_size,
|
||||||
|
weight=ft.FontWeight.BOLD),
|
||||||
|
height=self.default_button_size,
|
||||||
|
width=self.default_button_size * 2.5,
|
||||||
|
alignment=ft.alignment.center,
|
||||||
|
border=ft.border.all(1, 'black'),
|
||||||
|
border_radius=ft.border_radius.all(5),
|
||||||
|
on_click=cancel),
|
||||||
|
])
|
||||||
|
|
||||||
self.page.dialog = dlg
|
self.page.dialog = dlg
|
||||||
dlg.open = True
|
dlg.open = True
|
||||||
|
|
Loading…
Reference in a new issue