From b7dc655af853c90554aa04dd6e99787191d6a443 Mon Sep 17 00:00:00 2001 From: Iryna Vushnevska Date: Wed, 24 Jun 2020 18:30:02 +0300 Subject: [PATCH 01/14] [ADD] stock_picking_return_lot: create --- stock_picking_return_lot/README.rst | 0 stock_picking_return_lot/__init__.py | 1 + stock_picking_return_lot/__manifest__.py | 13 +++ .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 1 + stock_picking_return_lot/tests/__init__.py | 1 + .../tests/test_stock_picking_return_lot.py | 106 ++++++++++++++++++ stock_picking_return_lot/wizard/__init__.py | 1 + .../wizard/stock_picking_return.py | 32 ++++++ 9 files changed, 156 insertions(+) create mode 100644 stock_picking_return_lot/README.rst create mode 100644 stock_picking_return_lot/__init__.py create mode 100644 stock_picking_return_lot/__manifest__.py create mode 100644 stock_picking_return_lot/readme/CONTRIBUTORS.rst create mode 100644 stock_picking_return_lot/readme/DESCRIPTION.rst create mode 100644 stock_picking_return_lot/tests/__init__.py create mode 100644 stock_picking_return_lot/tests/test_stock_picking_return_lot.py create mode 100644 stock_picking_return_lot/wizard/__init__.py create mode 100644 stock_picking_return_lot/wizard/stock_picking_return.py diff --git a/stock_picking_return_lot/README.rst b/stock_picking_return_lot/README.rst new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/stock_picking_return_lot/__init__.py b/stock_picking_return_lot/__init__.py new file mode 100644 index 000000000000..40272379f721 --- /dev/null +++ b/stock_picking_return_lot/__init__.py @@ -0,0 +1 @@ +from . import wizard diff --git a/stock_picking_return_lot/__manifest__.py b/stock_picking_return_lot/__manifest__.py new file mode 100644 index 000000000000..97e8c02d5632 --- /dev/null +++ b/stock_picking_return_lot/__manifest__.py @@ -0,0 +1,13 @@ +# Copyright 2020 Camptocamp +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Stock Picking Return Lot", + "summary": "This module don't allows you to fill up return with serial lots" + "from initial picking.", + "version": "12.0.1.0.0", + "license": "AGPL-3", + "author": "Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-workflow/", + "depends": ["stock", "stock_account"], +} diff --git a/stock_picking_return_lot/readme/CONTRIBUTORS.rst b/stock_picking_return_lot/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..a68273075a04 --- /dev/null +++ b/stock_picking_return_lot/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Iryna Vyshnevska diff --git a/stock_picking_return_lot/readme/DESCRIPTION.rst b/stock_picking_return_lot/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..7d10c1a6f6b3 --- /dev/null +++ b/stock_picking_return_lot/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module propagates serial numbers or lots form initial picking to backorder. diff --git a/stock_picking_return_lot/tests/__init__.py b/stock_picking_return_lot/tests/__init__.py new file mode 100644 index 000000000000..13b150e4d3d0 --- /dev/null +++ b/stock_picking_return_lot/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_picking_return_lot diff --git a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py new file mode 100644 index 000000000000..ca2eefcd330a --- /dev/null +++ b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py @@ -0,0 +1,106 @@ +# Copyright 2020 Iryna Vyshnevska Camptocamp +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests import common + + +class StockPickingReturnLotTest(common.SavepointCase): + def setUp(self): + super().setUp() + self.picking_obj = self.env["stock.picking"] + partner = self.env["res.partner"].create({"name": "Test"}) + product = self.env["product.product"].create( + {"name": "test_product", "type": "product", "tracking": "serial"} + ) + lot_1 = self.env["stock.production.lot"].create( + {"name": "000001", "product_id": product.id} + ) + lot_2 = self.env["stock.production.lot"].create( + {"name": "000002", "product_id": product.id} + ) + picking_type_out = self.env.ref("stock.picking_type_out") + stock_location = self.env.ref("stock.stock_location_stock") + customer_location = self.env.ref("stock.stock_location_customers") + self.env["stock.quant"]._update_available_quantity( + product, stock_location, 1, lot_id=lot_1 + ) + self.env["stock.quant"]._update_available_quantity( + product, stock_location, 1, lot_id=lot_2 + ) + self.picking = self.picking_obj.create( + { + "partner_id": partner.id, + "picking_type_id": picking_type_out.id, + "location_id": stock_location.id, + "location_dest_id": customer_location.id, + "move_lines": [ + ( + 0, + 0, + { + "name": product.name, + "product_id": product.id, + "product_uom_qty": 2, + "product_uom": product.uom_id.id, + "location_id": stock_location.id, + "location_dest_id": customer_location.id, + }, + ) + ], + } + ) + self.picking.move_lines[0].write( + { + "move_line_ids": [ + ( + 0, + 0, + { + "product_id": product.id, + "qty_done": 1.0, + "lot_id": lot_1.id, + "product_uom_id": product.uom_id.id, + "location_id": stock_location.id, + "location_dest_id": customer_location.id, + }, + ), + ( + 0, + 0, + { + "product_id": product.id, + "qty_done": 1.0, + "lot_id": lot_2.id, + "product_uom_id": product.uom_id.id, + "location_id": stock_location.id, + "location_dest_id": customer_location.id, + "picking_id": self.picking.id, + }, + ), + ] + } + ) + self.picking.action_confirm() + self.picking.action_assign() + self.picking.move_lines._action_done() + + def create_return_wiz(self): + return ( + self.env["stock.return.picking"] + .with_context(active_id=self.picking.id) + .create({}) + ) + + def test_return(self): + wiz = self.create_return_wiz() + self.assertEqual(len(wiz.product_return_moves), 1) + picking_returned_id = wiz._create_returns()[0] + picking_returned = self.picking_obj.browse(picking_returned_id) + + self.assertEqual(len(picking_returned.move_line_ids), 2) + self.assertTrue( + picking_returned.move_line_ids.filtered(lambda l: l.lot_id.name == "000002") + ) + self.assertTrue( + picking_returned.move_line_ids.filtered(lambda l: l.lot_id.name == "000001") + ) diff --git a/stock_picking_return_lot/wizard/__init__.py b/stock_picking_return_lot/wizard/__init__.py new file mode 100644 index 000000000000..ad0b47c23ff7 --- /dev/null +++ b/stock_picking_return_lot/wizard/__init__.py @@ -0,0 +1 @@ +from . import stock_picking_return diff --git a/stock_picking_return_lot/wizard/stock_picking_return.py b/stock_picking_return_lot/wizard/stock_picking_return.py new file mode 100644 index 000000000000..75a8fd2a53d6 --- /dev/null +++ b/stock_picking_return_lot/wizard/stock_picking_return.py @@ -0,0 +1,32 @@ +# Copyright 2020 Iryna Vyshnevska Camptocamp +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ReturnPicking(models.TransientModel): + _inherit = "stock.return.picking" + + def _create_returns(self): + # return wizard cannot hold few lines for one move the implementation of + # stock_account will raise singltone error, to propagate lot_id we are + # mapping moves between pickings after move was created + res = super()._create_returns() + + picking_returned = self.env["stock.picking"].browse(res[0]) + ml_ids_to_update = picking_returned.move_line_ids.ids + moves_with_lot = self.product_return_moves.mapped( + "move_id.move_line_ids" + ).filtered(lambda l: l.lot_id) + + for line in moves_with_lot: + ml = fields.first( + picking_returned.move_line_ids.filtered( + lambda l: l.product_id == line.product_id + and l.id in ml_ids_to_update + ) + ) + if ml and not ml.lot_id and (ml.product_uom_qty == line.qty_done): + ml.lot_id = line.lot_id + ml_ids_to_update.remove(ml.id) + return res From 89b6acb88d664b93da15885e79dbfc19d6ec30ac Mon Sep 17 00:00:00 2001 From: Alessio Renda Date: Thu, 20 Jun 2024 11:03:50 +0200 Subject: [PATCH 02/14] [MIG] stock_picking_return_lot: Migration to 14.0 --- stock_picking_return_lot/README.rst | 85 ++++ stock_picking_return_lot/__manifest__.py | 7 +- .../i18n/stock_picking_return_lot.pot | 20 + .../readme/CONTRIBUTORS.rst | 9 + .../readme/DESCRIPTION.rst | 2 +- .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 432 ++++++++++++++++++ .../tests/test_stock_picking_return_lot.py | 3 +- .../wizard/stock_picking_return.py | 1 - 9 files changed, 552 insertions(+), 7 deletions(-) create mode 100644 stock_picking_return_lot/i18n/stock_picking_return_lot.pot create mode 100644 stock_picking_return_lot/static/description/icon.png create mode 100644 stock_picking_return_lot/static/description/index.html diff --git a/stock_picking_return_lot/README.rst b/stock_picking_return_lot/README.rst index e69de29bb2d1..832b91ece820 100644 --- a/stock_picking_return_lot/README.rst +++ b/stock_picking_return_lot/README.rst @@ -0,0 +1,85 @@ +======================== +Stock Picking Return Lot +======================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:82bec00d20c2089c95e126a794f2e88ca78ef051a5012b60b502d56e03ddb5cc + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-workflow/tree/14.0/stock_picking_return_lot + :alt: OCA/stock-logistics-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-14-0/stock-logistics-workflow-14-0-stock_picking_return_lot + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=14.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module propagates serial numbers or lots from initial picking to return picking. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Iryna Vyshnevska + +* `PyTech SRL `__: + + * Alessio Renda + * Sebastiano Picchi + +* `Ooops404 `__: + + * Foresti Francesco + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_return_lot/__manifest__.py b/stock_picking_return_lot/__manifest__.py index 97e8c02d5632..23c899eda65e 100644 --- a/stock_picking_return_lot/__manifest__.py +++ b/stock_picking_return_lot/__manifest__.py @@ -3,11 +3,10 @@ { "name": "Stock Picking Return Lot", - "summary": "This module don't allows you to fill up return with serial lots" - "from initial picking.", - "version": "12.0.1.0.0", + "summary": "Propagate SN/lots from origin picking to return picking.", + "version": "14.0.1.0.0", "license": "AGPL-3", "author": "Camptocamp, Odoo Community Association (OCA)", - "website": "https://github.com/OCA/stock-logistics-workflow/", + "website": "https://github.com/OCA/stock-logistics-workflow", "depends": ["stock", "stock_account"], } diff --git a/stock_picking_return_lot/i18n/stock_picking_return_lot.pot b/stock_picking_return_lot/i18n/stock_picking_return_lot.pot new file mode 100644 index 000000000000..a8485809e632 --- /dev/null +++ b/stock_picking_return_lot/i18n/stock_picking_return_lot.pot @@ -0,0 +1,20 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_return_lot +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_picking_return_lot +#: model:ir.model,name:stock_picking_return_lot.model_stock_return_picking +msgid "Return Picking" +msgstr "" + diff --git a/stock_picking_return_lot/readme/CONTRIBUTORS.rst b/stock_picking_return_lot/readme/CONTRIBUTORS.rst index a68273075a04..afc9a4ffe291 100644 --- a/stock_picking_return_lot/readme/CONTRIBUTORS.rst +++ b/stock_picking_return_lot/readme/CONTRIBUTORS.rst @@ -1 +1,10 @@ * Iryna Vyshnevska + +* `PyTech SRL `__: + + * Alessio Renda + * Sebastiano Picchi + +* `Ooops404 `__: + + * Foresti Francesco diff --git a/stock_picking_return_lot/readme/DESCRIPTION.rst b/stock_picking_return_lot/readme/DESCRIPTION.rst index 7d10c1a6f6b3..403bfca41de7 100644 --- a/stock_picking_return_lot/readme/DESCRIPTION.rst +++ b/stock_picking_return_lot/readme/DESCRIPTION.rst @@ -1 +1 @@ -This module propagates serial numbers or lots form initial picking to backorder. +This module propagates serial numbers or lots from initial picking to return picking. diff --git a/stock_picking_return_lot/static/description/icon.png b/stock_picking_return_lot/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_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3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/stock_picking_return_lot/static/description/index.html b/stock_picking_return_lot/static/description/index.html new file mode 100644 index 000000000000..72913b4e27b2 --- /dev/null +++ b/stock_picking_return_lot/static/description/index.html @@ -0,0 +1,432 @@ + + + + + +Stock Picking Return Lot + + + +
+

