From 27fb3d7286c216b71d5e72fa3a681b3ceab418f9 Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 23 Feb 2026 20:41:05 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B9=E3=83=8A=E3=83=83=E3=82=AF=E8=A6=8B?= =?UTF-8?q?=E3=81=88=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 19 ++++++++++++++----- services/app_service.py | 10 +++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index b6caa1d..144ed90 100644 --- a/main.py +++ b/main.py @@ -723,7 +723,9 @@ class FlutterStyleDashboard: self.open_invoice_edit(slip) def on_long_press(_): - self.show_context_menu(slip) + # 長押しは直接編集画面へ(ビューワではなく編集) + logging.info(f"long_press -> open_invoice_edit: {getattr(slip, 'invoice_number', 'unknown')}") + self.open_invoice_edit(slip) show_offset_button = isinstance(slip, Invoice) and self.can_create_offset_invoice(slip) @@ -972,7 +974,9 @@ class FlutterStyleDashboard: self.selected_customer = invoice.customer self.selected_document_type = invoice.document_type self.amount_value = str(invoice.items[0].unit_price if invoice.items else "0") - self.is_detail_edit_mode = False # 初期はビューモード + self.is_detail_edit_mode = True # 編集モードで開く + self.is_customer_picker_open = False + self.is_new_customer_form_open = False self.current_tab = 1 # 詳細編集タブに切り替え self.update_main_content() @@ -1623,9 +1627,14 @@ class FlutterStyleDashboard: def _show_snack(self, message: str, color=ft.Colors.BLUE_GREY_800): try: - self.page.snack_bar = ft.SnackBar(content=ft.Text(message), bgcolor=color) - self.page.snack_bar.open = True - self.page.update() + snack = ft.SnackBar(content=ft.Text(message), bgcolor=color) + # prefer show_snack_bar API if available (more reliable on web) + if hasattr(self.page, "show_snack_bar"): + self.page.show_snack_bar(snack) + else: + self.page.snack_bar = snack + self.page.snack_bar.open = True + self.page.update() except Exception as e: logging.warning(f"snack_bar表示失敗: {e}") def create_new_customer_screen(self) -> ft.Container: diff --git a/services/app_service.py b/services/app_service.py index c19b5fe..c6ce951 100644 --- a/services/app_service.py +++ b/services/app_service.py @@ -402,7 +402,15 @@ class CustomerService: else: logging.error(f"新規顧客登録失敗: {formal_name}") return 0 # 失敗時は0を返す - + + def update_customer(self, customer: Customer) -> bool: + """顧客を更新し、キャッシュをリフレッシュ""" + success = self.customer_repo.update_customer(customer) + if success: + # キャッシュを再読み込み + self._load_customers() + return success + def _load_customers(self): """顧客データを読み込み""" self._customer_cache = self.customer_repo.get_all_customers()