diff --git a/packages/loot-core/src/server/accounts/rules.ts b/packages/loot-core/src/server/accounts/rules.ts index 89cf1f86b6..280e84e655 100644 --- a/packages/loot-core/src/server/accounts/rules.ts +++ b/packages/loot-core/src/server/accounts/rules.ts @@ -625,6 +625,10 @@ export class Action { } else { object[this.field] = this.value; } + + if (this.field === 'payee_name') { + object['payee'] = 'new'; + } break; case 'set-split-amount': switch (this.options.method) { diff --git a/packages/loot-core/src/server/accounts/transaction-rules.ts b/packages/loot-core/src/server/accounts/transaction-rules.ts index 2d8bc7c542..5a98618618 100644 --- a/packages/loot-core/src/server/accounts/transaction-rules.ts +++ b/packages/loot-core/src/server/accounts/transaction-rules.ts @@ -792,15 +792,17 @@ export async function finalizeTransactionForRules( trans: TransactionEntity | TransactionForRules, ): Promise { if ('payee_name' in trans) { - if (trans.payee_name) { - let payeeId = (await getPayeeByName(trans.payee_name))?.id; - payeeId ??= await insertPayee({ - name: trans.payee_name, - }); + if (trans.payee === 'new') { + if (trans.payee_name) { + let payeeId = (await getPayeeByName(trans.payee_name))?.id; + payeeId ??= await insertPayee({ + name: trans.payee_name, + }); - trans.payee = payeeId; - } else { - trans.payee = null; + trans.payee = payeeId; + } else { + trans.payee = null; + } } delete trans.payee_name; diff --git a/upcoming-release-notes/3704.md b/upcoming-release-notes/3704.md new file mode 100644 index 0000000000..bbe3f21ca2 --- /dev/null +++ b/upcoming-release-notes/3704.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [UnderKoen] +--- + +Fix not being able to change Payee by rules