Stock Picking Return Lot

+ + +

Beta License: AGPL-3 OCA/stock-logistics-workflow Translate me on Weblate Try me on Runboat

+

This module propagates serial numbers or lots from initial picking to return picking.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

This module is part of the OCA/stock-logistics-workflow project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py index ca2eefcd330a..6ba77558cf62 100644 --- a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py +++ b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py @@ -87,12 +87,13 @@ def setUp(self): def create_return_wiz(self): return ( self.env["stock.return.picking"] - .with_context(active_id=self.picking.id) + .with_context(active_id=self.picking.id, active_model="stock.picking") .create({}) ) def test_return(self): wiz = self.create_return_wiz() + wiz._onchange_picking_id() self.assertEqual(len(wiz.product_return_moves), 1) picking_returned_id = wiz._create_returns()[0] picking_returned = self.picking_obj.browse(picking_returned_id) diff --git a/stock_picking_return_lot/wizard/stock_picking_return.py b/stock_picking_return_lot/wizard/stock_picking_return.py index 75a8fd2a53d6..6240270e3715 100644 --- a/stock_picking_return_lot/wizard/stock_picking_return.py +++ b/stock_picking_return_lot/wizard/stock_picking_return.py @@ -12,7 +12,6 @@ def _create_returns(self): # stock_account will raise singltone error, to propagate lot_id we are # mapping moves between pickings after move was created res = super()._create_returns() - picking_returned = self.env["stock.picking"].browse(res[0]) ml_ids_to_update = picking_returned.move_line_ids.ids moves_with_lot = self.product_return_moves.mapped( From 9ec3703109995cab4f73415ebf4ca16c31cf9ff7 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Fri, 21 Jun 2024 10:05:14 +0000 Subject: [PATCH 03/14] [UPD] Update stock_picking_return_lot.pot --- .../i18n/stock_picking_return_lot.pot | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/stock_picking_return_lot/i18n/stock_picking_return_lot.pot b/stock_picking_return_lot/i18n/stock_picking_return_lot.pot index a8485809e632..0bfc0d7d08c9 100644 --- a/stock_picking_return_lot/i18n/stock_picking_return_lot.pot +++ b/stock_picking_return_lot/i18n/stock_picking_return_lot.pot @@ -1,20 +1,34 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * stock_picking_return_lot +# * stock_picking_return_lot # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: stock_picking_return_lot +#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_picking_return_lot +#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking__id +msgid "ID" +msgstr "" + +#. module: stock_picking_return_lot +#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking____last_update +msgid "Last Modified on" +msgstr "" + #. module: stock_picking_return_lot #: model:ir.model,name:stock_picking_return_lot.model_stock_return_picking msgid "Return Picking" msgstr "" - From b0fc54f9607857dd48dc9ed9c79035746dd87c41 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 21 Jun 2024 10:11:38 +0000 Subject: [PATCH 04/14] [BOT] post-merge updates --- stock_picking_return_lot/README.rst | 2 +- stock_picking_return_lot/__manifest__.py | 2 +- .../static/description/index.html | 13 +++++-------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/stock_picking_return_lot/README.rst b/stock_picking_return_lot/README.rst index 832b91ece820..27a53291f713 100644 --- a/stock_picking_return_lot/README.rst +++ b/stock_picking_return_lot/README.rst @@ -7,7 +7,7 @@ Stock Picking Return Lot !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:82bec00d20c2089c95e126a794f2e88ca78ef051a5012b60b502d56e03ddb5cc + !! source digest: sha256:a039386ff4a4425200e457d180c9f74b09f1f2c552b1c685f531a1d26c1d4740 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/stock_picking_return_lot/__manifest__.py b/stock_picking_return_lot/__manifest__.py index 23c899eda65e..0cbf71f71209 100644 --- a/stock_picking_return_lot/__manifest__.py +++ b/stock_picking_return_lot/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock Picking Return Lot", "summary": "Propagate SN/lots from origin picking to return picking.", - "version": "14.0.1.0.0", + "version": "14.0.1.0.1", "license": "AGPL-3", "author": "Camptocamp, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-workflow", diff --git a/stock_picking_return_lot/static/description/index.html b/stock_picking_return_lot/static/description/index.html index 72913b4e27b2..b7f1a2c9e2d1 100644 --- a/stock_picking_return_lot/static/description/index.html +++ b/stock_picking_return_lot/static/description/index.html @@ -8,11 +8,10 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ +:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z 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. @@ -275,7 +274,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: gray; } /* line numbers */ +pre.code .ln { color: grey; } /* 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 } @@ -301,7 +300,7 @@ span.pre { white-space: pre } -span.problematic, pre.problematic { +span.problematic { color: red } span.section-subtitle { @@ -367,7 +366,7 @@

Stock Picking Return Lot

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:82bec00d20c2089c95e126a794f2e88ca78ef051a5012b60b502d56e03ddb5cc +!! source digest: sha256:a039386ff4a4425200e457d180c9f74b09f1f2c552b1c685f531a1d26c1d4740 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/stock-logistics-workflow Translate me on Weblate Try me on Runboat

This module propagates serial numbers or lots from initial picking to return picking.

@@ -417,9 +416,7 @@

Contributors

Maintainers

This module is maintained by the OCA.

- -Odoo Community Association - +Odoo Community Association

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.

From 4306fe80e853ba761e27929fc732414ce6282969 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 2 Sep 2024 12:47:32 +0200 Subject: [PATCH 05/14] [16.0][MIG] stock_picking_return_lot --- stock_picking_return_lot/README.rst | 10 +++++----- stock_picking_return_lot/__manifest__.py | 2 +- stock_picking_return_lot/static/description/index.html | 6 +++--- .../tests/test_stock_picking_return_lot.py | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/stock_picking_return_lot/README.rst b/stock_picking_return_lot/README.rst index 27a53291f713..d5fdf0132cc3 100644 --- a/stock_picking_return_lot/README.rst +++ b/stock_picking_return_lot/README.rst @@ -17,13 +17,13 @@ Stock Picking Return Lot :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-workflow/tree/14.0/stock_picking_return_lot + :target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_return_lot :alt: OCA/stock-logistics-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-14-0/stock-logistics-workflow-14-0-stock_picking_return_lot + :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_return_lot :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=14.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -41,7 +41,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -80,6 +80,6 @@ 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. -This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. +This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_return_lot/__manifest__.py b/stock_picking_return_lot/__manifest__.py index 0cbf71f71209..b4f955cd575f 100644 --- a/stock_picking_return_lot/__manifest__.py +++ b/stock_picking_return_lot/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock Picking Return Lot", "summary": "Propagate SN/lots from origin picking to return picking.", - "version": "14.0.1.0.1", + "version": "16.0.1.0.0", "license": "AGPL-3", "author": "Camptocamp, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-workflow", diff --git a/stock_picking_return_lot/static/description/index.html b/stock_picking_return_lot/static/description/index.html index b7f1a2c9e2d1..0e60bd768b83 100644 --- a/stock_picking_return_lot/static/description/index.html +++ b/stock_picking_return_lot/static/description/index.html @@ -368,7 +368,7 @@

