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

[16.0][ADD] stock_quant_package_fast_move #1428

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

angelinaanaki
Copy link
Contributor

This PR is dependent on changes introduced in PR #1422, specifically on the module stock_picking_move_package_to_package.

@rousseldenis
Copy link
Contributor

rousseldenis commented Nov 15, 2023

@angelinaanaki Thanks for this. Couldn't you use a batch picking flow instead (several picking at once) - and maybe extend that process ?

@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from 05b91f5 to 8b5b8ab Compare November 15, 2023 08:54
@angelinaanaki angelinaanaki marked this pull request as ready for review November 15, 2023 09:00
@ivs-cetmix
Copy link
Member

@angelinaanaki Thanks for this. Couldn't you use a batch picking flow instead (several picking at once) - and maybe extend that process ?

Hi @rousseldenis just wondering why should we use the batch picking flow if we can transfer multiple package in a singe picking using package level?

@rousseldenis
Copy link
Contributor

@angelinaanaki Thanks for this. Couldn't you use a batch picking flow instead (several picking at once) - and maybe extend that process ?

Hi @rousseldenis just wondering why should we use the batch picking flow if we can transfer multiple package in a singe picking using package level?

Ok, need testing the flow

@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from f2fa39a to e48963d Compare November 15, 2023 13:43
Copy link
Member

@ivs-cetmix ivs-cetmix 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 LGTM. Please fix comment regarding link format in the /readme files and squash commits afterwards

stock_quant_package_fast_move/readme/CONTRIBUTORS.md Outdated Show resolved Hide resolved
@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from 58899f6 to 372a0b2 Compare November 21, 2023 12:53
Copy link

@Bearnard21 Bearnard21 left a comment

Choose a reason for hiding this comment

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

All features work as expected

@ivs-cetmix ivs-cetmix force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from 372a0b2 to f2d8214 Compare November 26, 2023 17:26
@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from 2669c53 to 4ae70da Compare December 10, 2023 13:43
Copy link

@Aldeigja Aldeigja left a comment

Choose a reason for hiding this comment

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

Functional LGTM

Copy link

@geomer198 geomer198 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

@DemchukM DemchukM left a comment

Choose a reason for hiding this comment

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

In some files, you have an incorrect license reference.
The link is http://www.gnu.org/licenses/lgpl and you need http://www.gnu.org/licenses/agpl

Please review the files and correct them.

Everything else is fine

Copy link

@DemchukM DemchukM left a comment

Choose a reason for hiding this comment

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

LGTM

or if the destination package does not belong to the specified location.
"""
# Check if the location is different from the current location
if location == self[0].location_id and not destination_package:
Copy link

Choose a reason for hiding this comment

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

Why do you only check the location_id in the first package?

What will happen if packages from different location_ids are selected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I can't spot where is that check? And why is this necessary that they are all in the same source location?

Suggested change
if location == self[0].location_id and not destination_package:
if location in self.location_id and not destination_package:

stock_quant_package_fast_move/models/res_company.py Outdated Show resolved Hide resolved
Comment on lines +89 to +165
def create_new_package(self):
"""
Create a new stock package.

Returns:
- package (recordset of stock.quant.package): The newly created package object.
"""
package = self.env["stock.quant.package"].create({})
return package
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just create a package inline?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe just create a package inline?

This is in case someone would need to implement some custom flow here

Copy link

@DemchukM DemchukM left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@yelizariev yelizariev left a comment

Choose a reason for hiding this comment

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

LGTM

picking.action_confirm()
picking.button_validate()
if no_validate:
Copy link
Member

Choose a reason for hiding this comment

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

Should't it be if not no_validate ?

If you check 'Don't Validate', the created internal picking won't be validated. Otherwise, it will be validated and the package will directly moved to the specified destination location

"""
Move packages to a specified location.

Parameters:
- location (recordset of stock.location): The destination location.
- destination_package (recordset of stock.quant.package, optional):
Optional destination package. If provided, it must belong to the specified location.
- no_validate (boolean, optional):
- validate (boolean, optional):
Copy link
Member

Choose a reason for hiding this comment

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

If set to True, the created picking will be validated. Otherwise it will remain in the "Ready" state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review. Could you please check it again?

Copy link
Member

@ivs-cetmix ivs-cetmix left a comment

Choose a reason for hiding this comment

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

LGTM

@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch 2 times, most recently from 9cdb07a to 8f56ef0 Compare February 15, 2024 16:04
@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from 8f56ef0 to 888da7c Compare February 26, 2024 21:08
}

