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

[13.0] Add stock_checkout_sync #907

Closed
wants to merge 7 commits into from

Conversation

guewen
Copy link
Member

@guewen guewen commented May 19, 2020

Replaces #862

Regroup moves at the same location when they reach an operation type.

Example of use case:

  • We use several operation types for Picking Transfers (Pick Shelves, Pick Reserve)
  • We use several operation types for Packing (Pack, Pack Post)
  • The "Checkout Synchronization" flag is activated on the 2 Packing operation types
  • The Packing can occur in several areas (Packing/PACK1, Packing/PACK2, Packing/PACK3)

Based on these assumptions, we have these pickings, all for the same order:

  • SHELF001, pick 2 goods in the shelves
  • RESER001, pick 2 goods in the reserve
  • PACK001, pack 3 of the goods (2 from SHELF001, 1 from RESER001)
  • PPOST001, pack the remaining good of the reserve

The operator uses the button "Checkout Sync" on a pick transfer,
for instance SHELF001, and select Packing/PACK2 as destination.
We want all the lines that reach PACK001 to be updated with:

  • The move lines (except the one that goes to PPOST001) must now reach
    Packing/PACK2
  • The same moves' destination must reach Packing/PACK2 as well:
    we constrain the user to move the goods there as we want to move
    all the goods at the same place for the packing.

Selection_848

Works best when used with stock_available_to_promise_release:

  • When using the mentioned module, we assume that we release moves (which
    creates the whole chain of moves) only when we know that we have the
    quantities in stock (otherwise the module splits the delivery). Any exception
    (which is now rare when you release this ways) that would lead to a backorder
    is handled by canceling the remaining line.
  • When the module is not used, then the destination of the backorders may be
    changed at the same time

Compatible with stock_dynamic_routing.

@guewen guewen requested a review from grindtildeath May 19, 2020 11:29
@guewen guewen added this to the 13.0 milestone May 19, 2020
@guewen guewen force-pushed the 13.0-add-stock_checkout_sync branch 4 times, most recently from d843351 to 3b07412 Compare May 19, 2020 12:31
guewen added a commit to guewen/wms that referenced this pull request May 19, 2020
@guewen guewen force-pushed the 13.0-add-stock_checkout_sync branch from 3b07412 to 139aab5 Compare May 19, 2020 12:57
guewen added a commit to guewen/wms that referenced this pull request May 19, 2020
guewen added a commit to guewen/wms that referenced this pull request May 19, 2020
@guewen guewen force-pushed the 13.0-add-stock_checkout_sync branch from 139aab5 to 739d870 Compare May 20, 2020 05:53
Copy link
Contributor

@grindtildeath grindtildeath left a comment

Choose a reason for hiding this comment

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

Looks good overall, just some functions names to fix and questions.

stock_checkout_sync/models/stock_picking.py Show resolved Hide resolved
stock_checkout_sync/models/stock_picking.py Show resolved Hide resolved
stock_move_common_dest/models/stock_move.py Outdated Show resolved Hide resolved
stock_move_common_dest/models/stock_move.py Outdated Show resolved Hide resolved
stock_checkout_sync/models/stock_move.py Show resolved Hide resolved
@simahawk
Copy link
Contributor

@guewen had to solve a conflict to make pending merge aggregation work. Fill free to rebase and trash 314f5fb

@guewen guewen force-pushed the 13.0-add-stock_checkout_sync branch from 314f5fb to 3a44c64 Compare August 21, 2020 13:54
@guewen guewen force-pushed the 13.0-add-stock_checkout_sync branch from 4a193f1 to 04ccb9e Compare August 26, 2020 05:51
@sebalix
Copy link
Contributor

sebalix commented Aug 27, 2020

