From 257c10216e86e065bffae65c82126dd630d9bc1a Mon Sep 17 00:00:00 2001 From: remi-filament <30716308+remi-filament@users.noreply.github.com> Date: Fri, 24 Sep 2021 09:27:26 +0200 Subject: [PATCH 1/3] [FIX] stock_picking_filter_lot made configurable --- stock_picking_filter_lot/__manifest__.py | 8 +++++-- stock_picking_filter_lot/models/__init__.py | 2 ++ .../models/stock_move_line.py | 13 ++++++++++++ .../models/stock_picking_type.py | 15 +++++++++++++ .../readme/CONFIGURATION.rst | 5 +++++ .../readme/CONTRIBUTORS.rst | 1 + .../views/stock_move_line_view.xml | 21 ++++++++++++------- .../views/stock_picking_type_view.xml | 17 +++++++++++++++ 8 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 stock_picking_filter_lot/models/stock_move_line.py create mode 100644 stock_picking_filter_lot/models/stock_picking_type.py create mode 100644 stock_picking_filter_lot/readme/CONFIGURATION.rst create mode 100644 stock_picking_filter_lot/views/stock_picking_type_view.xml diff --git a/stock_picking_filter_lot/__manifest__.py b/stock_picking_filter_lot/__manifest__.py index 2de9a2807709..995e06405b12 100644 --- a/stock_picking_filter_lot/__manifest__.py +++ b/stock_picking_filter_lot/__manifest__.py @@ -6,10 +6,14 @@ "version": "15.0.1.0.1", "category": "Warehouse", "website": "https://github.com/OCA/stock-logistics-workflow", - "author": "Agile Business Group, Odoo Community Association (OCA)", + "author": "Le Filament, Agile Business Group, Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, "installable": True, "depends": ["stock"], - "data": ["views/stock_move_line_view.xml", "views/stock_scrap_view.xml"], + "data": [ + "views/stock_move_line_view.xml", + "views/stock_picking_type_view.xml", + "views/stock_scrap_view.xml", + ], } diff --git a/stock_picking_filter_lot/models/__init__.py b/stock_picking_filter_lot/models/__init__.py index dd885b7bed84..19e2d838c26e 100644 --- a/stock_picking_filter_lot/models/__init__.py +++ b/stock_picking_filter_lot/models/__init__.py @@ -1 +1,3 @@ +from . import stock_move_line +from . import stock_picking_type from . import stock_production_lot diff --git a/stock_picking_filter_lot/models/stock_move_line.py b/stock_picking_filter_lot/models/stock_move_line.py new file mode 100644 index 000000000000..1d24204b29c8 --- /dev/null +++ b/stock_picking_filter_lot/models/stock_move_line.py @@ -0,0 +1,13 @@ +# Copyright 2021 Le Filament (https://le-filament.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from odoo import fields, models + + +class StockMoveLine(models.Model): + _inherit = "stock.move.line" + + picking_type_use_filter_lots = fields.Boolean( + related="picking_id.picking_type_id.use_filter_lots" + ) diff --git a/stock_picking_filter_lot/models/stock_picking_type.py b/stock_picking_filter_lot/models/stock_picking_type.py new file mode 100644 index 000000000000..d8cb35f7a580 --- /dev/null +++ b/stock_picking_filter_lot/models/stock_picking_type.py @@ -0,0 +1,15 @@ +# Copyright 2021 Le Filament (https://le-filament.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class StockPickingType(models.Model): + _inherit = "stock.picking.type" + + use_filter_lots = fields.Boolean( + "Use only available lots", + default=True, + help="If this is checked, only lots available in source location \ + would be displayed in drop down list for selecting lot.", + ) diff --git a/stock_picking_filter_lot/readme/CONFIGURATION.rst b/stock_picking_filter_lot/readme/CONFIGURATION.rst new file mode 100644 index 000000000000..6acfb9810e12 --- /dev/null +++ b/stock_picking_filter_lot/readme/CONFIGURATION.rst @@ -0,0 +1,5 @@ +By default, all operation types use filter on lots, should you want to disable this for a particular operation type, follow the next steps : +- Go to Inventory > Configuration > Operation Types. +- Unselect "Use only available lots" for all the operation types on which you want to disable filtering. + +In case you can receive a second time the same lot number (from supplier for instance), this filter should not be applied on Reception. diff --git a/stock_picking_filter_lot/readme/CONTRIBUTORS.rst b/stock_picking_filter_lot/readme/CONTRIBUTORS.rst index e25a0f51fd5a..2204334c8d47 100644 --- a/stock_picking_filter_lot/readme/CONTRIBUTORS.rst +++ b/stock_picking_filter_lot/readme/CONTRIBUTORS.rst @@ -3,3 +3,4 @@ * Alan Ramos (www.jarsa.com.mx) * Tharathip Chaweewongphan (www.ecosoft.co.th) * Jesus Alcala (www.jarsa.com.mx) +* Le Filament (le-filament.com) diff --git a/stock_picking_filter_lot/views/stock_move_line_view.xml b/stock_picking_filter_lot/views/stock_move_line_view.xml index ae1a5a2fc2c5..c31672f2344d 100644 --- a/stock_picking_filter_lot/views/stock_move_line_view.xml +++ b/stock_picking_filter_lot/views/stock_move_line_view.xml @@ -1,5 +1,6 @@ - @@ -10,10 +11,13 @@ stock.move.line + + + - [('product_id','=', parent.product_id), ('company_id', '=', company_id), ('location_ids', 'child_of', location_id)] + + picking_type_use_filter_lots and [('product_id','=', product_id), ('company_id', '=', company_id), ('location_ids', 'child_of', location_id)] or [('product_id','=', product_id), ('company_id', '=', company_id)] + @@ -27,10 +31,13 @@ ref="stock.view_stock_move_line_detailed_operation_tree" /> + + + - [('product_id','=', product_id), ('company_id', '=', company_id), ('location_ids', 'child_of', location_id)] + + picking_type_use_filter_lots and [('product_id','=', product_id), ('company_id', '=', company_id), ('location_ids', 'child_of', location_id)] or [('product_id','=', product_id), ('company_id', '=', company_id)] + diff --git a/stock_picking_filter_lot/views/stock_picking_type_view.xml b/stock_picking_filter_lot/views/stock_picking_type_view.xml new file mode 100644 index 000000000000..5c1fbd8c1f8e --- /dev/null +++ b/stock_picking_filter_lot/views/stock_picking_type_view.xml @@ -0,0 +1,17 @@ + + + + + + stock_picking_type_add_filter_form + stock.picking.type + + + + + + + + + From f857be472e63d33e2e1d11a3f96c8eff214ab1af Mon Sep 17 00:00:00 2001 From: Denis Leemann Date: Mon, 6 Jan 2025 12:18:37 +0100 Subject: [PATCH 2/3] FIX pre-commit --- stock_picking_filter_lot/README.rst | 2 ++ .../static/description/index.html | 3 ++- .../views/stock_picking_type_view.xml | 20 +++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/stock_picking_filter_lot/README.rst b/stock_picking_filter_lot/README.rst index bc7fd190c595..84e11a9c4216 100644 --- a/stock_picking_filter_lot/README.rst +++ b/stock_picking_filter_lot/README.rst @@ -61,6 +61,7 @@ Credits Authors ~~~~~~~ +* Le Filament * Agile Business Group Contributors @@ -71,6 +72,7 @@ Contributors * Alan Ramos (www.jarsa.com.mx) * Tharathip Chaweewongphan (www.ecosoft.co.th) * Jesus Alcala (www.jarsa.com.mx) +* Le Filament (le-filament.com) Maintainers ~~~~~~~~~~~ diff --git a/stock_picking_filter_lot/static/description/index.html b/stock_picking_filter_lot/static/description/index.html index 8d2e434e0e66..2276acc193cc 100644 --- a/stock_picking_filter_lot/static/description/index.html +++ b/stock_picking_filter_lot/static/description/index.html @@ -1,4 +1,3 @@ - @@ -407,6 +406,7 @@