Stock Picking Return Lot

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:a039386ff4a4425200e457d180c9f74b09f1f2c552b1c685f531a1d26c1d4740 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/stock-logistics-workflow Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/stock-logistics-workflow Translate me on Weblate Try me on Runboat

This module propagates serial numbers or lots from initial picking to return picking.

Table of contents

@@ -387,7 +387,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -420,7 +420,7 @@

Maintainers

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.

-

This module is part of the OCA/stock-logistics-workflow project on GitHub.

+

This module is part of the OCA/stock-logistics-workflow project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py index 6ba77558cf62..246943f75d5c 100644 --- a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py +++ b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py @@ -12,10 +12,10 @@ def setUp(self): product = self.env["product.product"].create( {"name": "test_product", "type": "product", "tracking": "serial"} ) - lot_1 = self.env["stock.production.lot"].create( + lot_1 = self.env["stock.lot"].create( {"name": "000001", "product_id": product.id} ) - lot_2 = self.env["stock.production.lot"].create( + lot_2 = self.env["stock.lot"].create( {"name": "000002", "product_id": product.id} ) picking_type_out = self.env.ref("stock.picking_type_out") From 99fb911215a7a33d1a6c0af9d2743fd4bb630142 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 2 Sep 2024 13:10:29 +0200 Subject: [PATCH 06/14] [IMP] stock_picking_return_lot: Add a lot field to the return wizard - Add a lot field to the return wizard and create a return line for each lot/product combination. - Use Stock Restrict Lot to track the accepted lot on the return picking. --- stock_picking_return_lot/README.rst | 16 +- stock_picking_return_lot/__init__.py | 2 +- stock_picking_return_lot/__manifest__.py | 6 +- .../readme/CONTRIBUTORS.rst | 4 + .../readme/DESCRIPTION.rst | 11 +- .../static/description/index.html | 15 +- .../tests/test_stock_picking_return_lot.py | 252 ++++++++++++------ stock_picking_return_lot/wizard/__init__.py | 1 - .../wizard/stock_picking_return.py | 31 --- stock_picking_return_lot/wizards/__init__.py | 2 + .../wizards/stock_return_picking.py | 97 +++++++ .../wizards/stock_return_picking.xml | 21 ++ .../wizards/stock_return_picking_line.py | 21 ++ 13 files changed, 363 insertions(+), 116 deletions(-) delete mode 100644 stock_picking_return_lot/wizard/__init__.py delete mode 100644 stock_picking_return_lot/wizard/stock_picking_return.py create mode 100644 stock_picking_return_lot/wizards/__init__.py create mode 100644 stock_picking_return_lot/wizards/stock_return_picking.py create mode 100644 stock_picking_return_lot/wizards/stock_return_picking.xml create mode 100644 stock_picking_return_lot/wizards/stock_return_picking_line.py diff --git a/stock_picking_return_lot/README.rst b/stock_picking_return_lot/README.rst index d5fdf0132cc3..c0272518cb2f 100644 --- a/stock_picking_return_lot/README.rst +++ b/stock_picking_return_lot/README.rst @@ -28,7 +28,16 @@ Stock Picking Return Lot |badge1| |badge2| |badge3| |badge4| |badge5| -This module propagates serial numbers or lots from initial picking to return picking. +When a product is tracked by lot or serial number and is returned by a customer, +it’s crucial to clearly indicate to the user which lot or serial number can be +accepted. This way, we prevent user from receiving a product with a lot or +serial number different from the original delivery. + +This module enhances the return process by creating a separate return line for +each product/lot and automatically pre-filling it with the lot from the original delivery. +It relies on the `Stock Restrict Lot `__ +module to enforce accurate tracking, ensuring that the reception order reflects +the correct lot or serial number that should be received. **Table of contents** @@ -52,6 +61,7 @@ Authors ~~~~~~~ * Camptocamp +* ACSONE SA/NV Contributors ~~~~~~~~~~~~ @@ -67,6 +77,10 @@ Contributors * Foresti Francesco +* `ACSONE SA/NV `__: + + * Souheil Bejaoui + Maintainers ~~~~~~~~~~~ diff --git a/stock_picking_return_lot/__init__.py b/stock_picking_return_lot/__init__.py index 40272379f721..5cb1c49143f5 100644 --- a/stock_picking_return_lot/__init__.py +++ b/stock_picking_return_lot/__init__.py @@ -1 +1 @@ -from . import wizard +from . import wizards diff --git a/stock_picking_return_lot/__manifest__.py b/stock_picking_return_lot/__manifest__.py index b4f955cd575f..912ac166b452 100644 --- a/stock_picking_return_lot/__manifest__.py +++ b/stock_picking_return_lot/__manifest__.py @@ -1,4 +1,5 @@ # Copyright 2020 Camptocamp +# Copyright 2024 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { @@ -6,7 +7,8 @@ "summary": "Propagate SN/lots from origin picking to return picking.", "version": "16.0.1.0.0", "license": "AGPL-3", - "author": "Camptocamp, Odoo Community Association (OCA)", + "author": "Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-workflow", - "depends": ["stock", "stock_account"], + "depends": ["stock", "stock_restrict_lot"], + "data": ["wizards/stock_return_picking.xml"], } diff --git a/stock_picking_return_lot/readme/CONTRIBUTORS.rst b/stock_picking_return_lot/readme/CONTRIBUTORS.rst index afc9a4ffe291..6f0a4bd87bd6 100644 --- a/stock_picking_return_lot/readme/CONTRIBUTORS.rst +++ b/stock_picking_return_lot/readme/CONTRIBUTORS.rst @@ -8,3 +8,7 @@ * `Ooops404 `__: * Foresti Francesco + +* `ACSONE SA/NV `__: + + * Souheil Bejaoui \ No newline at end of file diff --git a/stock_picking_return_lot/readme/DESCRIPTION.rst b/stock_picking_return_lot/readme/DESCRIPTION.rst index 403bfca41de7..9a30d3677db2 100644 --- a/stock_picking_return_lot/readme/DESCRIPTION.rst +++ b/stock_picking_return_lot/readme/DESCRIPTION.rst @@ -1 +1,10 @@ -This module propagates serial numbers or lots from initial picking to return picking. +When a product is tracked by lot or serial number and is returned by a customer, +it’s crucial to clearly indicate to the user which lot or serial number can be +accepted. This way, we prevent user from receiving a product with a lot or +serial number different from the original delivery. + +This module enhances the return process by creating a separate return line for +each product/lot and automatically pre-filling it with the lot from the original delivery. +It relies on the `Stock Restrict Lot `__ +module to enforce accurate tracking, ensuring that the reception order reflects +the correct lot or serial number that should be received. diff --git a/stock_picking_return_lot/static/description/index.html b/stock_picking_return_lot/static/description/index.html index 0e60bd768b83..282703fa14ed 100644 --- a/stock_picking_return_lot/static/description/index.html +++ b/stock_picking_return_lot/static/description/index.html @@ -369,7 +369,15 @@

Stock Picking Return Lot

!! source digest: sha256:a039386ff4a4425200e457d180c9f74b09f1f2c552b1c685f531a1d26c1d4740 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/stock-logistics-workflow Translate me on Weblate Try me on Runboat

-

This module propagates serial numbers or lots from initial picking to return picking.

+

When a product is tracked by lot or serial number and is returned by a customer, +it’s crucial to clearly indicate to the user which lot or serial number can be +accepted. This way, we prevent user from receiving a product with a lot or +serial number different from the original delivery.

+

This module enhances the return process by creating a separate return line for +each product/lot and automatically pre-filling it with the lot from the original delivery. +It relies on the Stock Restrict Lot +module to enforce accurate tracking, ensuring that the reception order reflects +the correct lot or serial number that should be received.

Table of contents

@@ -411,6 +420,10 @@

Contributors

  • Foresti Francesco <francesco.foresti@ooops404.com>
  • +
  • ACSONE SA/NV: +
  • diff --git a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py index 246943f75d5c..e4e3085739c1 100644 --- a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py +++ b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py @@ -1,107 +1,203 @@ # Copyright 2020 Iryna Vyshnevska Camptocamp # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo.tests import common +from odoo import Command +from odoo.tests.common import TransactionCase -class StockPickingReturnLotTest(common.SavepointCase): - def setUp(self): - super().setUp() - self.picking_obj = self.env["stock.picking"] - partner = self.env["res.partner"].create({"name": "Test"}) - product = self.env["product.product"].create( - {"name": "test_product", "type": "product", "tracking": "serial"} - ) - lot_1 = self.env["stock.lot"].create( - {"name": "000001", "product_id": product.id} - ) - lot_2 = self.env["stock.lot"].create( - {"name": "000002", "product_id": product.id} - ) - picking_type_out = self.env.ref("stock.picking_type_out") - stock_location = self.env.ref("stock.stock_location_stock") - customer_location = self.env.ref("stock.stock_location_customers") - self.env["stock.quant"]._update_available_quantity( - product, stock_location, 1, lot_id=lot_1 +class StockPickingReturnLotTest(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.picking_obj = cls.env["stock.picking"] + cls.partner = cls.env["res.partner"].create({"name": "Test"}) + cls.product = cls.env["product.product"].create( + {"name": "test_product", "type": "product", "tracking": "lot"} ) - self.env["stock.quant"]._update_available_quantity( - product, stock_location, 1, lot_id=lot_2 + cls.lot_1 = cls.env["stock.lot"].create( + {"name": "000001", "product_id": cls.product.id} + ) + cls.lot_2 = cls.env["stock.lot"].create( + {"name": "000002", "product_id": cls.product.id} + ) + cls.picking_type_out = cls.env.ref("stock.picking_type_out") + cls.stock_location = cls.env.ref("stock.stock_location_stock") + cls.customer_location = cls.env.ref("stock.stock_location_customers") + cls.env["stock.quant"]._update_available_quantity( + cls.product, cls.stock_location, 1, lot_id=cls.lot_1 ) - self.picking = self.picking_obj.create( + cls.env["stock.quant"]._update_available_quantity( + cls.product, cls.stock_location, 2, lot_id=cls.lot_2 + ) + cls.picking = cls.picking_obj.create( { - "partner_id": partner.id, - "picking_type_id": picking_type_out.id, - "location_id": stock_location.id, - "location_dest_id": customer_location.id, - "move_lines": [ - ( - 0, - 0, + "partner_id": cls.partner.id, + "picking_type_id": cls.picking_type_out.id, + "location_id": cls.stock_location.id, + "location_dest_id": cls.customer_location.id, + "move_ids": [ + Command.create( { - "name": product.name, - "product_id": product.id, - "product_uom_qty": 2, - "product_uom": product.uom_id.id, - "location_id": stock_location.id, - "location_dest_id": customer_location.id, + "name": cls.product.name, + "product_id": cls.product.id, + "product_uom_qty": 3, + "product_uom": cls.product.uom_id.id, + "location_id": cls.stock_location.id, + "location_dest_id": cls.customer_location.id, }, ) ], } ) - self.picking.move_lines[0].write( + cls.picking.action_confirm() + cls.picking.action_assign() + cls.picking.action_set_quantities_to_reservation() + cls.picking._action_done() + + @classmethod + def create_return_wiz(cls, picking): + return ( + cls.env["stock.return.picking"] + .with_context(active_id=picking.id, active_model="stock.picking") + .create({}) + ) + + def _create_validate_picking(self): + picking = self.picking_obj.create( { - "move_line_ids": [ - ( - 0, - 0, - { - "product_id": product.id, - "qty_done": 1.0, - "lot_id": lot_1.id, - "product_uom_id": product.uom_id.id, - "location_id": stock_location.id, - "location_dest_id": customer_location.id, - }, - ), - ( - 0, - 0, + "partner_id": self.partner.id, + "picking_type_id": self.picking_type_out.id, + "location_id": self.stock_location.id, + "location_dest_id": self.customer_location.id, + "move_ids": [ + Command.create( { - "product_id": product.id, - "qty_done": 1.0, - "lot_id": lot_2.id, - "product_uom_id": product.uom_id.id, - "location_id": stock_location.id, - "location_dest_id": customer_location.id, - "picking_id": self.picking.id, + "name": self.product.name, + "product_id": self.product.id, + "product_uom_qty": 1, + "product_uom": self.product.uom_id.id, + "location_id": self.stock_location.id, + "location_dest_id": self.customer_location.id, }, ), - ] + ], + } + ) + self.env["stock.move"].create( + { + "picking_id": picking.id, + "name": self.product.name, + "product_id": self.product.id, + "product_uom_qty": 1, + "product_uom": self.product.uom_id.id, + "location_id": self.stock_location.id, + "location_dest_id": self.customer_location.id, } ) - self.picking.action_confirm() - self.picking.action_assign() - self.picking.move_lines._action_done() + picking.action_confirm() + picking.action_assign() + picking.action_set_quantities_to_reservation() + picking._action_done() + return picking - def create_return_wiz(self): - return ( - self.env["stock.return.picking"] - .with_context(active_id=self.picking.id, active_model="stock.picking") - .create({}) + def test_partial_return(self): + wiz = self.create_return_wiz(self.picking) + wiz._onchange_picking_id() + self.assertEqual(len(wiz.product_return_moves), 2) + return_line_1 = wiz.product_return_moves.filtered( + lambda m, lot=self.lot_1: m.lot_id == lot + ) + return_line_2 = wiz.product_return_moves.filtered( + lambda m, lot=self.lot_2: m.lot_id == lot + ) + self.assertEqual(return_line_1.quantity, 1) + self.assertEqual(return_line_2.quantity, 2) + return_line_2.quantity = 1 + picking_returned_id = wiz._create_returns()[0] + picking_returned = self.picking_obj.browse(picking_returned_id) + move_1 = picking_returned.move_ids.filtered( + lambda m, lot=self.lot_1: m.restrict_lot_id == lot + ) + move_2 = picking_returned.move_ids.filtered( + lambda m, lot=self.lot_2: m.restrict_lot_id == lot ) + self.assertEqual(move_1.move_line_ids.lot_id, self.lot_1) + self.assertEqual(move_2.move_line_ids.lot_id, self.lot_2) + self.assertEqual(move_2.product_qty, 1) - def test_return(self): - wiz = self.create_return_wiz() + def test_full_return_after_partial_return(self): + self.test_partial_return() + wiz = self.create_return_wiz(self.picking) wiz._onchange_picking_id() - self.assertEqual(len(wiz.product_return_moves), 1) + self.assertEqual(len(wiz.product_return_moves), 2) + + return_line_1 = wiz.product_return_moves.filtered( + lambda m, lot=self.lot_1: m.lot_id == lot + ) + return_line_2 = wiz.product_return_moves.filtered( + lambda m, lot=self.lot_2: m.lot_id == lot + ) + self.assertEqual(return_line_1.quantity, 0) + self.assertEqual(return_line_2.quantity, 1) + picking_returned_id = wiz._create_returns()[0] + picking_returned = self.picking_obj.browse(picking_returned_id) + move_1 = picking_returned.move_ids.filtered( + lambda m, lot=self.lot_1: m.restrict_lot_id == lot + ) + move_2 = picking_returned.move_ids.filtered( + lambda m, lot=self.lot_2: m.restrict_lot_id == lot + ) + self.assertFalse(move_1) + self.assertEqual(move_2.move_line_ids.lot_id, self.lot_2) + self.assertEqual(move_2.product_qty, 1) + + def test_multiple_move_same_product_different_lot(self): + self.env["stock.quant"]._update_available_quantity( + self.product, self.stock_location, 1, lot_id=self.lot_1 + ) + self.env["stock.quant"]._update_available_quantity( + self.product, self.stock_location, 1, lot_id=self.lot_2 + ) + picking = self._create_validate_picking() + wiz = self.create_return_wiz(picking) + wiz._onchange_picking_id() + self.assertEqual(len(wiz.product_return_moves), 2) + return_line_1 = wiz.product_return_moves.filtered( + lambda m, lot=self.lot_1: m.lot_id == lot + ) + return_line_2 = wiz.product_return_moves.filtered( + lambda m, lot=self.lot_2: m.lot_id == lot + ) + self.assertEqual(return_line_1.quantity, 1) + self.assertEqual(return_line_2.quantity, 1) picking_returned_id = wiz._create_returns()[0] picking_returned = self.picking_obj.browse(picking_returned_id) + move_1 = picking_returned.move_ids.filtered( + lambda m, lot=self.lot_1: m.restrict_lot_id == lot + ) + move_2 = picking_returned.move_ids.filtered( + lambda m, lot=self.lot_2: m.restrict_lot_id == lot + ) + self.assertEqual(move_1.move_line_ids.lot_id, self.lot_1) + self.assertEqual(move_2.move_line_ids.lot_id, self.lot_2) + self.assertEqual(move_2.product_qty, 1) - self.assertEqual(len(picking_returned.move_line_ids), 2) - self.assertTrue( - picking_returned.move_line_ids.filtered(lambda l: l.lot_id.name == "000002") + def test_multiple_move_same_product_same_lot(self): + self.env["stock.quant"]._update_available_quantity( + self.product, self.stock_location, 2, lot_id=self.lot_1 + ) + picking = self._create_validate_picking() + wiz = self.create_return_wiz(picking) + wiz._onchange_picking_id() + self.assertEqual(len(wiz.product_return_moves), 1) + return_line_1 = wiz.product_return_moves.filtered( + lambda m, lot=self.lot_1: m.lot_id == lot ) - self.assertTrue( - picking_returned.move_line_ids.filtered(lambda l: l.lot_id.name == "000001") + self.assertEqual(return_line_1.quantity, 2) + picking_returned_id = wiz._create_returns()[0] + picking_returned = self.picking_obj.browse(picking_returned_id) + move_1 = picking_returned.move_ids.filtered( + lambda m, lot=self.lot_1: m.restrict_lot_id == lot ) + self.assertEqual(move_1.move_line_ids.lot_id, self.lot_1) + self.assertEqual(move_1.product_qty, 2) diff --git a/stock_picking_return_lot/wizard/__init__.py b/stock_picking_return_lot/wizard/__init__.py deleted file mode 100644 index ad0b47c23ff7..000000000000 --- a/stock_picking_return_lot/wizard/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import stock_picking_return diff --git a/stock_picking_return_lot/wizard/stock_picking_return.py b/stock_picking_return_lot/wizard/stock_picking_return.py deleted file mode 100644 index 6240270e3715..000000000000 --- a/stock_picking_return_lot/wizard/stock_picking_return.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2020 Iryna Vyshnevska Camptocamp -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import fields, models - - -class ReturnPicking(models.TransientModel): - _inherit = "stock.return.picking" - - def _create_returns(self): - # return wizard cannot hold few lines for one move the implementation of - # stock_account will raise singltone error, to propagate lot_id we are - # mapping moves between pickings after move was created - res = super()._create_returns() - picking_returned = self.env["stock.picking"].browse(res[0]) - ml_ids_to_update = picking_returned.move_line_ids.ids - moves_with_lot = self.product_return_moves.mapped( - "move_id.move_line_ids" - ).filtered(lambda l: l.lot_id) - - for line in moves_with_lot: - ml = fields.first( - picking_returned.move_line_ids.filtered( - lambda l: l.product_id == line.product_id - and l.id in ml_ids_to_update - ) - ) - if ml and not ml.lot_id and (ml.product_uom_qty == line.qty_done): - ml.lot_id = line.lot_id - ml_ids_to_update.remove(ml.id) - return res diff --git a/stock_picking_return_lot/wizards/__init__.py b/stock_picking_return_lot/wizards/__init__.py new file mode 100644 index 000000000000..18b78728aae5 --- /dev/null +++ b/stock_picking_return_lot/wizards/__init__.py @@ -0,0 +1,2 @@ +from . import stock_return_picking +from . import stock_return_picking_line diff --git a/stock_picking_return_lot/wizards/stock_return_picking.py b/stock_picking_return_lot/wizards/stock_return_picking.py new file mode 100644 index 000000000000..ce744748954f --- /dev/null +++ b/stock_picking_return_lot/wizards/stock_return_picking.py @@ -0,0 +1,97 @@ +# Copyright 2020 Iryna Vyshnevska Camptocamp +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from collections import defaultdict + +from odoo import api, models +from odoo.tools.float_utils import float_round + + +class ReturnPicking(models.TransientModel): + _inherit = "stock.return.picking" + + def _get_qty_done_by_product_lot(self): + res = defaultdict(float) + for group in self.env["stock.move.line"].read_group( + [ + ("picking_id", "=", self.picking_id.id), + ("state", "=", "done"), + ("move_id.scrapped", "=", False), + ], + ["qty_done:sum"], + ["product_id", "lot_id"], + lazy=False, + ): + lot_id = group.get("lot_id")[0] if group.get("lot_id") else False + product_id = group.get("product_id")[0] + qty_done = group.get("qty_done") + res[(product_id, lot_id)] += qty_done + return res + + @api.onchange("picking_id") + def _onchange_picking_id(self): + res = super()._onchange_picking_id() + product_return_moves = [(5,)] + line_fields = [f for f in self.env["stock.return.picking.line"]._fields.keys()] + product_return_moves_data_tmpl = self.env[ + "stock.return.picking.line" + ].default_get(line_fields) + qty_done_by_product_lot = self._get_qty_done_by_product_lot() + for (product_id, lot_id), qty_done in qty_done_by_product_lot.items(): + product_return_moves_data = dict(product_return_moves_data_tmpl) + product_return_moves_data.update( + self._prepare_stock_return_picking_line_vals( + product_id, lot_id, qty_done + ) + ) + product_return_moves.append((0, 0, product_return_moves_data)) + if self.picking_id: + self.product_return_moves = product_return_moves + return res + + @api.model + def _prepare_stock_return_picking_line_vals(self, product_id, lot_id, qty_done): + moves = self.picking_id.move_line_ids.filtered( + lambda ml, p_id=product_id, l_id=lot_id: ml.product_id.id == p_id + and ml.lot_id.id == l_id + ).move_id + quantity = qty_done + for dest_move in moves.move_dest_ids: + if ( + not dest_move.origin_returned_move_id + or dest_move.origin_returned_move_id not in moves + ): + continue + + if ( + dest_move.restrict_lot_id + and dest_move.restrict_lot_id.id == lot_id + or not lot_id + ): + if dest_move.state in ("partially_available", "assigned"): + quantity -= sum(dest_move.move_line_ids.mapped("reserved_qty")) + elif dest_move.state == "done": + quantity -= dest_move.product_qty + quantity = float_round( + quantity, precision_rounding=moves.product_id.uom_id.rounding + ) + return { + "product_id": moves.product_id.id, + "quantity": quantity, + "move_id": moves[0].id, + "uom_id": moves.product_id.uom_id.id, + "lot_id": lot_id, + } + + def _prepare_move_default_values(self, return_line, new_picking): + vals = super()._prepare_move_default_values(return_line, new_picking) + vals["restrict_lot_id"] = return_line.lot_id.id + return vals + + def _create_returns(self): + res = super()._create_returns() + picking_returned = self.env["stock.picking"].browse(res[0]) + for ml in picking_returned.move_line_ids: + ml.lot_id = ml.move_id.restrict_lot_id + return res diff --git a/stock_picking_return_lot/wizards/stock_return_picking.xml b/stock_picking_return_lot/wizards/stock_return_picking.xml new file mode 100644 index 000000000000..1594f0134451 --- /dev/null +++ b/stock_picking_return_lot/wizards/stock_return_picking.xml @@ -0,0 +1,21 @@ + + + + + stock.return.picking + + + + + + + + + diff --git a/stock_picking_return_lot/wizards/stock_return_picking_line.py b/stock_picking_return_lot/wizards/stock_return_picking_line.py new file mode 100644 index 000000000000..fc6e391b60aa --- /dev/null +++ b/stock_picking_return_lot/wizards/stock_return_picking_line.py @@ -0,0 +1,21 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class StockReturnPickingLine(models.TransientModel): + + _inherit = "stock.return.picking.line" + + lot_id = fields.Many2one( + "stock.lot", + string="Lot/Serial Number", + domain="[('product_id', '=', product_id)]", + ) + lots_visible = fields.Boolean(compute="_compute_lots_visible") + + @api.depends("product_id.tracking") + def _compute_lots_visible(self): + for rec in self: + rec.lots_visible = rec.product_id.tracking != "none" From a1a8597db92169f0a2ed69b51c79d2761b75f298 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Mon, 2 Sep 2024 11:38:27 +0000 Subject: [PATCH 07/14] [UPD] Update stock_picking_return_lot.pot --- .../i18n/stock_picking_return_lot.pot | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/stock_picking_return_lot/i18n/stock_picking_return_lot.pot b/stock_picking_return_lot/i18n/stock_picking_return_lot.pot index 0bfc0d7d08c9..37c714033d36 100644 --- a/stock_picking_return_lot/i18n/stock_picking_return_lot.pot +++ b/stock_picking_return_lot/i18n/stock_picking_return_lot.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -14,21 +14,21 @@ msgstr "" "Plural-Forms: \n" #. module: stock_picking_return_lot -#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking__display_name -msgid "Display Name" +#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking_line__lot_id +msgid "Lot/Serial Number" msgstr "" #. module: stock_picking_return_lot -#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking__id -msgid "ID" +#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking_line__lots_visible +msgid "Lots Visible" msgstr "" #. module: stock_picking_return_lot -#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking____last_update -msgid "Last Modified on" +#: model:ir.model,name:stock_picking_return_lot.model_stock_return_picking +msgid "Return Picking" msgstr "" #. module: stock_picking_return_lot -#: model:ir.model,name:stock_picking_return_lot.model_stock_return_picking -msgid "Return Picking" +#: model:ir.model,name:stock_picking_return_lot.model_stock_return_picking_line +msgid "Return Picking Line" msgstr "" From f2ddf6397b7588cc3d4ca848b7e62eecd8dd24d5 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 2 Sep 2024 11:44:25 +0000 Subject: [PATCH 08/14] [BOT] post-merge updates --- stock_picking_return_lot/README.rst | 2 +- .../static/description/index.html | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/stock_picking_return_lot/README.rst b/stock_picking_return_lot/README.rst index c0272518cb2f..591fa65dc046 100644 --- a/stock_picking_return_lot/README.rst +++ b/stock_picking_return_lot/README.rst @@ -7,7 +7,7 @@ Stock Picking Return Lot !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:a039386ff4a4425200e457d180c9f74b09f1f2c552b1c685f531a1d26c1d4740 + !! source digest: sha256:8ec4c5ed4b5f33201a45a5ca385efb9e46aa1bde41e4e6e7e30b005b4e3252e5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/stock_picking_return_lot/static/description/index.html b/stock_picking_return_lot/static/description/index.html index 282703fa14ed..231cd2c70a5c 100644 --- a/stock_picking_return_lot/static/description/index.html +++ b/stock_picking_return_lot/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -: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. @@ -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 } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -366,7 +367,7 @@

    Stock Picking Return Lot

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:a039386ff4a4425200e457d180c9f74b09f1f2c552b1c685f531a1d26c1d4740 +!! source digest: sha256:8ec4c5ed4b5f33201a45a5ca385efb9e46aa1bde41e4e6e7e30b005b4e3252e5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

    Beta License: AGPL-3 OCA/stock-logistics-workflow Translate me on Weblate Try me on Runboat

    When a product is tracked by lot or serial number and is returned by a customer, @@ -429,7 +430,9 @@

    Contributors

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +Odoo Community Association +

    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.

    From 24789009f5c67147bf230c1fbfe905ec8846a512 Mon Sep 17 00:00:00 2001 From: mymage Date: Wed, 4 Sep 2024 07:19:18 +0000 Subject: [PATCH 09/14] Added translation using Weblate (Italian) --- stock_picking_return_lot/i18n/it.po | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 stock_picking_return_lot/i18n/it.po diff --git a/stock_picking_return_lot/i18n/it.po b/stock_picking_return_lot/i18n/it.po new file mode 100644 index 000000000000..97f8fefd2c84 --- /dev/null +++ b/stock_picking_return_lot/i18n/it.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_return_lot +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: stock_picking_return_lot +#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking_line__lot_id +msgid "Lot/Serial Number" +msgstr "" + +#. module: stock_picking_return_lot +#: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking_line__lots_visible +msgid "Lots Visible" +msgstr "" + +#. module: stock_picking_return_lot +#: model:ir.model,name:stock_picking_return_lot.model_stock_return_picking +msgid "Return Picking" +msgstr "" + +#. module: stock_picking_return_lot +#: model:ir.model,name:stock_picking_return_lot.model_stock_return_picking_line +msgid "Return Picking Line" +msgstr "" From fc37db4a4c0c0e1ab877d5a93306856339809575 Mon Sep 17 00:00:00 2001 From: mymage Date: Wed, 4 Sep 2024 07:19:35 +0000 Subject: [PATCH 10/14] Translated using Weblate (Italian) Currently translated at 100.0% (4 of 4 strings) Translation: stock-logistics-workflow-16.0/stock-logistics-workflow-16.0-stock_picking_return_lot Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_return_lot/it/ --- stock_picking_return_lot/i18n/it.po | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/stock_picking_return_lot/i18n/it.po b/stock_picking_return_lot/i18n/it.po index 97f8fefd2c84..b2e0b5230694 100644 --- a/stock_picking_return_lot/i18n/it.po +++ b/stock_picking_return_lot/i18n/it.po @@ -6,30 +6,32 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2024-09-04 10:06+0000\n" +"Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" #. module: stock_picking_return_lot #: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking_line__lot_id msgid "Lot/Serial Number" -msgstr "" +msgstr "Numero di lotto/serie" #. module: stock_picking_return_lot #: model:ir.model.fields,field_description:stock_picking_return_lot.field_stock_return_picking_line__lots_visible msgid "Lots Visible" -msgstr "" +msgstr "Lotti visibili" #. module: stock_picking_return_lot #: model:ir.model,name:stock_picking_return_lot.model_stock_return_picking msgid "Return Picking" -msgstr "" +msgstr "Prelievo di reso" #. module: stock_picking_return_lot #: model:ir.model,name:stock_picking_return_lot.model_stock_return_picking_line msgid "Return Picking Line" -msgstr "" +msgstr "Riga prelievo di reso" From 9597d919e17c3df3fee19ac9f89f1a98c7b75bdf Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Wed, 18 Sep 2024 17:01:56 +0200 Subject: [PATCH 11/14] [FIX] stock_picking_return_lot: group return line by move and lot In case a picking out contains multiple moves for the same product/lot, it's essential to split the return lines by lot move to ensure the correct linking between the return move and the delivery move. --- .../tests/test_stock_picking_return_lot.py | 32 ++++++++++++------- .../wizards/stock_return_picking.py | 31 ++++++++---------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py index e4e3085739c1..80da45e6d382 100644 --- a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py +++ b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py @@ -62,7 +62,9 @@ def create_return_wiz(cls, picking): .create({}) ) - def _create_validate_picking(self): + def _create_picking(self, product=None): + if not product: + product = self.product picking = self.picking_obj.create( { "partner_id": self.partner.id, @@ -72,10 +74,10 @@ def _create_validate_picking(self): "move_ids": [ Command.create( { - "name": self.product.name, - "product_id": self.product.id, + "name": product.name, + "product_id": product.id, "product_uom_qty": 1, - "product_uom": self.product.uom_id.id, + "product_uom": product.uom_id.id, "location_id": self.stock_location.id, "location_dest_id": self.customer_location.id, }, @@ -86,14 +88,18 @@ def _create_validate_picking(self): self.env["stock.move"].create( { "picking_id": picking.id, - "name": self.product.name, - "product_id": self.product.id, + "name": product.name, + "product_id": product.id, "product_uom_qty": 1, "product_uom": self.product.uom_id.id, "location_id": self.stock_location.id, "location_dest_id": self.customer_location.id, } ) + return picking + + def _create_validate_picking(self): + picking = self._create_picking() picking.action_confirm() picking.action_assign() picking.action_set_quantities_to_reservation() @@ -189,15 +195,17 @@ def test_multiple_move_same_product_same_lot(self): picking = self._create_validate_picking() wiz = self.create_return_wiz(picking) wiz._onchange_picking_id() - self.assertEqual(len(wiz.product_return_moves), 1) - return_line_1 = wiz.product_return_moves.filtered( + self.assertEqual(len(wiz.product_return_moves), 2) + return_lines = wiz.product_return_moves.filtered( lambda m, lot=self.lot_1: m.lot_id == lot ) - self.assertEqual(return_line_1.quantity, 2) + self.assertEqual(return_lines[0].quantity, 1) + self.assertEqual(return_lines[1].quantity, 1) picking_returned_id = wiz._create_returns()[0] picking_returned = self.picking_obj.browse(picking_returned_id) - move_1 = picking_returned.move_ids.filtered( + moves = picking_returned.move_ids.filtered( lambda m, lot=self.lot_1: m.restrict_lot_id == lot ) - self.assertEqual(move_1.move_line_ids.lot_id, self.lot_1) - self.assertEqual(move_1.product_qty, 2) + self.assertEqual(moves.move_line_ids.lot_id, self.lot_1) + self.assertEqual(moves[0].product_qty, 1) + self.assertEqual(moves[1].product_qty, 1) diff --git a/stock_picking_return_lot/wizards/stock_return_picking.py b/stock_picking_return_lot/wizards/stock_return_picking.py index ce744748954f..a6e0e140f7e4 100644 --- a/stock_picking_return_lot/wizards/stock_return_picking.py +++ b/stock_picking_return_lot/wizards/stock_return_picking.py @@ -20,13 +20,13 @@ def _get_qty_done_by_product_lot(self): ("move_id.scrapped", "=", False), ], ["qty_done:sum"], - ["product_id", "lot_id"], + ["move_id", "lot_id"], lazy=False, ): lot_id = group.get("lot_id")[0] if group.get("lot_id") else False - product_id = group.get("product_id")[0] + move_id = group.get("move_id")[0] qty_done = group.get("qty_done") - res[(product_id, lot_id)] += qty_done + res[(move_id, lot_id)] += qty_done return res @api.onchange("picking_id") @@ -38,12 +38,10 @@ def _onchange_picking_id(self): "stock.return.picking.line" ].default_get(line_fields) qty_done_by_product_lot = self._get_qty_done_by_product_lot() - for (product_id, lot_id), qty_done in qty_done_by_product_lot.items(): + for (move_id, lot_id), qty_done in qty_done_by_product_lot.items(): product_return_moves_data = dict(product_return_moves_data_tmpl) product_return_moves_data.update( - self._prepare_stock_return_picking_line_vals( - product_id, lot_id, qty_done - ) + self._prepare_stock_return_picking_line_vals(move_id, lot_id, qty_done) ) product_return_moves.append((0, 0, product_return_moves_data)) if self.picking_id: @@ -51,16 +49,13 @@ def _onchange_picking_id(self): return res @api.model - def _prepare_stock_return_picking_line_vals(self, product_id, lot_id, qty_done): - moves = self.picking_id.move_line_ids.filtered( - lambda ml, p_id=product_id, l_id=lot_id: ml.product_id.id == p_id - and ml.lot_id.id == l_id - ).move_id + def _prepare_stock_return_picking_line_vals(self, move_id, lot_id, qty_done): + move = self.env["stock.move"].browse(move_id) quantity = qty_done - for dest_move in moves.move_dest_ids: + for dest_move in move.move_dest_ids: if ( not dest_move.origin_returned_move_id - or dest_move.origin_returned_move_id not in moves + or dest_move.origin_returned_move_id != move ): continue @@ -74,13 +69,13 @@ def _prepare_stock_return_picking_line_vals(self, product_id, lot_id, qty_done): elif dest_move.state == "done": quantity -= dest_move.product_qty quantity = float_round( - quantity, precision_rounding=moves.product_id.uom_id.rounding + quantity, precision_rounding=move.product_id.uom_id.rounding ) return { - "product_id": moves.product_id.id, + "product_id": move.product_id.id, "quantity": quantity, - "move_id": moves[0].id, - "uom_id": moves.product_id.uom_id.id, + "move_id": move.id, + "uom_id": move.product_id.uom_id.id, "lot_id": lot_id, } From 9de03bed248d4ef7e36b0948b4f72523d8d46932 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 30 Sep 2024 09:28:25 +0000 Subject: [PATCH 12/14] [BOT] post-merge updates --- stock_picking_return_lot/README.rst | 2 +- stock_picking_return_lot/__manifest__.py | 2 +- stock_picking_return_lot/static/description/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stock_picking_return_lot/README.rst b/stock_picking_return_lot/README.rst index 591fa65dc046..a9c2872c9955 100644 --- a/stock_picking_return_lot/README.rst +++ b/stock_picking_return_lot/README.rst @@ -7,7 +7,7 @@ Stock Picking Return Lot !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:8ec4c5ed4b5f33201a45a5ca385efb9e46aa1bde41e4e6e7e30b005b4e3252e5 + !! source digest: sha256:4fc5ebde82b0ced4f081cfecb7cb1defeb8d632488a9b3fbd621e0299d50d97d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/stock_picking_return_lot/__manifest__.py b/stock_picking_return_lot/__manifest__.py index 912ac166b452..97af23c72be8 100644 --- a/stock_picking_return_lot/__manifest__.py +++ b/stock_picking_return_lot/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Stock Picking Return Lot", "summary": "Propagate SN/lots from origin picking to return picking.", - "version": "16.0.1.0.0", + "version": "16.0.1.1.0", "license": "AGPL-3", "author": "Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-workflow", diff --git a/stock_picking_return_lot/static/description/index.html b/stock_picking_return_lot/static/description/index.html index 231cd2c70a5c..cef6e4cbac32 100644 --- a/stock_picking_return_lot/static/description/index.html +++ b/stock_picking_return_lot/static/description/index.html @@ -367,7 +367,7 @@

    Stock Picking Return Lot

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:8ec4c5ed4b5f33201a45a5ca385efb9e46aa1bde41e4e6e7e30b005b4e3252e5 +!! source digest: sha256:4fc5ebde82b0ced4f081cfecb7cb1defeb8d632488a9b3fbd621e0299d50d97d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

    Beta License: AGPL-3 OCA/stock-logistics-workflow Translate me on Weblate Try me on Runboat

    When a product is tracked by lot or serial number and is returned by a customer, From 83dba5c4bbe9ff233051ca0197724b336f92e974 Mon Sep 17 00:00:00 2001 From: Antoni Marroig Campomar Date: Fri, 18 Oct 2024 10:39:11 +0200 Subject: [PATCH 13/14] [IMP] stock_picking_return_lot: pre-commit auto fixes --- stock_picking_return_lot/README.rst | 53 ++++++++++--------- stock_picking_return_lot/pyproject.toml | 3 ++ .../readme/CONTRIBUTORS.md | 8 +++ .../readme/CONTRIBUTORS.rst | 14 ----- .../readme/DESCRIPTION.md | 12 +++++ .../readme/DESCRIPTION.rst | 10 ---- .../static/description/index.html | 26 ++++----- .../wizards/stock_return_picking_line.py | 1 - 8 files changed, 64 insertions(+), 63 deletions(-) create mode 100644 stock_picking_return_lot/pyproject.toml create mode 100644 stock_picking_return_lot/readme/CONTRIBUTORS.md delete mode 100644 stock_picking_return_lot/readme/CONTRIBUTORS.rst create mode 100644 stock_picking_return_lot/readme/DESCRIPTION.md delete mode 100644 stock_picking_return_lot/readme/DESCRIPTION.rst diff --git a/stock_picking_return_lot/README.rst b/stock_picking_return_lot/README.rst index a9c2872c9955..8e021fddceaf 100644 --- a/stock_picking_return_lot/README.rst +++ b/stock_picking_return_lot/README.rst @@ -17,27 +17,29 @@ Stock Picking Return Lot :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_return_lot + :target: https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_picking_return_lot :alt: OCA/stock-logistics-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_return_lot + :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-17-0/stock-logistics-workflow-17-0-stock_picking_return_lot :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -When a product is tracked by lot or serial number and is returned by a customer, -it’s crucial to clearly indicate to the user which lot or serial number can be -accepted. This way, we prevent user from receiving a product with a lot or -serial number different from the original delivery. +When a product is tracked by lot or serial number and is returned by a +customer, it’s crucial to clearly indicate to the user which lot or +serial number can be accepted. This way, we prevent user from receiving +a product with a lot or serial number different from the original +delivery. -This module enhances the return process by creating a separate return line for -each product/lot and automatically pre-filling it with the lot from the original delivery. -It relies on the `Stock Restrict Lot `__ -module to enforce accurate tracking, ensuring that the reception order reflects -the correct lot or serial number that should be received. +This module enhances the return process by creating a separate return +line for each product/lot and automatically pre-filling it with the lot +from the original delivery. It relies on the `Stock Restrict +Lot `__ +module to enforce accurate tracking, ensuring that the reception order +reflects the correct lot or serial number that should be received. **Table of contents** @@ -50,7 +52,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -58,31 +60,30 @@ Credits ======= Authors -~~~~~~~ +------- * Camptocamp * ACSONE SA/NV Contributors -~~~~~~~~~~~~ +------------ -* Iryna Vyshnevska +- Iryna Vyshnevska +- `PyTech SRL `__: -* `PyTech SRL `__: + - Alessio Renda + - Sebastiano Picchi - * Alessio Renda - * Sebastiano Picchi +- `Ooops404 `__: -* `Ooops404 `__: + - Foresti Francesco - * Foresti Francesco +- `ACSONE SA/NV `__: -* `ACSONE SA/NV `__: - - * Souheil Bejaoui + - Souheil Bejaoui Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -94,6 +95,6 @@ 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. -This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. +This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_return_lot/pyproject.toml b/stock_picking_return_lot/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/stock_picking_return_lot/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_picking_return_lot/readme/CONTRIBUTORS.md b/stock_picking_return_lot/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..27d84237b187 --- /dev/null +++ b/stock_picking_return_lot/readme/CONTRIBUTORS.md @@ -0,0 +1,8 @@ +- Iryna Vyshnevska \<\> +- [PyTech SRL](https://www.pytech.it): + - Alessio Renda + - Sebastiano Picchi +- [Ooops404](https://www.ooops404.com): + - Foresti Francesco \<\> +- [ACSONE SA/NV](https://www.acsone.eu): + - Souheil Bejaoui \<\> diff --git a/stock_picking_return_lot/readme/CONTRIBUTORS.rst b/stock_picking_return_lot/readme/CONTRIBUTORS.rst deleted file mode 100644 index 6f0a4bd87bd6..000000000000 --- a/stock_picking_return_lot/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,14 +0,0 @@ -* Iryna Vyshnevska - -* `PyTech SRL `__: - - * Alessio Renda - * Sebastiano Picchi - -* `Ooops404 `__: - - * Foresti Francesco - -* `ACSONE SA/NV `__: - - * Souheil Bejaoui \ No newline at end of file diff --git a/stock_picking_return_lot/readme/DESCRIPTION.md b/stock_picking_return_lot/readme/DESCRIPTION.md new file mode 100644 index 000000000000..fcf6953de301 --- /dev/null +++ b/stock_picking_return_lot/readme/DESCRIPTION.md @@ -0,0 +1,12 @@ +When a product is tracked by lot or serial number and is returned by a +customer, it’s crucial to clearly indicate to the user which lot or +serial number can be accepted. This way, we prevent user from receiving +a product with a lot or serial number different from the original +delivery. + +This module enhances the return process by creating a separate return +line for each product/lot and automatically pre-filling it with the lot +from the original delivery. It relies on the [Stock Restrict +Lot](https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_restrict_lot) +module to enforce accurate tracking, ensuring that the reception order +reflects the correct lot or serial number that should be received. diff --git a/stock_picking_return_lot/readme/DESCRIPTION.rst b/stock_picking_return_lot/readme/DESCRIPTION.rst deleted file mode 100644 index 9a30d3677db2..000000000000 --- a/stock_picking_return_lot/readme/DESCRIPTION.rst +++ /dev/null @@ -1,10 +0,0 @@ -When a product is tracked by lot or serial number and is returned by a customer, -it’s crucial to clearly indicate to the user which lot or serial number can be -accepted. This way, we prevent user from receiving a product with a lot or -serial number different from the original delivery. - -This module enhances the return process by creating a separate return line for -each product/lot and automatically pre-filling it with the lot from the original delivery. -It relies on the `Stock Restrict Lot `__ -module to enforce accurate tracking, ensuring that the reception order reflects -the correct lot or serial number that should be received. diff --git a/stock_picking_return_lot/static/description/index.html b/stock_picking_return_lot/static/description/index.html index cef6e4cbac32..68253cf78d38 100644 --- a/stock_picking_return_lot/static/description/index.html +++ b/stock_picking_return_lot/static/description/index.html @@ -369,16 +369,18 @@

    Stock Picking Return Lot

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:4fc5ebde82b0ced4f081cfecb7cb1defeb8d632488a9b3fbd621e0299d50d97d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: AGPL-3 OCA/stock-logistics-workflow Translate me on Weblate Try me on Runboat

    -

    When a product is tracked by lot or serial number and is returned by a customer, -it’s crucial to clearly indicate to the user which lot or serial number can be -accepted. This way, we prevent user from receiving a product with a lot or -serial number different from the original delivery.

    -

    This module enhances the return process by creating a separate return line for -each product/lot and automatically pre-filling it with the lot from the original delivery. -It relies on the Stock Restrict Lot -module to enforce accurate tracking, ensuring that the reception order reflects -the correct lot or serial number that should be received.

    +

    Beta License: AGPL-3 OCA/stock-logistics-workflow Translate me on Weblate Try me on Runboat

    +

    When a product is tracked by lot or serial number and is returned by a +customer, it’s crucial to clearly indicate to the user which lot or +serial number can be accepted. This way, we prevent user from receiving +a product with a lot or serial number different from the original +delivery.

    +

    This module enhances the return process by creating a separate return +line for each product/lot and automatically pre-filling it with the lot +from the original delivery. It relies on the Stock Restrict +Lot +module to enforce accurate tracking, ensuring that the reception order +reflects the correct lot or serial number that should be received.

    Table of contents

      @@ -396,7 +398,7 @@

      Bug Tracker

      Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

      +feedback.

      Do not contact contributors directly about support or help with technical issues.

    @@ -436,7 +438,7 @@

    Maintainers

    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.

    -

    This module is part of the OCA/stock-logistics-workflow project on GitHub.

    +

    This module is part of the OCA/stock-logistics-workflow project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/stock_picking_return_lot/wizards/stock_return_picking_line.py b/stock_picking_return_lot/wizards/stock_return_picking_line.py index fc6e391b60aa..c132e5cd3bf6 100644 --- a/stock_picking_return_lot/wizards/stock_return_picking_line.py +++ b/stock_picking_return_lot/wizards/stock_return_picking_line.py @@ -5,7 +5,6 @@ class StockReturnPickingLine(models.TransientModel): - _inherit = "stock.return.picking.line" lot_id = fields.Many2one( From 00995710f4cd0f85c4409f8c72ff8af3c4edd7b9 Mon Sep 17 00:00:00 2001 From: Antoni Marroig Campomar Date: Fri, 18 Oct 2024 13:40:59 +0200 Subject: [PATCH 14/14] [MIG] stock_picking_return_lot: Migration to 17.0 --- stock_picking_return_lot/README.rst | 4 +++ stock_picking_return_lot/__manifest__.py | 2 +- .../readme/CONTRIBUTORS.md | 2 ++ .../static/description/index.html | 4 +++ .../tests/test_stock_picking_return_lot.py | 10 ++----- .../wizards/stock_return_picking.py | 26 +++++++++---------- .../wizards/stock_return_picking.xml | 2 +- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/stock_picking_return_lot/README.rst b/stock_picking_return_lot/README.rst index 8e021fddceaf..d38e6c0a02fd 100644 --- a/stock_picking_return_lot/README.rst +++ b/stock_picking_return_lot/README.rst @@ -82,6 +82,10 @@ Contributors - Souheil Bejaoui +- `APSL-Nagarro `__: + + - Antoni Marroig + Maintainers ----------- diff --git a/stock_picking_return_lot/__manifest__.py b/stock_picking_return_lot/__manifest__.py index 97af23c72be8..392a19be93b4 100644 --- a/stock_picking_return_lot/__manifest__.py +++ b/stock_picking_return_lot/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Stock Picking Return Lot", "summary": "Propagate SN/lots from origin picking to return picking.", - "version": "16.0.1.1.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "author": "Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-workflow", diff --git a/stock_picking_return_lot/readme/CONTRIBUTORS.md b/stock_picking_return_lot/readme/CONTRIBUTORS.md index 27d84237b187..a2d788da9efb 100644 --- a/stock_picking_return_lot/readme/CONTRIBUTORS.md +++ b/stock_picking_return_lot/readme/CONTRIBUTORS.md @@ -6,3 +6,5 @@ - Foresti Francesco \<\> - [ACSONE SA/NV](https://www.acsone.eu): - Souheil Bejaoui \<\> +- [APSL-Nagarro](https://apsl.tech): + - Antoni Marroig \<\> diff --git a/stock_picking_return_lot/static/description/index.html b/stock_picking_return_lot/static/description/index.html index 68253cf78d38..1297efe032e2 100644 --- a/stock_picking_return_lot/static/description/index.html +++ b/stock_picking_return_lot/static/description/index.html @@ -427,6 +427,10 @@

    Contributors

  • Souheil Bejaoui <souheil.bejaoui@acsone.eu>
  • +
  • APSL-Nagarro: +
  • diff --git a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py index 80da45e6d382..549c59b94e65 100644 --- a/stock_picking_return_lot/tests/test_stock_picking_return_lot.py +++ b/stock_picking_return_lot/tests/test_stock_picking_return_lot.py @@ -50,8 +50,7 @@ def setUpClass(cls): } ) cls.picking.action_confirm() - cls.picking.action_assign() - cls.picking.action_set_quantities_to_reservation() + cls.picking.move_ids.picked = True cls.picking._action_done() @classmethod @@ -101,14 +100,12 @@ def _create_picking(self, product=None): def _create_validate_picking(self): picking = self._create_picking() picking.action_confirm() - picking.action_assign() - picking.action_set_quantities_to_reservation() + picking.move_ids.picked = True picking._action_done() return picking def test_partial_return(self): wiz = self.create_return_wiz(self.picking) - wiz._onchange_picking_id() self.assertEqual(len(wiz.product_return_moves), 2) return_line_1 = wiz.product_return_moves.filtered( lambda m, lot=self.lot_1: m.lot_id == lot @@ -134,7 +131,6 @@ def test_partial_return(self): def test_full_return_after_partial_return(self): self.test_partial_return() wiz = self.create_return_wiz(self.picking) - wiz._onchange_picking_id() self.assertEqual(len(wiz.product_return_moves), 2) return_line_1 = wiz.product_return_moves.filtered( @@ -166,7 +162,6 @@ def test_multiple_move_same_product_different_lot(self): ) picking = self._create_validate_picking() wiz = self.create_return_wiz(picking) - wiz._onchange_picking_id() self.assertEqual(len(wiz.product_return_moves), 2) return_line_1 = wiz.product_return_moves.filtered( lambda m, lot=self.lot_1: m.lot_id == lot @@ -194,7 +189,6 @@ def test_multiple_move_same_product_same_lot(self): ) picking = self._create_validate_picking() wiz = self.create_return_wiz(picking) - wiz._onchange_picking_id() self.assertEqual(len(wiz.product_return_moves), 2) return_lines = wiz.product_return_moves.filtered( lambda m, lot=self.lot_1: m.lot_id == lot diff --git a/stock_picking_return_lot/wizards/stock_return_picking.py b/stock_picking_return_lot/wizards/stock_return_picking.py index a6e0e140f7e4..ba813089afa9 100644 --- a/stock_picking_return_lot/wizards/stock_return_picking.py +++ b/stock_picking_return_lot/wizards/stock_return_picking.py @@ -11,7 +11,7 @@ class ReturnPicking(models.TransientModel): _inherit = "stock.return.picking" - def _get_qty_done_by_product_lot(self): + def _get_qty_by_product_lot(self): res = defaultdict(float) for group in self.env["stock.move.line"].read_group( [ @@ -19,29 +19,29 @@ def _get_qty_done_by_product_lot(self): ("state", "=", "done"), ("move_id.scrapped", "=", False), ], - ["qty_done:sum"], + ["quantity:sum"], ["move_id", "lot_id"], lazy=False, ): lot_id = group.get("lot_id")[0] if group.get("lot_id") else False move_id = group.get("move_id")[0] - qty_done = group.get("qty_done") - res[(move_id, lot_id)] += qty_done + quantity = group.get("quantity") + res[(move_id, lot_id)] += quantity return res - @api.onchange("picking_id") - def _onchange_picking_id(self): - res = super()._onchange_picking_id() + @api.depends("picking_id") + def _compute_moves_locations(self): + res = super()._compute_moves_locations() product_return_moves = [(5,)] line_fields = [f for f in self.env["stock.return.picking.line"]._fields.keys()] product_return_moves_data_tmpl = self.env[ "stock.return.picking.line" ].default_get(line_fields) - qty_done_by_product_lot = self._get_qty_done_by_product_lot() - for (move_id, lot_id), qty_done in qty_done_by_product_lot.items(): + qty_by_product_lot = self._get_qty_by_product_lot() + for (move_id, lot_id), quantity in qty_by_product_lot.items(): product_return_moves_data = dict(product_return_moves_data_tmpl) product_return_moves_data.update( - self._prepare_stock_return_picking_line_vals(move_id, lot_id, qty_done) + self._prepare_stock_return_picking_line_vals(move_id, lot_id, quantity) ) product_return_moves.append((0, 0, product_return_moves_data)) if self.picking_id: @@ -49,9 +49,9 @@ def _onchange_picking_id(self): return res @api.model - def _prepare_stock_return_picking_line_vals(self, move_id, lot_id, qty_done): + def _prepare_stock_return_picking_line_vals(self, move_id, lot_id, quantity): move = self.env["stock.move"].browse(move_id) - quantity = qty_done + quantity = quantity for dest_move in move.move_dest_ids: if ( not dest_move.origin_returned_move_id @@ -65,7 +65,7 @@ def _prepare_stock_return_picking_line_vals(self, move_id, lot_id, qty_done): or not lot_id ): if dest_move.state in ("partially_available", "assigned"): - quantity -= sum(dest_move.move_line_ids.mapped("reserved_qty")) + quantity -= sum(dest_move.move_line_ids.mapped("quantity")) elif dest_move.state == "done": quantity -= dest_move.product_qty quantity = float_round( diff --git a/stock_picking_return_lot/wizards/stock_return_picking.xml b/stock_picking_return_lot/wizards/stock_return_picking.xml index 1594f0134451..2193d2470dec 100644 --- a/stock_picking_return_lot/wizards/stock_return_picking.xml +++ b/stock_picking_return_lot/wizards/stock_return_picking.xml @@ -13,7 +13,7 @@