mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-07-11 15:22:55 +02:00
Created Transaction Rules (markdown)
@@ -0,0 +1,72 @@
|
|||||||
|
### Transaction Rules
|
||||||
|
|
||||||
|
Transaction Rules are a powerful feature in WYGIWYH that allow for automatic modification of transactions based on specified criteria. This can save time and ensure consistency in your financial tracking.
|
||||||
|
|
||||||
|
Key Aspects of Transaction Rules:
|
||||||
|
|
||||||
|
* **Conditions**: Set specific criteria that a transaction must meet for the rule to apply. This can include attributes like description, amount, account, etc.
|
||||||
|
* **Actions**: Define what changes should be made to a transaction when the conditions are met. This can include setting categories, tags, or modifying other fields.
|
||||||
|
* **Activation Options**: Rules can be set to apply when transactions are created, updated, or both.
|
||||||
|
|
||||||
|
#### Actions and Conditions
|
||||||
|
|
||||||
|
When creating a new rule, you will need to add a Condition and, later, Actions.
|
||||||
|
|
||||||
|
Both use a limited subset of Python, via [SimpleEval](https://github.com/danthedeckie/simpleeval).
|
||||||
|
|
||||||
|
The Condition must evaluate to True or False, and the Action must evaluate to a value that will be set on the selected field.
|
||||||
|
|
||||||
|
You may use any of the available [variables](#available-variables) and [functions](#available-functions).
|
||||||
|
|
||||||
|
#### Available variables
|
||||||
|
|
||||||
|
* `account_name`
|
||||||
|
* `account_id`
|
||||||
|
* `account_group_name`
|
||||||
|
* `account_group_id`
|
||||||
|
* `is_asset_account`
|
||||||
|
* `is_archived_account`
|
||||||
|
* `category_name`
|
||||||
|
* `category_id`
|
||||||
|
* `tag_names`
|
||||||
|
* `tag_ids`
|
||||||
|
* `entities_names`
|
||||||
|
* `entities_ids`
|
||||||
|
* `is_expense`
|
||||||
|
* `is_income`
|
||||||
|
* `is_paid`
|
||||||
|
* `description`
|
||||||
|
* `amount`
|
||||||
|
* `notes`
|
||||||
|
* `date`
|
||||||
|
* `reference_date`
|
||||||
|
|
||||||
|
#### Available functions
|
||||||
|
|
||||||
|
* `relativedelta`
|
||||||
|
|
||||||
|
#### Examples
|
||||||
|
|
||||||
|
Add a tag to an income transaction if it happens in a specific account
|
||||||
|
|
||||||
|
```
|
||||||
|
If...
|
||||||
|
account_name == "My Investing Account" and is_income
|
||||||
|
|
||||||
|
Then...
|
||||||
|
Set Tags to
|
||||||
|
tag_names + ["Yield"]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Move credit card transactions to next month when they happen at a cutoff date
|
||||||
|
|
||||||
|
```
|
||||||
|
If...
|
||||||
|
account_name == "My credit card" and date.day >= 26 and reference_date.month == date.month
|
||||||
|
|
||||||
|
Then...
|
||||||
|
Set Reference Date to
|
||||||
|
reference_date + relativedelta(months=1)).replace(day=1)
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user