The test which fails in stock_available is not related to this PR, I think the variants created in the failing test ( https://github.com/OCA/stock-logistics-warehouse/blob/13.0/stock_available/tests/test_stock_available.py#L31-L55 ) should have different attributes to not trigger the constraint on flush call.

simahawk pushed a commit to simahawk/wms that referenced this pull request Oct 12, 2020
@simahawk
Copy link
Contributor

@sebalix @guewen anything we can do to unlock this?

@guewen guewen force-pushed the 13.0-add-stock_checkout_sync branch from 82364e7 to fbbec98 Compare December 22, 2020 10:37
@guewen
Copy link
Member Author

guewen commented Dec 22, 2020

I fixed the error with stock_available, but we have another unrelated error:

Traceback (most recent call last):
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/tests/test_inventory.py", line 38, in test_inventory_count_ops
operation = self._open_screen("inventory")
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/tests/common.py", line 68, in _open_screen
getattr(shuttle or self.shuttle, "switch_{}".format(mode))()
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/vertical_lift_shuttle.py", line 210, in switch_inventory
return self.action_open_screen()
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/vertical_lift_shuttle.py", line 155, in action_open_screen
operation.on_screen_open()
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/vertical_lift_operation_base.py", line 175, in on_screen_open
self.reset_steps()
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/vertical_lift_operation_inventory.py", line 196, in reset_steps
super().reset_steps()
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/vertical_lift_operation_base.py", line 167, in reset_steps
self.next_step()
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/vertical_lift_operation_base.py", line 147, in next_step
if not transition.action or transition.action(self):
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/vertical_lift_operation_inventory.py", line 36, in <lambda>
lambda self: self.select_next_inventory_line(),
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/vertical_lift_operation_inventory.py", line 242, in select_next_inventory_line
self.fetch_tray()
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/vertical_lift_operation_inventory.py", line 231, in fetch_tray
location.fetch_vertical_lift_tray()
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/stock_location.py", line 140, in fetch_vertical_lift_tray
tray.fetch_vertical_lift_tray(cell_location=self)
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/stock_location.py", line 142, in fetch_vertical_lift_tray
self._hardware_vertical_lift_fetch_tray(cell_location=cell_location)
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/stock_location.py", line 67, in _hardware_vertical_lift_fetch_tray
payload = self._hardware_vertical_lift_fetch_tray_payload(cell_location)
File "/home/travis/build/OCA/stock-logistics-warehouse/stock_vertical_lift/models/stock_location.py", line 118, in _hardware_vertical_lift_fetch_tray_payload
raise NotImplementedError()
NotImplementedError

This one happens because

vertical_lift_shuttle_id = fields.Many2one(
comodel_name="vertical.lift.shuttle",
compute="_compute_vertical_lift_shuttle_id",
store=True,
)

is not computed.

It fails after: odoo/odoo@3a6ac95

Add an assistant to select the same destination location for all the
moves that will reach the same transfer. Generally used on packing
locations.
guewen and others added 5 commits January 4, 2021 07:57
m is supposed to be part of moves_to_update.move_dest_ids, and
moves_to_update is already a subset of self so it's always True
The test creates 2 product.product on the same product.template,
which is illegal if they don't have different attribute values.

No error is raised, unless another modules runs a "flush", which
does the INSERT in database and fails with:

psycopg2.IntegrityError: duplicate key value violates unique constraint "product_product_combination_unique"
DETAIL:  Key (product_tmpl_id, combination_indices)=(31, ) already exists.
@guewen guewen force-pushed the 13.0-add-stock_checkout_sync branch from c5aa718 to d4d8ed7 Compare January 4, 2021 06:57
@guewen
Copy link
Member Author

guewen commented Jan 4, 2021

Tests are now successful after rebase (fixed by #1035).

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

@guewen
Copy link
Member Author

guewen commented Jan 4, 2021

Note: do not merge, will be moved to OCA/wms as asked by @jgrandguillaume

@simahawk
Copy link
Contributor

@guewen shall we close this in favor of OCA/wms#115 ?

@guewen guewen closed this Jan 12, 2021
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.

5 participants