forked from OCA/wms
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shopfloor_reception: enable display_vendor_packagings option
- Loading branch information
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
shopfloor_reception/migrations/14.0.2.7.0/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters