commit 49d9f25baa88b01f3b472b4ba5340727c1accf68
parent 8391c66241a5ce206b686572b1890932266388b8
Author: Carlosokumu <carlosokumu254@gmail.com>
Date: Wed, 25 Mar 2026 21:16:08 +0300
re-add used function add_attachment
Diffstat:
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/dummy/usawa/gui/core/models.py b/dummy/usawa/gui/core/models.py
@@ -1,5 +1,5 @@
from dataclasses import dataclass, field
-from typing import Optional, List
+from typing import Optional, List, Union
from datetime import datetime
from pathlib import Path
@@ -55,3 +55,17 @@ class LedgerEntry:
return False, f"Attachment file not found: {filepath}"
return True, ""
+
+ def add_attachment(self, filepath: Union[str, List[str]]):
+ """
+ Add one or more attachment file paths
+ """
+ if isinstance(filepath, str):
+ if filepath not in self.attachments:
+ self.attachments.append(filepath)
+ elif isinstance(filepath, list):
+ for path in filepath:
+ if path not in self.attachments:
+ self.attachments.append(path)
+ else:
+ raise TypeError(f"filepath must be str or List[str], got {type(filepath)}")