Skip to content

Commit

Permalink
[IMP] stock_picking_putaway_recompute: Apply first the move destinati…
Browse files Browse the repository at this point in the history
…on location

This is more correct as the original location before applying
the putaways is the stock move destination location.
  • Loading branch information
rousseldenis committed Nov 22, 2024
1 parent c60087c commit 84d7ec0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 26 deletions.
28 changes: 14 additions & 14 deletions stock_picking_putaway_recompute/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ unlock products for being reserved for another picking).
Configuration
=============

- Enable Stock locations in Inventory > Configuration > Settings
- In order to be able to recompute the putaways, you need to enable it
on the picking type level.
- Enable Stock locations in Inventory > Configuration > Settings
- In order to be able to recompute the putaways, you need to enable it
on the picking type level.

Usage
=====

- In a picking where the recompute operation is enabled (see
Configuration), the recompute is available on picking level and on
the detailed operations if enabled.
- If a putaway rule has been changed after product reservation, click
on the button 'Recompute putaways'. This will recompute the
destination locations on all detailed operations that have no done
quantity yet and no result package (as all operations for the same
package should go to the same destination).
- Moreover, the action is available on picking level and on detailed
operation one too.
- In a picking where the recompute operation is enabled (see
Configuration), the recompute is available on picking level and on the
detailed operations if enabled.
- If a putaway rule has been changed after product reservation, click on
the button 'Recompute putaways'. This will recompute the destination
locations on all detailed operations that have no done quantity yet
and no result package (as all operations for the same package should
go to the same destination).
- Moreover, the action is available on picking level and on detailed
operation one too.

Bug Tracker
===========
Expand All @@ -90,7 +90,7 @@ Authors
Contributors
------------

- Denis Roussel [email protected]
- Denis Roussel [email protected]

Maintainers
-----------
Expand Down
11 changes: 10 additions & 1 deletion stock_picking_putaway_recompute/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ def _recompute_putaways(self) -> None:
Launches the computation of putaways on operations that are
allowed to.
"""
self._filtered_for_putaway_recompute()._apply_putaway_strategy()
to_recompute_lines = self._filtered_for_putaway_recompute()
# Reset location destinations to their move destination
# First, protect the field from recomputations as
# value will be reaffected afterwards.
with to_recompute_lines.env.protecting(
["location_dest_id"], to_recompute_lines
):
for line in to_recompute_lines:
line.location_dest_id = line.move_id.location_dest_id
to_recompute_lines._apply_putaway_strategy()

def action_recompute_putaways(self):
self._recompute_putaways()
25 changes: 14 additions & 11 deletions stock_picking_putaway_recompute/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -408,13 +409,13 @@ <h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
<ul class="simple">
<li>In a picking where the recompute operation is enabled (see
Configuration), the recompute is available on picking level and on
the detailed operations if enabled.</li>
<li>If a putaway rule has been changed after product reservation, click
on the button ‘Recompute putaways’. This will recompute the
destination locations on all detailed operations that have no done
quantity yet and no result package (as all operations for the same
package should go to the same destination).</li>
Configuration), the recompute is available on picking level and on the
detailed operations if enabled.</li>
<li>If a putaway rule has been changed after product reservation, click on
the button ‘Recompute putaways’. This will recompute the destination
locations on all detailed operations that have no done quantity yet
and no result package (as all operations for the same package should
go to the same destination).</li>
<li>Moreover, the action is available on picking level and on detailed
operation one too.</li>
</ul>
Expand Down Expand Up @@ -444,7 +445,9 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down

0 comments on commit 84d7ec0

Please sign in to comment.