Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][ADD] stock_picking_auto_revert #1491

Open
wants to merge 3 commits into
base: 15.0
Choose a base branch
from

Conversation

AaronHForgeFlow
Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow commented Jan 25, 2024

Module to correct mistakes in pickings the fast way. Instead of cancel this module will create a return and then will recreate the issued picking.

Based on #593 Originally it was discarded because of the stock_cancel module.

Similar approach Odoo uses for correcting mistakes in invoices. that is, do a reverse and recreate the original invoice in draft state so the user can edit it.

cc @ForgeFlow

This PR Replaces: OCA/stock-logistics-warehouse#1918

Copy link

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 Jul 14, 2024
@AaronHForgeFlow AaronHForgeFlow force-pushed the 15.0-add-stock_picking_auto_revert branch from d986370 to d8c959b Compare July 15, 2024 07:09
Copy link
Contributor

@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.

Code review. Seems great!

stock_picking_auto_revert/models/stock_move.py Outdated Show resolved Hide resolved
# Restrictions before remove quants
if self.returned_move_ids:
raise exceptions.UserError(
_("Action not allowed. Move splited / with returned moves.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
_("Action not allowed. Move splited / with returned moves.")
_("You cannot revert this stock picking. Move splited / with returned moves.")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggestion applied.

stock_picking_auto_revert/models/stock_picking.py Outdated Show resolved Hide resolved
stock_picking_auto_revert/models/stock_picking.py Outdated Show resolved Hide resolved
stock_picking_auto_revert/tests/test_stock_picking.py Outdated Show resolved Hide resolved
Copy link

@GuillemCForgeFlow GuillemCForgeFlow left a comment

Choose a reason for hiding this comment

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

functional and code review 👍🏿
I'm not sure if it would be useful to add the reference of the original transfer on the Source Document for the newly created, just so the user has some more traceability on what has happened.

@AaronHForgeFlow AaronHForgeFlow force-pushed the 15.0-add-stock_picking_auto_revert branch from d8c959b to 861c733 Compare July 15, 2024 11:04
@AaronHForgeFlow
Copy link
Contributor Author

Thanks @GuillemCForgeFlow I added the original picking name between brackets, like this:

image

Copy link

@GuillemCForgeFlow GuillemCForgeFlow left a comment

Choose a reason for hiding this comment

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

LGTM! thanks for adding the suggestion 👍🏿

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jul 21, 2024
@AaronHForgeFlow AaronHForgeFlow force-pushed the 15.0-add-stock_picking_auto_revert branch from 861c733 to 24343d2 Compare August 27, 2024 15:13
@AaronHForgeFlow AaronHForgeFlow force-pushed the 15.0-add-stock_picking_auto_revert branch from 24343d2 to f122697 Compare December 11, 2024 09:39
@rousseldenis
Copy link
Contributor

@AaronHForgeFlow Maybe testing exceptions could be great

@AaronHForgeFlow AaronHForgeFlow force-pushed the 15.0-add-stock_picking_auto_revert branch from f122697 to 05ddb6c Compare December 11, 2024 11:23
@AaronHForgeFlow
Copy link
Contributor Author

@rousseldenis tests added :)

@rousseldenis
Copy link
Contributor

@rousseldenis tests added :)

A module that passed several versions :-)

move._check_restrictions()

def action_revert_recreate(self):
self.ensure_one()
Copy link
Contributor

Choose a reason for hiding this comment

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

And one more question.

Should'nt it be more interesting to do a wizard for that flow ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps. I did it this way because the users just want less clicks as possible. I prefer not to change it, if not necessary.

@AaronHForgeFlow AaronHForgeFlow force-pushed the 15.0-add-stock_picking_auto_revert branch from 05ddb6c to 02b3ccb Compare December 11, 2024 13:11
"You cannot revert this stock picking. Its stock moves are linked to "
"other moves. Origin pickings: {origin_pickings}. "
"Destination pickings: {destination_pickings}."
).format(
Copy link
Contributor

Choose a reason for hiding this comment

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

Ooops, don't use format() but use translation function arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sorry for this. It is now fixed.

@AaronHForgeFlow AaronHForgeFlow force-pushed the 15.0-add-stock_picking_auto_revert branch from 02b3ccb to 78a511a Compare December 11, 2024 17:03
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