Skip to content

Commit

Permalink
Merge branch 'master' into fix/3627
Browse files Browse the repository at this point in the history
  • Loading branch information
UnderKoen authored Oct 23, 2024
2 parents 7b23510 + 5405473 commit c1a7cb6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions packages/desktop-client/src/components/HelpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -52,6 +53,7 @@ export const HelpMenu = () => {
const menuButtonRef = useRef(null);

const dispatch = useDispatch();
const page = useLocation().pathname;

const handleItemSelect = (item: HelpMenuItem) => {
switch (item) {
Expand Down
4 changes: 4 additions & 0 deletions packages/loot-core/src/server/accounts/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 10 additions & 8 deletions packages/loot-core/src/server/accounts/transaction-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,15 +792,17 @@ export async function finalizeTransactionForRules(
trans: TransactionEntity | TransactionForRules,
): Promise<TransactionEntity> {
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;
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3704.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [UnderKoen]
---

Fix not being able to change Payee by rules

0 comments on commit c1a7cb6

Please sign in to comment.