diff --git a/stock_picking_filter_lot/README.rst b/stock_picking_filter_lot/README.rst index bc7fd190c595..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. !! @@ -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) +* Remi Cazenave (https://le-filament.com) Maintainers ~~~~~~~~~~~ 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..a6199c8264d1 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) +* Remi Cazenave (https://le-filament.com) 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_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..d76987b5f57d --- /dev/null +++ b/stock_picking_filter_lot/views/stock_picking_type_view.xml @@ -0,0 +1,15 @@ + + + + + stock_picking_type_add_filter_form + stock.picking.type + + + + + + + +