Skip to content

Commit

Permalink
shopfloor_reception: enable display_vendor_packagings option
Browse files Browse the repository at this point in the history
  • Loading branch information
JuMiSanAr committed Feb 20, 2024
1 parent 889aa78 commit e3c1492
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shopfloor_reception/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 2 additions & 1 deletion shopfloor_reception/data/shopfloor_scenario_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<field name="options_edit">
{
"auto_post_line": true,
"allow_return": true
"allow_return": true,
"display_vendor_packagings": true
}
</field>
</record>
Expand Down
37 changes: 37 additions & 0 deletions shopfloor_reception/migrations/14.0.2.7.0/post-migration.py
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)
)
4 changes: 4 additions & 0 deletions shopfloor_reception/services/reception.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e3c1492

Please sign in to comment.