EOD and Carryover tickets added
This commit is contained in:
+22
-6
@@ -33,7 +33,7 @@ from app.ui.settings_dialog import SettingsDialog
|
||||
from app.ui.widgets.orders_table import OrdersTableView
|
||||
from app.ui.widgets.dashboard import DashboardWidget
|
||||
from app.ui.widgets.order_detail_dialog import OrderDetailDialog
|
||||
from app.workers import FetchOrdersWorker, load_all_orders, get_dashboard_stats
|
||||
from app.workers import FetchOrdersWorker, load_active_and_done_orders, get_dashboard_stats
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
@@ -58,8 +58,11 @@ class MainWindow(QMainWindow):
|
||||
self.dashboard = DashboardWidget()
|
||||
self.orders_table = OrdersTableView()
|
||||
self.orders_table.order_double_clicked.connect(self._on_order_double_clicked)
|
||||
self.done_table = OrdersTableView()
|
||||
self.done_table.order_double_clicked.connect(self._on_order_double_clicked)
|
||||
self.tabs.addTab(self.dashboard, "Dashboard")
|
||||
self.tabs.addTab(self.orders_table, "All Orders")
|
||||
self.tabs.addTab(self.orders_table, "Active Orders")
|
||||
self.tabs.addTab(self.done_table, "Done")
|
||||
layout.addWidget(self.tabs)
|
||||
|
||||
self.setCentralWidget(central)
|
||||
@@ -81,6 +84,7 @@ class MainWindow(QMainWindow):
|
||||
toolbar.addSeparator()
|
||||
|
||||
export_action = QAction("Export Visible Orders to Odoo CSV", self)
|
||||
export_action.setToolTip("Exports from whichever of Active Orders / Done is open")
|
||||
export_action.triggered.connect(self._on_export_clicked)
|
||||
toolbar.addAction(export_action)
|
||||
|
||||
@@ -194,7 +198,16 @@ class MainWindow(QMainWindow):
|
||||
QMessageBox.critical(self, f"{service_name.title()} import failed", message)
|
||||
|
||||
def _on_export_clicked(self) -> None:
|
||||
orders = self.orders_table.visible_orders()
|
||||
current_tab = self.tabs.currentWidget()
|
||||
if not isinstance(current_tab, OrdersTableView):
|
||||
QMessageBox.information(
|
||||
self,
|
||||
"Nothing to export",
|
||||
"Switch to the Active Orders or Done tab first, then export.",
|
||||
)
|
||||
return
|
||||
|
||||
orders = current_tab.visible_orders()
|
||||
if not orders:
|
||||
QMessageBox.information(
|
||||
self, "Nothing to export", "No orders match the current filters."
|
||||
@@ -216,11 +229,14 @@ class MainWindow(QMainWindow):
|
||||
self.status_label.setText(f"Exported {count} order(s) to {filepath}")
|
||||
|
||||
def _refresh_everything(self) -> None:
|
||||
orders = load_all_orders()
|
||||
self.orders_table.set_orders(orders)
|
||||
active_orders, done_orders = load_active_and_done_orders()
|
||||
self.orders_table.set_orders(active_orders)
|
||||
self.done_table.set_orders(done_orders)
|
||||
self.dashboard.update_stats(get_dashboard_stats())
|
||||
if not hasattr(self, "_suppress_ready_status"):
|
||||
self.status_label.setText(f"{len(orders)} order(s) in local database.")
|
||||
self.status_label.setText(
|
||||
f"{len(active_orders)} active order(s), {len(done_orders)} done."
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user