summaryrefslogtreecommitdiff
path: root/addons/stock
diff options
context:
space:
mode:
authorsvs-odoo <svs@odoo.com>2021-03-02 15:55:58 +0000
committersvs-odoo <svs@odoo.com>2021-03-23 13:58:02 +0000
commite48c86dfecbec7d6f99499ce6b772b0df3c77798 (patch)
tree704a8ac972f27589f8e95b5b16681ff84cc33c67 /addons/stock
parent5c2db20a14701f165adfecb391073c3d957081e9 (diff)
[FIX] stock: don't display assign SN for returns
Before this commit, when delivered qty. for a product tracked by serial numbers and then create a returns for this product, as the move is linked to its original returned move, when the detailed operations will be displayed, it will hide `lot_name` field and display the `lot_id`. The issue is it will still show the "Assign Serial Numbers" feature. As this feature is for the creation of new SN only (not for assign existing ones), it should be hidden in this case because it will lead to attempt to create already existing. How to reproduce: - Create a product tracked by serial numbers; - Add at least two qty. on hand for this product and create as many serial numbers, following by numbers (ex.: sn01, sn02, sn03, ...); - Make a delivery for at least two of this product and proceed it; - When it's done, make a return for this delivery; - Open the delivery's return and display the detailed operations, then use the "Assign Serial Numbers" to try to reassign the delivery SN. --> First, we will not see the SN on the move line (as `lot_id` is visible but `lot_name` is invisible). --> Second, you can't mark as done the return as it will try to create the SN but they already exist. To fix the issue, we can simply hide this feature when we hide the `lot_name` field. task-2474919 opw-2455971 closes odoo/odoo#68245 X-original-commit: fab1f31f70376d5477e67d153e2fa3c0f6477397 Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com> Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/stock')
-rw-r--r--addons/stock/models/stock_move.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py
index d5fc56476d8..03f8254e685 100644
--- a/addons/stock/models/stock_move.py
+++ b/addons/stock/models/stock_move.py
@@ -194,6 +194,7 @@ class StockMove(models.Model):
move.state in ('partially_available', 'assigned', 'confirmed') and
move.picking_type_id.use_create_lots and
not move.picking_type_id.use_existing_lots
+ and not move.origin_returned_move_id.id
)
@api.depends('picking_id.priority')