Credits

Authors

    +
  • Le Filament
  • Agile Business Group
@@ -418,6 +418,7 @@

Contributors

  • Alan Ramos <alan.ramos@jarsa.com.mx> (www.jarsa.com.mx)
  • Tharathip Chaweewongphan <tharathipc@ecosoft.co.th> (www.ecosoft.co.th)
  • Jesus Alcala <jesus.alcala@jarsa.com.mx> (www.jarsa.com.mx)
  • +
  • Le Filament (le-filament.com)
  • diff --git a/stock_picking_filter_lot/views/stock_picking_type_view.xml b/stock_picking_filter_lot/views/stock_picking_type_view.xml index 5c1fbd8c1f8e..d76987b5f57d 100644 --- a/stock_picking_filter_lot/views/stock_picking_type_view.xml +++ b/stock_picking_filter_lot/views/stock_picking_type_view.xml @@ -2,16 +2,14 @@ - - - stock_picking_type_add_filter_form - stock.picking.type - - - - - + + stock_picking_type_add_filter_form + stock.picking.type + + + + - - + + From e2d5ad9de638b54cda865e3b85365a91f6ef0baf Mon Sep 17 00:00:00 2001 From: Denis Leemann Date: Thu, 9 Jan 2025 09:36:09 +0100 Subject: [PATCH 3/3] FIX stock_picking_filter_lot: fix contributors data --- stock_picking_filter_lot/README.rst | 4 ++-- stock_picking_filter_lot/readme/CONTRIBUTORS.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stock_picking_filter_lot/README.rst b/stock_picking_filter_lot/README.rst index 84e11a9c4216..b747ad82100c 100644 --- a/stock_picking_filter_lot/README.rst +++ b/stock_picking_filter_lot/README.rst @@ -2,7 +2,7 @@ Stock picking filter lot ======================== -.. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! @@ -72,7 +72,7 @@ Contributors * Alan Ramos (www.jarsa.com.mx) * Tharathip Chaweewongphan (www.ecosoft.co.th) * Jesus Alcala (www.jarsa.com.mx) -* Le Filament (le-filament.com) +* Remi Cazenave (https://le-filament.com) Maintainers ~~~~~~~~~~~ diff --git a/stock_picking_filter_lot/readme/CONTRIBUTORS.rst b/stock_picking_filter_lot/readme/CONTRIBUTORS.rst index 2204334c8d47..a6199c8264d1 100644 --- a/stock_picking_filter_lot/readme/CONTRIBUTORS.rst +++ b/stock_picking_filter_lot/readme/CONTRIBUTORS.rst @@ -3,4 +3,4 @@ * Alan Ramos (www.jarsa.com.mx) * Tharathip Chaweewongphan (www.ecosoft.co.th) * Jesus Alcala (www.jarsa.com.mx) -* Le Filament (le-filament.com) +* Remi Cazenave (https://le-filament.com)