OCA / stock-logistics-workflow

Odoo Stock, Workflow and Organization
GNU Affero General Public License v3.0
226 stars 642 forks source link

[16.0][ADD] stock_quant_package_restrict_disposable_reuse #1629

Open MarinaAForgeFlow opened 2 months ago

MarinaAForgeFlow commented 2 months ago

This module restricts the reuse of disposable packages by not allowing to select them in stock move lines after they have already been allocated in a delivery.

This restriction can be activated or deactivated at package type level. So the user can select for each package type if the disposable packages can be reused or not.

Usage

MarinaAForgeFlow commented 2 months ago

I was wondering if when validating a delivery I should erase the package used from all the other non done transfers.

Because you could have cases where a package has been selected for a move line on a delivery but at the same time in other moves. Since the delivery is not validated, you can select it and no error will occur.

An scenario where this could make sense is when there are two deliveries to the same customer, and they pack the products in one same package. So maybe a solution would be to erase it form all the other transfers that are not deliveries?

Any thoughts on this?

JordiMForgeFlow commented 2 months ago

I was wondering if when validating a delivery I should erase the package used from all the other non done transfers.

Because you could have cases where a package has been selected for a move line on a delivery but at the same time in other moves. Since the delivery is not validated, you can select it and no error will occur.

An scenario where this could make sense is when there are two deliveries to the same customer, and they pack the products in one same package. So maybe a solution would be to erase it form all the other transfers that are not deliveries?

Any thoughts on this?

@MarinaAForgeFlow what if you consider that it has been used the moment it has been assigned to a delivery? Not when the delivery has been done? If the package has already been allocated to a delivery, it should not be able to be allocated to another one.

MarinaAForgeFlow commented 2 months ago

@MarinaAForgeFlow what if you consider that it has been used the moment it has been assigned to a delivery? Not when the delivery has been done? If the package has already been allocated to a delivery, it should not be able to be allocated to another one.

@JordiMForgeFlow I will do it like this. Thanks!

rousseldenis commented 2 months ago

Great. I would have added an option to activate the restriction or not (to avoid breaking standard behavior):

navarrorico commented 2 months ago

Good idea for a module!

  • Either at company level (in Inventory settings)

I think it should be by warehouse, rather than by company. Since the same company can have several warehouses with very different configurations.

MarinaAForgeFlow commented 2 months ago

@rousseldenis @navarrorico

I have finally made it at package type level. So you can define in the package type if you want to restrict the reuse of the disposable packages of that type or not. I believe this adds more flexibility, but let me know what you think :)

OCA-git-bot commented 2 months ago

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). 🤖