OCA / stock-logistics-warehouse

Odoo Warehouse Management Addons
https://odoo-community.org/psc-teams/logistics-18
GNU Affero General Public License v3.0
320 stars 718 forks source link

[15.0][IMP] stock_inventory: adjust restriction #2051

Closed AaronHForgeFlow closed 4 months ago

AaronHForgeFlow commented 5 months ago

This change allows to create several inventory adjustments on the same location if the products involved are different

You may say that creating inventory adjustment in the same location by product category is not efficient and I agree with that. However, the possibility is there, and the constraint should not be raised in this case.

@ ForgeFlow

AaronHForgeFlow commented 5 months ago

CI fixed now :tada:

AaronHForgeFlow commented 5 months ago

@rousseldenis , @JordiMForgeFlow I dediced to fix the tests in the stock_cycle_count module, indeed the test that was failing was actually not testing anything as long the inventory adjustment was never created in that test.

for now I left the method _get_overlapping_inventories as self.ensure_one(), for the purpose of the PR that is sufficient. If this change is a blocking change then I can consider make it multi.

JordiMForgeFlow commented 5 months ago

@AaronHForgeFlow could you add some test to validate the new changes for the constrain?

AaronHForgeFlow commented 5 months ago

@JordiMForgeFlow Added the test. Also remove the constraint check in the action_in_progress method. It is not necessary as the constraint method depends in the state. Adapted a bit the code.

MiquelRForgeFlow commented 4 months ago

conflicts

AaronHForgeFlow commented 4 months ago

conflicts

rebased & solved

JoanSForgeFlow commented 4 months ago

Hi @AaronHForgeFlow

I've noticed we have overlapping PRs (https://github.com/OCA/stock-logistics-warehouse/pull/2021) . Here are my observations and proposal:

  1. Review of this PR:

    • This PR improves the system by allowing two stock inventories in the same location for different products.
    • However, when performing a general review of a product in a global location (like a warehouse), all interior sublocations are blocked.
    • In my opinion, only sublocations where the product being reviewed is located should be blocked.
    • Sublocations without any quant under review should remain accessible.
  2. My Proposal:

I hope this clarifies my proposal. Looking forward to your thoughts.

Thanks.

AaronHForgeFlow commented 4 months ago

I am closing this PR in favor of https://github.com/OCA/stock-logistics-warehouse/pull/2021/ Please do not delete the branch

The other PR covers more use cases than this one, and that is why it is ok to me to keep the other.