Skip to content

[18.0][stock_operating_unit] Access Errors on Inter-Warehouse Replenishment and Transfer Validation #823

@habibz6deh

Description

@habibz6deh

Module

stock_operating_unit

Describe the bug

When attempting an inter-warehouse transfer (replenishment) between two warehouses belonging to different Operating Units (OU), users encounter Access Errors in two specific stages.

  1. Replenishment Creation: A user assigned to the destination OU cannot create a replenishment rule that pulls from a source warehouse in a different OU (Access Error on stock.warehouse / stock.location).
  2. Transfer Validation: A user assigned to the source OU cannot validate the outgoing delivery order because it is linked to a move in the destination OU (Access Error on stock.move).

The strict record rules seem to prevent the cross-OU access required for the standard "Resupply from Warehouse" route to function.

To Reproduce

Affected versions: 18.0

Steps to reproduce the behavior:

1. Setup Configuration:

  • Operating Units: Create Main OU and Second OU.
  • Warehouses:
    • WH (My Company) -> Assigned to Main OU.
    • WH2 (Second Warehouse) -> Assigned to Second OU.
  • Users:
    • User 1: Assigned to Main OU. Role: Inventory Administrator.
    • User 2: Assigned to Second OU. Role: Inventory Administrator.
  • Routes: Configure a product with the "Supply Product from My Company" route (pulling from WH to supply WH2).

2. Scenario A (Creation Failure):

  1. Log in as User 2 (Second OU).
  2. Go to Replenishment and attempt to create a manual orderpoint for the product in WH2 (triggering a pull from WH).
  3. Result: The system raises an Access Error for stock.warehouse.

3. Scenario B (Validation Failure):

  1. (Workaround) Log in as Admin and create the replenishment rule for User 2. This generates a Delivery Order in WH and a Receipt in WH2.
  2. Log in as User 1 (Main OU).
  3. Open the Delivery Order in WH and click Validate.
  4. Result: The system raises an Access Error for stock.move.

Expected behavior

  1. User 2 should be able to trigger a replenishment for their own warehouse (WH2), even if the supply route originates from a different OU (WH).
  2. User 1 should be able to validate the outgoing Delivery Order from their warehouse (WH), without being blocked by the linked move in the destination OU.

Additional context

Error Log (Scenario A - User 2):

Uh-oh! Looks like you have stumbled upon some top-secret records. Sorry, User 2 (id=7) doesn't have 'read' access to: - Warehouse (stock.warehouse)

Error Log (Scenario B - User 1):

Uh-oh! Looks like you have stumbled upon some top-secret records. Sorry, User 1 (id=6) doesn't have 'read' access to: - Stock Move (stock.move)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions