Skip to content

[16.0][REF] repair_refurbish: Reimplementation of refurbishment logic#164

Open
nicolas-delbovier-acsone wants to merge 2 commits into
OCA:16.0from
acsone:16.0-fix-repair_refurbish-broken-unit-tests
Open

[16.0][REF] repair_refurbish: Reimplementation of refurbishment logic#164
nicolas-delbovier-acsone wants to merge 2 commits into
OCA:16.0from
acsone:16.0-fix-repair_refurbish-broken-unit-tests

Conversation

@nicolas-delbovier-acsone
Copy link
Copy Markdown

@nicolas-delbovier-acsone nicolas-delbovier-acsone commented May 12, 2026

This PR is in following of this comment: #119 (comment)

The previous implementation was brittle, relying on complex onchanges and manual field synchronization that could fail when used in combination with other modules (like repair_type).

This refactor streamlines the workflow while preserving the original functional intent defined in USAGE.rst.

Key Changes:

  • Logic: Moved refurbishment logic from UI-driven onchanges to a more robust backend approach (computed field).
  • Data: Introduced a dedicated 'Refurbish Scrap' location to isolate waste reporting.
  • Simplified Config: Removed property_stock_refurbish on product templates. The module now uses the global virtual refurbish locations by default, reducing configuration overhead.
  • UI/UX:
    • Added a boolean_toggle for 'To Refurbish' at the top of the form.
    • Grouped refurbishment fields into a dedicated section.
  • Clean Code:
    • Removed unnecessary inheritance on repair.line and stock.move.line.
    • Used Command methodology for move line creation.
    • Switched to api.depends (computed stored) for the refurbished product to ensure data integrity.
  • Testing: Complete rewrite of tests to use setUpClass. Tests now simulate realistic workflows and no longer rely on setting values in invisible fields that would be inaccessible to users through UI.

This refactor also fixes the CI/CD pipeline failures that were affecting other PRs in the repository due to the broken test suite in this module.


UI upgrade

image image image

The previous implementation was brittle, relying on complex onchanges
and manual field synchronization that could fail when used in
combination with other modules (like repair_type).

This refactor streamlines the workflow while preserving the original
functional intent defined in USAGE.rst.

Key Changes:
- Logic: Moved refurbishment logic from UI-driven onchanges to a more
  robust backend approach (computed field).
- Data: Introduced a dedicated 'Refurbish Scrap' location to isolate
  waste reporting.
- Simplified Config: Removed `property_stock_refurbish` on product
  templates. The module now uses the global virtual refurbish locations
  by default, reducing configuration overhead.
- UI/UX:
    - Added a `boolean_toggle` for 'To Refurbish' at the top of the form.
    - Grouped refurbishment fields into a dedicated section.
- Clean Code:
    - Removed unnecessary inheritance on `repair.line` and `stock.move.line`.
    - Used `Command` methodology for move line creation.
    - Switched to `api.depends` (computed stored) for the refurbished
      product to ensure data integrity.
- Testing: Complete rewrite of tests to use `setUpClass`. Tests now
  simulate realistic workflows and no longer rely on setting values in
  invisible fields that would be inaccessible to users through UI.

This refactor also fixes the CI/CD pipeline failures that were
affecting other PRs in the repository due to the broken test suite
in this module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants