diff --git a/packages/desktop-client/src/components/HelpMenu.tsx b/packages/desktop-client/src/components/HelpMenu.tsx index 64eb00081fd..e0e790dc74b 100644 --- a/packages/desktop-client/src/components/HelpMenu.tsx +++ b/packages/desktop-client/src/components/HelpMenu.tsx @@ -2,6 +2,7 @@ import { forwardRef, useRef } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; import { Trans, useTranslation } from 'react-i18next'; import { useDispatch } from 'react-redux'; +import { useLocation } from 'react-router-dom'; import { useToggle } from 'usehooks-ts'; @@ -52,6 +53,7 @@ export const HelpMenu = () => { const menuButtonRef = useRef(null); const dispatch = useDispatch(); + const page = useLocation().pathname; const handleItemSelect = (item: HelpMenuItem) => { switch (item) { diff --git a/packages/loot-core/src/server/accounts/rules.ts b/packages/loot-core/src/server/accounts/rules.ts index 89cf1f86b67..280e84e655b 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 2d8bc7c5428..5a986186189 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 00000000000..bbe3f21ca2d --- /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