mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-07-09 22:32:50 +02:00
feat: add is_asset_account and is_archived_account to rule eval
This commit is contained in:
@@ -26,6 +26,8 @@ def check_for_transaction_rules(
|
|||||||
"account_group_id": (
|
"account_group_id": (
|
||||||
instance.account.group.id if instance.account.group else None
|
instance.account.group.id if instance.account.group else None
|
||||||
),
|
),
|
||||||
|
"is_asset_account": instance.account.is_asset,
|
||||||
|
"is_archived_account": instance.account.is_archived,
|
||||||
"category_name": instance.category.name if instance.category else None,
|
"category_name": instance.category.name if instance.category else None,
|
||||||
"category_id": instance.category.id if instance.category else None,
|
"category_id": instance.category.id if instance.category else None,
|
||||||
"tag_names": [x.name for x in instance.tags.all()],
|
"tag_names": [x.name for x in instance.tags.all()],
|
||||||
@@ -64,7 +66,6 @@ def check_for_transaction_rules(
|
|||||||
TransactionRuleAction.Field.description,
|
TransactionRuleAction.Field.description,
|
||||||
TransactionRuleAction.Field.notes,
|
TransactionRuleAction.Field.notes,
|
||||||
]:
|
]:
|
||||||
print(1)
|
|
||||||
setattr(
|
setattr(
|
||||||
instance,
|
instance,
|
||||||
action.field,
|
action.field,
|
||||||
@@ -72,7 +73,6 @@ def check_for_transaction_rules(
|
|||||||
)
|
)
|
||||||
|
|
||||||
elif action.field == TransactionRuleAction.Field.account:
|
elif action.field == TransactionRuleAction.Field.account:
|
||||||
print(2)
|
|
||||||
value = simple.eval(action.value)
|
value = simple.eval(action.value)
|
||||||
if isinstance(value, int):
|
if isinstance(value, int):
|
||||||
account = Account.objects.get(id=value)
|
account = Account.objects.get(id=value)
|
||||||
@@ -82,7 +82,6 @@ def check_for_transaction_rules(
|
|||||||
instance.account = account
|
instance.account = account
|
||||||
|
|
||||||
elif action.field == TransactionRuleAction.Field.category:
|
elif action.field == TransactionRuleAction.Field.category:
|
||||||
print(3)
|
|
||||||
value = simple.eval(action.value)
|
value = simple.eval(action.value)
|
||||||
if isinstance(value, int):
|
if isinstance(value, int):
|
||||||
category = TransactionCategory.objects.get(id=value)
|
category = TransactionCategory.objects.get(id=value)
|
||||||
@@ -92,7 +91,6 @@ def check_for_transaction_rules(
|
|||||||
instance.category = category
|
instance.category = category
|
||||||
|
|
||||||
elif action.field == TransactionRuleAction.Field.tags:
|
elif action.field == TransactionRuleAction.Field.tags:
|
||||||
print(4)
|
|
||||||
value = simple.eval(action.value)
|
value = simple.eval(action.value)
|
||||||
print(value, action.value)
|
print(value, action.value)
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
|
|||||||
Reference in New Issue
Block a user