diff --git a/shopfloor_reception/__manifest__.py b/shopfloor_reception/__manifest__.py index 0b50847024..6d2b884d2b 100644 --- a/shopfloor_reception/__manifest__.py +++ b/shopfloor_reception/__manifest__.py @@ -1,7 +1,7 @@ { "name": "Shopfloor Reception", "summary": "Reception scenario for shopfloor", - "version": "14.0.2.6.1", + "version": "14.0.2.7.0", "development_status": "Beta", "category": "Inventory", "website": "https://github.com/OCA/wms", diff --git a/shopfloor_reception/data/shopfloor_scenario_data.xml b/shopfloor_reception/data/shopfloor_scenario_data.xml index d9ef7cf264..dff6c55252 100644 --- a/shopfloor_reception/data/shopfloor_scenario_data.xml +++ b/shopfloor_reception/data/shopfloor_scenario_data.xml @@ -9,7 +9,8 @@ { "auto_post_line": true, - "allow_return": true + "allow_return": true, + "display_vendor_packagings": true } diff --git a/shopfloor_reception/migrations/14.0.2.7.0/post-migration.py b/shopfloor_reception/migrations/14.0.2.7.0/post-migration.py new file mode 100644 index 0000000000..cc12cc84ec --- /dev/null +++ b/shopfloor_reception/migrations/14.0.2.7.0/post-migration.py @@ -0,0 +1,37 @@ +# Copyright 2024 Camptocamp SA (http://www.camptocamp.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import json +import logging + +from odoo import SUPERUSER_ID, api + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + if not version: + return + env = api.Environment(cr, SUPERUSER_ID, {}) + reception_scenario = env["shopfloor.scenario"].search([("name", "=", "Reception")]) + _update_scenario_options(reception_scenario) + reception_menus = env["shopfloor.menu"].search( + [("scenario_id", "=", reception_scenario.id)] + ) + _enable_option_in_menus(reception_menus) + + +def _update_scenario_options(scenario): + options = scenario.options + options["display_vendor_packagings"] = True + options_edit = json.dumps(options or {}, indent=4, sort_keys=True) + scenario.write({"options_edit": options_edit}) + _logger.info("Option display_vendor_packagings added to scenario Zone Picking") + + +def _enable_option_in_menus(menus): + for menu in menus: + menu.display_vendor_packagings = True + _logger.info( + "Option display_vendor_packagings enabled for menu {}".format(menu.name) + ) diff --git a/shopfloor_reception/services/reception.py b/shopfloor_reception/services/reception.py index 4f48dec001..f2bb37957e 100644 --- a/shopfloor_reception/services/reception.py +++ b/shopfloor_reception/services/reception.py @@ -710,9 +710,13 @@ def _data_for_stock_pickings(self, pickings, with_lines=False): ] def _data_for_move_lines(self, lines, **kw): + if self.work.menu.display_vendor_packagings: + kw["display_vendor_packagings"] = True return self.data.move_lines(lines, **kw) def _data_for_moves(self, moves, **kw): + if self.work.menu.display_vendor_packagings: + kw["display_vendor_packagings"] = True return self.data.moves(moves, **kw) # RESPONSES