feat: 周期账单支持选择货币 (#444) - #446
Merged
Merged
Conversation
周期账单此前完全没有币种概念:编辑页的账户候选被硬过滤成「账本本位币」, 外币账户根本选不到;也没有记账页那样的手选币种入口(L12),生成的交易 永远落本位币。 - DB v32:`recurring_transactions.currency_code`(可空,NULL = 账本本位币, 不回填 → 存量模板行为一字不差) - 编辑页:新增币种字段(复用 showCurrencyPickerSheet);币种优先联动 —— 改币种即按新币种过滤账户候选并清空已选账户;账户过滤同时修掉「读 currentLedgerId 而非所选账本」的老问题 - 生成器:有账户以账户币种为准(账户内不混币),无账户用模板币种; nativeAmount 不锁在模板上,每次生成按当日有效汇率折算 —— 周期账单的 语义是「每月 10 美元」,不是「每月固定 72 元」 - 列表页:外币模板金额前带币种符号 - 配置导出/导入:currency_code 往返 跨币种转账仍不支持(多币种设计 §4.4):转账两端按同一有效币种过滤, 天然同币种。周期账单不参与云同步,服务端零改动。
真机走查发现:JPY 和 CNY 的 getCurrencySymbol 都是「¥」,只换符号的话 5000 日元和 5000 元长得一模一样,等于没标 —— 改成金额左侧标 ISO 码。
TNT-Likely
force-pushed
the
claude/issue-444-6c0b0e
branch
from
August 17, 2026 01:57
39bdad7 to
cdc2d8e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #444
问题
周期账单从来没有币种概念,三处叠加导致外币周期账单根本记不了:
recurring_transaction_edit_page.dart旧 672 行)→ 外币账户选不到;addTransaction不传currencyCode,靠 repo 从账户兜底 —— 而账户又只能是本位币 → 生成的交易永远落本位币。多币种 phase 2 的技术设计里其实已经预设了「周期模板挂外币账户」这条路径(
02-tech-design-app.md§兜底),只是编辑页的老过滤把入口焊死了。改动
recurring_transactions.currency_code(可空)。不回填 —— NULL = 账本本位币,存量模板行为一字不差add/updateRecurringTransaction增currencyCode(接口 + 本地实现 + LocalRepository 委托),统一大写存储nativeAmount不传,由 repo 按生成当日有效汇率折算showCurrencyPickerSheet);币种优先联动:改币种即按新币种过滤账户候选并清空已选账户currency_code往返几个刻意的取舍
nativeAmount回落 = amount,正好命中 L11 检测条件,统计页「按当前汇率重算」横幅可捞回。showCurrency)。_selectAccount读currentLedgerIdProvider而不是页面上所选账本的老问题。周期账单不参与云同步(只进 config 导出/导入),服务端零改动。
验证
flutter test全绿:620 passed(新增 11 条)test/services/data/recurring_transaction_currency_test.dart:外币模板落币种 + 按当日汇率折算 / 无汇率回落 / 模板币种为 null 保持存量 / 挂外币账户 / 模板币种与账户币种漂移时以账户为准 / v32 列可空test/widgets/recurring_edit_currency_test.dart:币种字段默认本位币、外币回显、账户候选按有效币种过滤(核心修复)、本位币模板旧行为不回归test/data/sync_pull_errors_schema_test.dart的 schemaVersion 守卫同步到 32JPY -5,000