Skip to content

[16.0][ADD] repair_preparation#119

Open
sbejaoui wants to merge 16 commits intoOCA:16.0from
acsone:16.0-repair_preparation-sbj
Open

[16.0][ADD] repair_preparation#119
sbejaoui wants to merge 16 commits intoOCA:16.0from
acsone:16.0-repair_preparation-sbj

Conversation

@sbejaoui
Copy link
Copy Markdown

The repair module consumes spare parts at the end of the repair without considering the qunatity reservation. the more natural flow is to have a staging step to bring and reserve parts before the repair begins, improving planning and reducing delays at the workbench.

This addon introduces a Preparation flow:

  • On Confirm (validate) of the repair, a procurement is run procurement for all eligible Add lines

  • When a repair line is created/edited while the repair is Under Repair:

    • If any linked move is Done → editing raises a validation error
    • Otherwise, linked moves are canceled and procurement is re-run for the updated lines
  • Finishing a repair is blocked if:

    • There are consumed lines but no preparation pickings, or
    • Preparation pickings exist but are not done

cc/ @lmignon , @rousseldenis

@sbejaoui sbejaoui force-pushed the 16.0-repair_preparation-sbj branch 2 times, most recently from d39f316 to 495a3ee Compare August 22, 2025 11:05
@sbejaoui sbejaoui changed the title [WIP][16.0][ADD] repair_preparation [16.0][ADD] repair_preparation Aug 22, 2025
@rousseldenis rousseldenis added this to the 16.0 milestone Aug 22, 2025
@sbejaoui sbejaoui force-pushed the 16.0-repair_preparation-sbj branch from 495a3ee to 6e69cb0 Compare August 22, 2025 11:11
Copy link
Copy Markdown

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

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

LGTM. Some comments

Comment thread repair_preparation/readme/DESCRIPTION.md Outdated
Comment thread repair_preparation/models/res_company.py Outdated
@sbejaoui sbejaoui force-pushed the 16.0-repair_preparation-sbj branch 2 times, most recently from 1de4451 to e822aa4 Compare August 22, 2025 13:09
@sbejaoui sbejaoui requested a review from rousseldenis August 22, 2025 13:11
@sbejaoui sbejaoui force-pushed the 16.0-repair_preparation-sbj branch from 5ff413b to bb3f1d4 Compare September 1, 2025 11:14
"because some linked moves are already done.\n"
"Repair: %(repair)s\nLines: %(lines)s"
)
% {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please use translation function arguments instead.

if not self.preparation_group_id:
self.preparation_group_id = self.env["procurement.group"].create(
{
"name": _("Preparation for") + self.name,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
"name": _("Preparation for") + self.name,
"name": _("Preparation for ") + self.name,

return operations.filtered(
lambda line: line.type == "add"
and line.product_id
and line.product_uom_qty > 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No need of float_compare() ?

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 15, 2026
@sbejaoui sbejaoui force-pushed the 16.0-repair_preparation-sbj branch from 03ee39f to ecaef28 Compare February 25, 2026 11:37
@sbejaoui sbejaoui force-pushed the 16.0-repair_preparation-sbj branch from ecaef28 to a9a9c81 Compare February 25, 2026 13:47
@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 1, 2026
- Do not call action on empty recordset
- Remove depends in manifest
- Use trnaslate function args
Problem:
The 'repair_stock_move' module overrides standard behavior in a way that
causes duplicate stock moves when used alongside this module. Because
this behavior is hard-coded and not toggleable, there is no way to
prevent the conflict via configuration.
@nicolas-delbovier-acsone nicolas-delbovier-acsone force-pushed the 16.0-repair_preparation-sbj branch from 3ec6d19 to af08b5d Compare April 3, 2026 14:52
@nicolas-delbovier-acsone
Copy link
Copy Markdown

nicolas-delbovier-acsone commented Apr 3, 2026

I think there is an incompatibility between repair_refurbish and repair_type because of this code in repair_type:

@api.onchange("type")
def onchange_operation_type(self):
    # this onchange was overriding the changes from the compute
    # method `_compute_location_id`, we ensure that the locations
    # in the types have more priority by explicit calling the compute.
    res = super().onchange_operation_type()
    self._compute_location_id()   # <- THIS LINE IS THE CULPRIT
    return res

The logic for the computation of the locations are not compatible.

NB: I tested on a database with only repair_refurbish and repair_type modules installed and the unit tests also fail

@OCA-git-bot OCA-git-bot added series:16.0 mod:repair_preparation Module repair_preparation labels Apr 15, 2026
Before this commit, the stock picking generated for preparing spare parts
used the default destination location defined on the picking type.

This resulted in poor UX, as the operator was forced to manually edit the
destination location on the generated picking to match the specific
location of the repair order before validating the transfer. This manual
step was confusing, added unnecessary clicks, and was prone to errors.

Now, the procurement uses the `location_id` of the Repair Order as its
destination. The generated picking is automatically routed to the exact
location where the repair takes place, eliminating the need for manual
intervention and streamlining the operator's workflow.
…c integrity

When the repair preparation flow is enabled, procurement moves are generated
upon order confirmation or when "Under Repair". Modifying quantities or
products while the order is in the 'Confirmed' state (but before the
repair has started) can lead to stock moves getting out of sync with the
repair lines.
@rousseldenis
Copy link
Copy Markdown

@sbejaoui @nicolas-delbovier-acsone Tests seem red

@nicolas-delbovier-acsone
Copy link
Copy Markdown

@sbejaoui @nicolas-delbovier-acsone Tests seem red

Yes I know, as I said above, installing ONLY repair_refurbish and repair_type on a test database on this branch makes tests fail for some reason... I do not know if this is an issue with the current module or if it is rooted somewhere else.

Maybe rebasing the branch will fix it? I'll test that when I have more time

Previously, the module used a standard stock action, which led to several
usability issues:
- Breadcrumb name "Transfers" was inconsistent with the "Preparation" context.
- The "New" button was visible despite creation being invalid in this flow.
- Users were forced through a list view even when only one picking existed.

This change refactors the action to be generated dynamically in Python. It:
- Sets the breadcrumb title to "Preparation Pickings".
- Disables creation via the action context.
- Automatically opens the form view if only one record is found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants