mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-03-22 17:39:25 +01:00
feat(import:v1:schema): add option for triggering rules
This commit is contained in:
@@ -69,6 +69,7 @@ class CSVImportSettings(BaseModel):
|
||||
skip_lines: int = Field(
|
||||
default=0, description="Number of rows to skip at the beginning of the file"
|
||||
)
|
||||
trigger_transaction_rules: bool = True
|
||||
importing: Literal[
|
||||
"transactions", "accounts", "currencies", "categories", "tags", "entities"
|
||||
]
|
||||
|
||||
@@ -22,6 +22,7 @@ from apps.transactions.models import (
|
||||
TransactionTag,
|
||||
TransactionEntity,
|
||||
)
|
||||
from apps.rules.signals import transaction_created
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -228,6 +229,9 @@ class ImportService:
|
||||
if entities:
|
||||
new_transaction.entities.set(entities)
|
||||
|
||||
if self.settings.trigger_transaction_rules:
|
||||
transaction_created.send(sender=new_transaction)
|
||||
|
||||
return new_transaction
|
||||
|
||||
def _create_account(self, data: Dict[str, Any]) -> Account:
|
||||
|
||||
Reference in New Issue
Block a user