From b803731bc52dbf3628b2129c7881cebabd24488e Mon Sep 17 00:00:00 2001
From: Julian Dominguez-Schatz <julian.dominguezschatz@gmail.com>
Date: Wed, 22 May 2024 08:57:32 -0700
Subject: [PATCH] Match on `amount` when creating a rule from a transaction
 (#2786)

* Use amount when creating a rule from a transaction

* Add release notes
---
 .../desktop-client/src/components/accounts/Account.jsx    | 8 +++++++-
 upcoming-release-notes/2786.md                            | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 upcoming-release-notes/2786.md

diff --git a/packages/desktop-client/src/components/accounts/Account.jsx b/packages/desktop-client/src/components/accounts/Account.jsx
index c37aad514..225ec864b 100644
--- a/packages/desktop-client/src/components/accounts/Account.jsx
+++ b/packages/desktop-client/src/components/accounts/Account.jsx
@@ -1093,11 +1093,17 @@ class AccountInternal extends PureComponent {
           value: ruleTransaction.payee,
           type: 'id',
         };
+    const amountCondition = {
+      field: 'amount',
+      op: 'isapprox',
+      value: ruleTransaction.amount,
+      type: 'number',
+    };
 
     const rule = {
       stage: null,
       conditionsOp: 'and',
-      conditions: [payeeCondition],
+      conditions: [payeeCondition, amountCondition],
       actions: [
         ...(childTransactions.length === 0
           ? [
diff --git a/upcoming-release-notes/2786.md b/upcoming-release-notes/2786.md
new file mode 100644
index 000000000..9540bbd13
--- /dev/null
+++ b/upcoming-release-notes/2786.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [jfdoming]
+---
+
+Match on `amount` when creating a rule from a transaction
-- 
GitLab