def check_source_location(self):
if any(package.location_id != self[0].location_id for package in self):
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this restriction because this scenario is possible.

Copy link
Member

@ivs-cetmix ivs-cetmix left a comment

Choose a reason for hiding this comment

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

LGTM

@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch 2 times, most recently from 1bbcb4b to d0a585a Compare March 6, 2024 22:04
@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from 1c7779d to cbf149d Compare July 3, 2024 07:13
Copy link
Member

@GabbasovDinar GabbasovDinar left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 36 to 37
- validate (boolean, optional):
If set to True, the created picking will be validated.
Otherwise it will remain in the "Ready" state. Defaults to False.

Choose a reason for hiding this comment

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

validate is required in args, is this docstring accurate?

@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from 99bff74 to b70bc8b Compare August 3, 2024 11:26
@hoangtrann
Copy link

Tested and it's working as expected.

However, I noticed that when I choose not to Validate in the pop-up wizard, regardless of choosing Destination Package or Put in new Pack, the Package Content is blank.

image

Validating the picking and go back to Package Content, it's now showing.

@angelinaanaki
Copy link
Contributor Author

Tested and it's working as expected.

However, I noticed that when I choose not to Validate in the pop-up wizard, regardless of choosing Destination Package or Put in new Pack, the Package Content is blank.

image

Validating the picking and go back to Package Content, it's now showing.

@hoangtrann Thank you very much for your review! The issue was due to the moves being created only at the package level while in the 'draft' state, as seen here. I resolved this by adding the 'done' state after the picking confirmation. Could you please review it again and let me know your thoughts?

Copy link

@hoangtrann hoangtrann left a comment

Choose a reason for hiding this comment

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

Looking good, package is now showing content if not validate immediately

@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch 2 times, most recently from eb21513 to 874ec61 Compare August 15, 2024 06:25
Copy link
Member

Choose a reason for hiding this comment

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

stock_picking_move_package_to_package was merged, please remove it from thetest-requirements

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I’ve removed stock_picking_move_package_to_package from the test-requirements.

@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch 2 times, most recently from a1c45ce to 729119c Compare August 20, 2024 12:26
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from 729119c to d43ab73 Compare August 27, 2024 20:46
@angelinaanaki angelinaanaki force-pushed the 16.0-t3043-stock_quant_package_fast_move-new_module branch from ee64a74 to dafbc70 Compare August 27, 2024 21:36
@ivs-cetmix
Copy link
Member

Hey @OCA/logistics-maintainers would be great to have this PR merged. Not only it's already "ready for merge" but also has "fast" in the module name! 😄

Copy link
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

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

Just minor remarks. I wonder if all the options are necessary (validate & batch)?

What happens if the moved package was reserved by another operation? Do you want to allow the move?

string="Package Move Operation",
domain="[('show_entire_packs', '=', True)]",
)
use_batch_transfers = fields.Boolean()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any use for having this option?

"context": self.env.context,
}

def create_batch_transfer(
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
def create_batch_transfer(
def _move_with_batch_transfer(

use_batch_transfers = active_company.use_batch_transfers

if use_batch_transfers:
self.create_batch_transfer(
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
self.create_batch_transfer(
self._move_with_batch_transfer(

location, destination_package, validate, picking_type_id
)
else:
# Create a picking
Copy link
Contributor

Choose a reason for hiding this comment

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

If you create a method for above option, create also a method for this option like
_move_with_picking(location, destination_package, validate, picking_type_id)
to be consistent


return True

def create_new_package(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

If you need this hook, then move it inside the wizard as this serves the wizard only

"stock.location", "Destination Location", required=True
)
put_in_new_package = fields.Boolean("Put in New Package")
validate = fields.Boolean()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any use for not validating the movement?

Copy link
Member

Choose a reason for hiding this comment

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

@jbaudoux yes, sometimes we create a picking and then validate it later when goods a physically moved.

@@ -0,0 +1,15 @@
- Go to **Inventory -> Products -> Packages**.

- Open a package or select several packages in the list view. **Important**: All selected packages must be located in the same location.
Copy link
Contributor

Choose a reason for hiding this comment

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

The important restriction was dropped. This need to be removed then. And the location check here to be fixed https://github.com/OCA/stock-logistics-workflow/pull/1428/files#r1444030377

@ivs-cetmix
Copy link
Member

Just minor remarks. I wonder if all the options are necessary (validate & batch)?

What happens if the moved package was reserved by another operation? Do you want to allow the move?

Hi @jbaudoux , first of all - thank you for your review! Regarding your question - sounds reasonable. Let us check this.

Return created picking after move package to new location
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.