Skip to content

T2696 [ADD] Off-balance comprehensive tests#268

Merged
ecino merged 12 commits into17.0from
test-offbalance
Dec 9, 2025
Merged

T2696 [ADD] Off-balance comprehensive tests#268
ecino merged 12 commits into17.0from
test-offbalance

Conversation

@ecino
Copy link
Member

@ecino ecino commented Dec 4, 2025

No description provided.

@ecino ecino marked this pull request as draft December 4, 2025 06:09
@gemini-code-assist
Copy link

Summary of Changes

Hello @ecino, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the test coverage for the off-balance accounting module. It introduces a suite of comprehensive tests to ensure the correct behavior of off-balance account settings, the filtering of off-balance move lines during reconciliation, and sets up the framework for testing off-balance unreconciliation processes. These additions improve the robustness and reliability of the off-balance features.

Highlights

  • New Test Modules: Three new test modules have been added to provide comprehensive coverage for off-balance accounting functionalities.
  • Off-Balance Settings Tests: Extensive tests were introduced for account.account, res.company, and res.config.settings to validate off-balance configurations, including field behavior and search filtering.
  • Off-Balance Reconciliation Tests: New tests cover account.move.line extensions, specifically verifying the is_off_balance_generated field and the filter_off_balance context for searching move lines.
  • Unreconciliation Test Setup: A new test file for off-balance unreconciliation has been added, laying the groundwork for future tests in this area.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot]

This comment was marked as outdated.

Copilot AI and others added 2 commits December 4, 2025 08:12
…rship (#269)

* Initial plan

* Add comprehensive reconciliation use case tests

Co-authored-by: ecino <8435180+ecino@users.noreply.github.com>

* Improve test documentation and fix trailing whitespace

Co-authored-by: ecino <8435180+ecino@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ecino <8435180+ecino@users.noreply.github.com>
- Associate off-balance with on-balance lines
- Provide migration
- TODO exchange diff test
- TODO credit note test
- TODO finish migration script
Copilot AI and others added 7 commits December 9, 2025 08:25
Co-authored-by: ecino <8435180+ecino@users.noreply.github.com>
Co-authored-by: ecino <8435180+ecino@users.noreply.github.com>
Co-authored-by: ecino <8435180+ecino@users.noreply.github.com>
Co-authored-by: ecino <8435180+ecino@users.noreply.github.com>
@ecino ecino marked this pull request as ready for review December 9, 2025 09:37
@ecino
Copy link
Member Author

ecino commented Dec 9, 2025

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces significant improvements to the off-balance accounting module, particularly in how reconciliation and unreconciliation are handled. The refactoring of js_remove_outstanding_partial in account_move.py simplifies the logic by directly unlinking generated off-balance lines and then regenerating them if necessary. The new Many2many fields (on_balance_line_ids, off_balance_line_ids) in account_move_line.py provide a more robust linking mechanism between on-balance and off-balance entries. The addition of _compute_invoice_distribution_ratio and the revised _build_onbalance_amounts and _create_onbalance_move_lines methods enhance the accuracy and flexibility of income distribution. A major strength of this PR is the comprehensive suite of new tests, covering various reconciliation use cases, credit notes, and exchange differences. This significantly improves the test coverage and ensures the new logic behaves as expected under different scenarios. However, there are a couple of issues that need to be addressed: a potential bug in the post-migration script where the wrong line.id might be used when associating off-balance lines, and an empty test file (test_offbalance_unreconcile.py) which suggests incomplete test coverage for unreconciliation scenarios, despite the refactoring in account_move.py related to unreconciliation.

@ecino
Copy link
Member Author

ecino commented Dec 9, 2025

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant and valuable refactoring of the off-balance reconciliation logic, accompanied by a comprehensive new test suite. The changes simplify the unreconciliation process, improve data traceability by linking on-balance and off-balance lines, and make the calculation logic more robust. The addition of extensive tests covering various scenarios is a major improvement.

My review has identified a critical issue in the unreconciliation logic within js_remove_outstanding_partial that would prevent generated lines from being deleted. I have also pointed out a significant performance concern in the new migration script due to database queries inside a loop. Additionally, there are a few minor suggestions to improve code readability by renaming a variable.

Overall, this is a very positive change that greatly enhances the feature's maintainability and correctness. Addressing the identified issues will make it ready for merging.

@ecino ecino merged commit f12905d into 17.0 Dec 9, 2025
1 check passed
@ecino ecino deleted the test-offbalance branch December 9, 2025 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants