Conversation
code から部門を引く処理をやめ、明細の branch_id / sub_account_id を直接使うよう 4ファクトリを変更。部門補助の code 一意チェックをスキップ。 テストデータを first_boot に合わせ、 アサーションをbranch_id基準に修正。
Contributor
There was a problem hiding this comment.
Pull request overview
部門コードが重複するケースで、自動仕訳が「部門コードから部門を引く」ことで誤った部門を参照しうる問題を、明細の branch_id / sub_account_id(= Branch ID)を基準に扱うよう修正するPRです。あわせて、部門補助の code 一意チェックをスキップし、テストデータとアサーションを Branch ID 基準に更新しています。
Changes:
- 自動振替(内部取引/費用配賦/資産配賦)で、部門補助科目の参照を「code→補助科目」から「Branch ID(
branch.id/@src_jd.branch_id)」へ変更 - 仮負債精算で、資産明細の部門決定を「sub_account(code)→Branch(code)」から「
sub_account_id(Branch ID)を直接使用」へ変更 - 部門補助(
SUB_ACCOUNT_TYPE_BRANCH)の補助コード重複チェックをスキップし、テスト/fixture を Branch ID 前提へ更新
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/models/auto/transfer_journal/branch_code_duplication_test.rb | 部門コード重複時でも transfer が Branch ID を使うことを確認する新規テスト追加 |
| test/models/auto/journal/temporary_debt_factory_test.rb | 仮負債精算が sub_account_id(Branch ID) を使うことを確認する新規テスト追加 |
| test/data/journal_details.csv | 仮負債明細の sub_account_id を Branch ID に合わせて更新 |
| test/data/accounts.csv | 関連勘定科目の sub_account_type を部門(8)へ更新 |
| test/controllers/journals_controller/auto_test.rb | 配賦系の sub_account_id アサーションを Branch ID 基準に更新 |
| app/models/validators/unique_sub_accounts_validator.rb | 部門補助の code 一意チェックをスキップ |
| app/models/auto/transfer_journal/internal_trade_factory.rb | 部門補助科目を code lookup せず branch.id を設定 |
| app/models/auto/transfer_journal/allocated_cost_factory.rb | 部門補助科目を code lookup せず branch.id を設定 |
| app/models/auto/transfer_journal/allocated_assets_factory.rb | 部門補助科目を code lookup せず @src_jd.branch_id を設定 |
| app/models/auto/journal/temporary_debt_factory.rb | 資産明細の branch を sub_account_id(Branch ID)から直接決定 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
code から部門を引く処理をやめ、明細の branch_id / sub_account_id を直接使うよう 4ファクトリを変更。部門補助の code 一意チェックをスキップ。
テストデータを first_boot に合わせ、 アサーションをbranch_id基準に修正。