Skip to content

Conversation

@sbejaoui
Copy link

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

@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

@sbejaoui sbejaoui force-pushed the 16.0-repair_preparation-sbj branch from 6e69cb0 to 1de4451 Compare August 22, 2025 13:08
update repair line location and lot after preparation is done
@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"
)
% {

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,

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

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() ?

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.

2 participants