mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-07-10 14:52:42 +02: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(
|
skip_lines: int = Field(
|
||||||
default=0, description="Number of rows to skip at the beginning of the file"
|
default=0, description="Number of rows to skip at the beginning of the file"
|
||||||
)
|
)
|
||||||
|
trigger_transaction_rules: bool = True
|
||||||
importing: Literal[
|
importing: Literal[
|
||||||
"transactions", "accounts", "currencies", "categories", "tags", "entities"
|
"transactions", "accounts", "currencies", "categories", "tags", "entities"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ from apps.transactions.models import (
|
|||||||
TransactionTag,
|
TransactionTag,
|
||||||
TransactionEntity,
|
TransactionEntity,
|
||||||
)
|
)
|
||||||
|
from apps.rules.signals import transaction_created
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -228,6 +229,9 @@ class ImportService:
|
|||||||
if entities:
|
if entities:
|
||||||
new_transaction.entities.set(entities)
|
new_transaction.entities.set(entities)
|
||||||
|
|
||||||
|
if self.settings.trigger_transaction_rules:
|
||||||
|
transaction_created.send(sender=new_transaction)
|
||||||
|
|
||||||
return new_transaction
|
return new_transaction
|
||||||
|
|
||||||
def _create_account(self, data: Dict[str, Any]) -> Account:
|
def _create_account(self, data: Dict[str, Any]) -> Account:
|
||||||
|
|||||||
Reference in New Issue
Block a user