diff --git a/packages/desktop-client/src/components/accounts/Filters.js b/packages/desktop-client/src/components/accounts/Filters.js index b0a552258c5..798d46b9164 100644 --- a/packages/desktop-client/src/components/accounts/Filters.js +++ b/packages/desktop-client/src/components/accounts/Filters.js @@ -45,6 +45,7 @@ let filterFields = [ 'category', 'amount', 'cleared', + 'is_transfer', ].map(field => [field, mapField(field)]); function subfieldFromFilter({ field, options, value }) { diff --git a/packages/loot-core/src/server/aql/schema/index.ts b/packages/loot-core/src/server/aql/schema/index.ts index 5f4a84acf3e..aceb92f7e2b 100644 --- a/packages/loot-core/src/server/aql/schema/index.ts +++ b/packages/loot-core/src/server/aql/schema/index.ts @@ -49,6 +49,7 @@ export const schema = { cleared: f('boolean', { default: true }), tombstone: f('boolean'), schedule: f('id', { ref: 'schedules' }), + is_transfer: f('boolean'), // subtransactions is a special field added if the table has the // `splits: grouped` option }, @@ -270,6 +271,7 @@ export const schemaConfig = { category: `CASE WHEN _.isParent = 1 THEN NULL ELSE cm.transferId END`, amount: `IFNULL(_.amount, 0)`, parent_id: 'CASE WHEN _.isChild = 0 THEN NULL ELSE _.parent_id END', + is_transfer: 'CASE WHEN _.transferred_id is NULL THEN FALSE ELSE TRUE END' }); return ` diff --git a/packages/loot-core/src/shared/rules.ts b/packages/loot-core/src/shared/rules.ts index 93b2727ff9d..2a4d2fcacef 100644 --- a/packages/loot-core/src/shared/rules.ts +++ b/packages/loot-core/src/shared/rules.ts @@ -37,6 +37,7 @@ export const FIELD_TYPES = new Map( category: 'id', account: 'id', cleared: 'boolean', + is_transfer: 'boolean', }), ); @@ -57,6 +58,8 @@ export function mapField(field, opts) { return 'amount (inflow)'; case 'amount-outflow': return 'amount (outflow)'; + case 'is_transfer': + return 'Transfer'; default: return field; }