From 2c4e01c436664c8f26597bc4ad31233d07dafc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Thu, 10 Dec 2020 11:15:40 +0100 Subject: [PATCH] [IMP] black, isort, prettier --- .pre-commit-config.yaml | 2 +- requirements.txt | 4 +- shopfloor/actions/data.py | 5 +- shopfloor/actions/data_detail.py | 3 +- shopfloor/models/shopfloor_log.py | 3 +- shopfloor/models/stock_location.py | 3 +- shopfloor/models/stock_picking.py | 3 +- shopfloor/models/stock_picking_type.py | 4 +- shopfloor/models/stock_quant.py | 2 +- shopfloor/models/stock_quant_package.py | 3 +- shopfloor/services/checkout.py | 4 +- shopfloor/services/cluster_picking.py | 3 +- shopfloor/services/delivery.py | 9 +- shopfloor/services/forms/form_mixin.py | 3 +- shopfloor/services/menu.py | 3 +- shopfloor/services/single_pack_transfer.py | 12 ++- shopfloor/tests/test_checkout_cancel_line.py | 6 +- shopfloor/tests/test_checkout_no_package.py | 6 +- .../tests/test_cluster_picking_select.py | 28 ++++-- shopfloor/tests/test_cluster_picking_skip.py | 3 +- .../tests/test_cluster_picking_stock_issue.py | 3 +- .../tests/test_cluster_picking_unload.py | 32 +++++-- shopfloor/tests/test_delivery_done.py | 9 +- .../tests/test_delivery_list_stock_picking.py | 9 +- shopfloor/tests/test_delivery_scan_deliver.py | 18 ++-- .../test_location_content_transfer_base.py | 5 +- .../test_location_content_transfer_mix.py | 6 +- .../test_location_content_transfer_putaway.py | 7 +- ...ransfer_set_destination_package_or_line.py | 18 +++- .../test_location_content_transfer_single.py | 34 ++++--- .../test_location_content_transfer_start.py | 7 +- shopfloor/tests/test_scan_anything.py | 3 +- .../test_single_pack_transfer_putaway.py | 4 +- shopfloor/tests/test_user.py | 3 +- shopfloor/tests/test_zone_picking_base.py | 46 +++++++-- .../test_zone_picking_change_pack_lot.py | 9 +- .../tests/test_zone_picking_select_line.py | 65 +++++++++---- .../test_zone_picking_select_picking_type.py | 6 +- .../test_zone_picking_set_line_destination.py | 19 +++- shopfloor/tests/test_zone_picking_start.py | 28 ++++-- .../tests/test_zone_picking_stock_issue.py | 29 ++++-- .../tests/test_zone_picking_unload_all.py | 14 ++- ...est_zone_picking_unload_set_destination.py | 6 +- .../tests/test_zone_picking_unload_single.py | 11 ++- .../tests/test_zone_picking_zero_check.py | 22 +++-- .../tests/test_batch_create.py | 4 +- .../actions/checkout_sync.py | 3 +- shopfloor_mobile/controllers/main.py | 9 +- .../wms/src/components/detail/detail_lot.js | 4 +- .../wms/src/components/detail/detail_mixin.js | 2 +- .../src/components/detail/detail_transfer.js | 2 +- .../forms/form_edit_stock_picking.js | 4 +- .../src/components/input-number-spinner.js | 12 +-- .../static/wms/src/components/list.js | 8 +- .../wms/src/components/manual_select.js | 16 ++-- .../static/wms/src/components/misc.js | 32 +++---- .../src/components/packaging-qty-picker.js | 44 ++++----- .../scenario_picking_detail/mixins.js | 2 +- .../scenario_picking_detail/picking_select.js | 6 +- .../picking_summary.js | 16 ++-- .../static/wms/src/components/screen.js | 10 +- .../wms/src/components/searchbar/searchbar.js | 6 +- .../userInformation/userInformation.js | 10 +- .../static/wms/src/demo/demo.core.js | 6 +- .../static/wms/src/demo/demo.delivery.js | 2 +- .../static/wms/src/demo/demo.zone_picking.js | 8 +- shopfloor_mobile/static/wms/src/fetch.js | 6 +- shopfloor_mobile/static/wms/src/homepage.js | 2 +- shopfloor_mobile/static/wms/src/loginpage.js | 10 +- shopfloor_mobile/static/wms/src/main.js | 56 +++++------ shopfloor_mobile/static/wms/src/mixin.js | 4 +- shopfloor_mobile/static/wms/src/router.js | 2 +- .../static/wms/src/scenario/checkout.js | 44 ++++----- .../wms/src/scenario/cluster_picking.js | 42 ++++---- .../static/wms/src/scenario/delivery.js | 42 ++++---- .../static/wms/src/scenario/form.js | 18 ++-- .../src/scenario/location_content_transfer.js | 34 +++---- .../static/wms/src/scenario/mixins.js | 96 +++++++++---------- .../static/wms/src/scenario/scan_anything.js | 20 ++-- .../wms/src/scenario/single_pack_transfer.js | 6 +- .../static/wms/src/scenario/zone_picking.js | 88 ++++++++--------- .../static/wms/src/services/odoo.js | 4 +- .../static/wms/src/services/registry.js | 2 +- .../static/wms/src/settings/language.js | 2 +- .../static/wms/src/settings/profile.js | 6 +- .../static/wms/src/settings/settings.js | 2 +- shopfloor_mobile/static/wms/src/utils.js | 36 +++---- .../static/wms/src/scenario/checkout.js | 2 +- .../models/res_config_settings.py | 6 +- .../models/stock_move.py | 13 ++- .../tests/test_reservation.py | 16 +++- .../tests/test_release_dynamic_routing.py | 15 ++- stock_dynamic_routing/models/stock_routing.py | 5 +- .../models/stock_routing_rule.py | 6 +- stock_reception_screen/models/stock_move.py | 6 +- .../models/stock_reception_screen.py | 7 +- .../static/src/js/autofocus.js | 6 +- stock_storage_type/models/stock_location.py | 10 +- .../models/stock_storage_location_sequence.py | 8 +- .../models/stock_location.py | 4 +- 100 files changed, 811 insertions(+), 543 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0986311b4..2e006fdef3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ exclude: | # Maybe reactivate this when all README files include prettier ignore tags? ^README\.md$| # Library files can have extraneous formatting (even minimized) - /static/(src/)?lib/| + lib/| # Repos using Sphinx to generate docs don't need prettying ^docs/_templates/.*\.html$| # You don't usually want a bot to modify your legal texts diff --git a/requirements.txt b/requirements.txt index 38e5c4833a..9cd1629223 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1 @@ -# tests -# TODO: check https://github.com/OCA/maintainer-quality-tools/pull/646 -freezegun +# generated from manifests external_dependencies diff --git a/shopfloor/actions/data.py b/shopfloor/actions/data.py index 5301f90245..f1d3bbb644 100644 --- a/shopfloor/actions/data.py +++ b/shopfloor/actions/data.py @@ -160,7 +160,10 @@ def _move_line_parser(self): ("lot_id:lot", self._lot_parser), ("location_id:location_src", self._location_parser), ("location_dest_id:location_dest", self._location_parser), - ("move_id:priority", lambda rec, fname: rec.move_id.priority or "",), + ( + "move_id:priority", + lambda rec, fname: rec.move_id.priority or "", + ), ] def package_level(self, record, **kw): diff --git a/shopfloor/actions/data_detail.py b/shopfloor/actions/data_detail.py index e3024da604..ddd7527802 100644 --- a/shopfloor/actions/data_detail.py +++ b/shopfloor/actions/data_detail.py @@ -6,8 +6,7 @@ class DataDetailAction(Component): - """Provide extra data on top of data action. - """ + """Provide extra data on top of data action.""" _name = "shopfloor.data.detail.action" _inherit = "shopfloor.data.action" diff --git a/shopfloor/models/shopfloor_log.py b/shopfloor/models/shopfloor_log.py index 110f04cf08..9e94415f01 100644 --- a/shopfloor/models/shopfloor_log.py +++ b/shopfloor/models/shopfloor_log.py @@ -33,7 +33,8 @@ class ShopfloorLog(models.Model): exception_name = fields.Char(readonly=True, string="Exception") exception_message = fields.Text(readonly=True) state = fields.Selection( - selection=[("success", "Success"), ("failed", "Failed")], readonly=True, + selection=[("success", "Success"), ("failed", "Failed")], + readonly=True, ) severity = fields.Selection( selection=[ diff --git a/shopfloor/models/stock_location.py b/shopfloor/models/stock_location.py index b66146f7ae..6b8c3cd921 100644 --- a/shopfloor/models/stock_location.py +++ b/shopfloor/models/stock_location.py @@ -19,7 +19,8 @@ class StockLocation(models.Model): comodel_name="stock.move.line", inverse_name="location_id", readonly=True ) reserved_move_line_ids = fields.One2many( - comodel_name="stock.move.line", compute="_compute_reserved_move_lines", + comodel_name="stock.move.line", + compute="_compute_reserved_move_lines", ) def is_sublocation_of(self, others, func=any): diff --git a/shopfloor/models/stock_picking.py b/shopfloor/models/stock_picking.py index 35cb047cc9..e37e3ff67d 100644 --- a/shopfloor/models/stock_picking.py +++ b/shopfloor/models/stock_picking.py @@ -18,7 +18,8 @@ class StockPicking(models.Model): related="picking_type_id.shopfloor_display_packing_info", ) shopfloor_packing_info = fields.Text( - string="Packing information", related="partner_id.shopfloor_packing_info", + string="Packing information", + related="partner_id.shopfloor_packing_info", ) @api.depends( diff --git a/shopfloor/models/stock_picking_type.py b/shopfloor/models/stock_picking_type.py index 2525db4aaa..984a69cb8c 100644 --- a/shopfloor/models/stock_picking_type.py +++ b/shopfloor/models/stock_picking_type.py @@ -7,7 +7,9 @@ class StockPickingType(models.Model): _inherit = "stock.picking.type" shopfloor_menu_ids = fields.Many2many( - comodel_name="shopfloor.menu", string="Shopfloor Menus", readonly=True, + comodel_name="shopfloor.menu", + string="Shopfloor Menus", + readonly=True, ) shopfloor_zero_check = fields.Boolean( string="Activate Zero Check", diff --git a/shopfloor/models/stock_quant.py b/shopfloor/models/stock_quant.py index d20af1278e..bc17dcd29b 100644 --- a/shopfloor/models/stock_quant.py +++ b/shopfloor/models/stock_quant.py @@ -7,7 +7,7 @@ class StockQuant(models.Model): _inherit = "stock.quant" def _is_inventory_mode(self): - """ Used to control whether a quant was written on or created during an + """Used to control whether a quant was written on or created during an "inventory session", meaning a mode where we need to create the stock.move record necessary to be consistent with the `inventory_quantity` field. """ diff --git a/shopfloor/models/stock_quant_package.py b/shopfloor/models/stock_quant_package.py index 8f7ee23462..c155115bca 100644 --- a/shopfloor/models/stock_quant_package.py +++ b/shopfloor/models/stock_quant_package.py @@ -20,7 +20,8 @@ class StockQuantPackage(models.Model): ) # TODO: review other fields reserved_move_line_ids = fields.One2many( - comodel_name="stock.move.line", compute="_compute_reserved_move_lines", + comodel_name="stock.move.line", + compute="_compute_reserved_move_lines", ) def _get_reserved_move_lines(self): diff --git a/shopfloor/services/checkout.py b/shopfloor/services/checkout.py index fe45bd74a1..7a156ec2d7 100644 --- a/shopfloor/services/checkout.py +++ b/shopfloor/services/checkout.py @@ -513,7 +513,9 @@ def _change_line_qty( new_line = self.env["stock.move.line"] if qty_done > 0: new_line, qty_check = move_line._split_qty_to_be_done( - qty_done, split_partial=True, result_package_id=False, + qty_done, + split_partial=True, + result_package_id=False, ) if qty_check == "greater": qty_done = move_line.product_uom_qty diff --git a/shopfloor/services/cluster_picking.py b/shopfloor/services/cluster_picking.py index 620751c6d5..e5db7fd007 100644 --- a/shopfloor/services/cluster_picking.py +++ b/shopfloor/services/cluster_picking.py @@ -885,7 +885,8 @@ def change_pack_lot(self, picking_batch_id, move_line_id, barcode): ) return self._response_for_change_pack_lot( - move_line, message=self.msg_store.no_package_or_lot_for_barcode(barcode), + move_line, + message=self.msg_store.no_package_or_lot_for_barcode(barcode), ) def set_destination_all(self, picking_batch_id, barcode, confirmation=False): diff --git a/shopfloor/services/delivery.py b/shopfloor/services/delivery.py index 476d97073a..f8aea169ea 100644 --- a/shopfloor/services/delivery.py +++ b/shopfloor/services/delivery.py @@ -415,7 +415,8 @@ def set_qty_done_line(self, picking_id, move_line_id): ) return self._response_for_deliver(picking) return self._response_for_deliver( - picking=picking, message=self.msg_store.record_not_found(), + picking=picking, + message=self.msg_store.record_not_found(), ) def reset_qty_done_pack(self, picking_id, package_id): @@ -474,7 +475,8 @@ def reset_qty_done_line(self, picking_id, move_line_id): self._reset_lines(line) return self._response_for_deliver(picking) return self._response_for_deliver( - picking=picking, message=self.msg_store.record_not_found(), + picking=picking, + message=self.msg_store.record_not_found(), ) def done(self, picking_id, confirm=False): @@ -511,7 +513,8 @@ def done(self, picking_id, confirm=False): message=self.msg_store.transfer_complete(picking) ) return self._response_for_confirm_done( - picking, message=self.msg_store.transfer_confirm_done(), + picking, + message=self.msg_store.transfer_confirm_done(), ) diff --git a/shopfloor/services/forms/form_mixin.py b/shopfloor/services/forms/form_mixin.py index 1389082c80..f0d1d4aaa7 100644 --- a/shopfloor/services/forms/form_mixin.py +++ b/shopfloor/services/forms/form_mixin.py @@ -7,8 +7,7 @@ class ShopfloorFormMixin(AbstractComponent): - """Allow to edit records. - """ + """Allow to edit records.""" _inherit = "base.shopfloor.service" _name = "shopfloor.form.mixin" diff --git a/shopfloor/services/menu.py b/shopfloor/services/menu.py index cb82e53517..02a6a90ede 100644 --- a/shopfloor/services/menu.py +++ b/shopfloor/services/menu.py @@ -65,8 +65,7 @@ def _convert_one_record(self, record): return values def _get_move_line_counters(self, record): - """Lookup for all lines per menu item and compute counters. - """ + """Lookup for all lines per menu item and compute counters.""" # TODO: maybe to be improved w/ raw SQL as this run for each menu item # and it's called every time the menu is opened/gets refreshed move_line_search = self.actions_for( diff --git a/shopfloor/services/single_pack_transfer.py b/shopfloor/services/single_pack_transfer.py index 4bddbd3bcc..b0c7a6faa2 100644 --- a/shopfloor/services/single_pack_transfer.py +++ b/shopfloor/services/single_pack_transfer.py @@ -34,14 +34,22 @@ def _response_for_start(self, message=None, popup=None): def _response_for_confirm_start(self, package_level, message=None): data = self._data_after_package_scanned(package_level) data["confirmation_required"] = True - return self._response(next_state="start", data=data, message=message,) + return self._response( + next_state="start", + data=data, + message=message, + ) def _response_for_scan_location( self, package_level, message=None, confirmation_required=False ): data = self._data_after_package_scanned(package_level) data["confirmation_required"] = confirmation_required - return self._response(next_state="scan_location", data=data, message=message,) + return self._response( + next_state="scan_location", + data=data, + message=message, + ) def _response_for_show_completion_info(self, message=None): return self._response(next_state="show_completion_info", message=message) diff --git a/shopfloor/tests/test_checkout_cancel_line.py b/shopfloor/tests/test_checkout_cancel_line.py index a18adba265..6a9d4e74a7 100644 --- a/shopfloor/tests/test_checkout_cancel_line.py +++ b/shopfloor/tests/test_checkout_cancel_line.py @@ -103,11 +103,13 @@ def test_cancel_line_ok(self): # and now, we want to drop the new_package response = self.service.dispatch( - "cancel_line", params={"picking_id": picking.id, "line_id": raw_line.id}, + "cancel_line", + params={"picking_id": picking.id, "line_id": raw_line.id}, ) self.assertRecordValues( - raw_line, [{"qty_done": 0, "shopfloor_checkout_done": False}], + raw_line, + [{"qty_done": 0, "shopfloor_checkout_done": False}], ) self.assert_response( diff --git a/shopfloor/tests/test_checkout_no_package.py b/shopfloor/tests/test_checkout_no_package.py index e60a67ecfc..07cb846c34 100644 --- a/shopfloor/tests/test_checkout_no_package.py +++ b/shopfloor/tests/test_checkout_no_package.py @@ -42,10 +42,12 @@ def test_no_package_ok(self): ) self.assertRecordValues( - move_line1, [{"result_package_id": False, "shopfloor_checkout_done": True}], + move_line1, + [{"result_package_id": False, "shopfloor_checkout_done": True}], ) self.assertRecordValues( - move_line2, [{"result_package_id": False, "shopfloor_checkout_done": True}], + move_line2, + [{"result_package_id": False, "shopfloor_checkout_done": True}], ) self.assertRecordValues( move_line3, diff --git a/shopfloor/tests/test_cluster_picking_select.py b/shopfloor/tests/test_cluster_picking_select.py index e1d7dc983d..02f35414af 100644 --- a/shopfloor/tests/test_cluster_picking_select.py +++ b/shopfloor/tests/test_cluster_picking_select.py @@ -58,7 +58,9 @@ def test_find_batch_in_progress_current_user(self): # user and in progress (first priority) data = self.data.picking_batch(self.batch3, with_pickings=True) self.assert_response( - response, next_state="confirm_start", data=data, + response, + next_state="confirm_start", + data=data, ) def test_find_batch_assigned(self): @@ -78,7 +80,9 @@ def test_find_batch_assigned(self): # we expect to find batch 2 as it's assigned to the current user data = self.data.picking_batch(self.batch2, with_pickings=True) self.assert_response( - response, next_state="confirm_start", data=data, + response, + next_state="confirm_start", + data=data, ) def test_find_batch_unassigned_draft(self): @@ -97,7 +101,9 @@ def test_find_batch_unassigned_draft(self): # available data = self.data.picking_batch(self.batch2, with_pickings=True) self.assert_response( - response, next_state="confirm_start", data=data, + response, + next_state="confirm_start", + data=data, ) def test_find_batch_not_found(self): @@ -153,7 +159,9 @@ def test_select_in_progress_assigned(self): # we don't care in these tests, 'find_batch' tests them already data["pickings"] = self.ANY self.assert_response( - response, next_state="confirm_start", data=data, + response, + next_state="confirm_start", + data=data, ) def test_select_draft_assigned(self): @@ -171,7 +179,9 @@ def test_select_draft_assigned(self): # we don't care in these tests, 'find_batch' tests them already data["pickings"] = self.ANY self.assert_response( - response, next_state="confirm_start", data=data, + response, + next_state="confirm_start", + data=data, ) def test_select_draft_unassigned(self): @@ -188,7 +198,9 @@ def test_select_draft_unassigned(self): # we don't care in these tests, 'find_batch' tests them already data["pickings"] = self.ANY self.assert_response( - response, next_state="confirm_start", data=data, + response, + next_state="confirm_start", + data=data, ) def test_select_not_exists(self): @@ -323,7 +335,9 @@ def test_confirm_start_ok(self): data["picking"] = self.data.picking(picking) data["batch"] = self.data.picking_batch(batch) self.assert_response( - response, data=data, next_state="start_line", + response, + data=data, + next_state="start_line", ) def test_confirm_start_not_exists(self): diff --git a/shopfloor/tests/test_cluster_picking_skip.py b/shopfloor/tests/test_cluster_picking_skip.py index bb28881c70..03feec18fd 100644 --- a/shopfloor/tests/test_cluster_picking_skip.py +++ b/shopfloor/tests/test_cluster_picking_skip.py @@ -5,8 +5,7 @@ class ClusterPickingSkipLineCase(ClusterPickingCommonCase): - """Tests covering the /skip_line endpoint - """ + """Tests covering the /skip_line endpoint""" @classmethod def setUpClassBaseData(cls, *args, **kwargs): diff --git a/shopfloor/tests/test_cluster_picking_stock_issue.py b/shopfloor/tests/test_cluster_picking_stock_issue.py index eb878075f5..ce486d3ee6 100644 --- a/shopfloor/tests/test_cluster_picking_stock_issue.py +++ b/shopfloor/tests/test_cluster_picking_stock_issue.py @@ -5,8 +5,7 @@ class ClusterPickingStockIssue(ClusterPickingCommonCase): - """Tests covering the /stock_issue endpoint - """ + """Tests covering the /stock_issue endpoint""" @classmethod def setUpClassBaseData(cls, *args, **kwargs): diff --git a/shopfloor/tests/test_cluster_picking_unload.py b/shopfloor/tests/test_cluster_picking_unload.py index 5d9ed6f0bb..b32dcf1938 100644 --- a/shopfloor/tests/test_cluster_picking_unload.py +++ b/shopfloor/tests/test_cluster_picking_unload.py @@ -93,7 +93,9 @@ def test_prepare_unload_all_same_dest(self): location = self.packing_location data = self._data_for_batch(self.batch, location) self.assert_response( - response, next_state="unload_all", data=data, + response, + next_state="unload_all", + data=data, ) def test_prepare_unload_different_dest(self): @@ -110,7 +112,9 @@ def test_prepare_unload_different_dest(self): location = first_line.location_dest_id data = self._data_for_batch(self.batch, location, pack=self.bin1) self.assert_response( - response, next_state="unload_single", data=data, + response, + next_state="unload_single", + data=data, ) @@ -252,7 +256,9 @@ def test_set_destination_all_but_different_dest(self): location = move_lines[0].location_dest_id data = self._data_for_batch(self.batch, location, pack=self.bin1) self.assert_response( - response, next_state="unload_single", data=data, + response, + next_state="unload_single", + data=data, ) def test_set_destination_all_error_location_not_found(self): @@ -346,7 +352,9 @@ def test_set_destination_all_need_confirmation(self): location = move_lines[0].location_dest_id data = self._data_for_batch(self.batch, location) self.assert_response( - response, next_state="confirm_unload_all", data=data, + response, + next_state="confirm_unload_all", + data=data, ) def test_set_destination_all_with_confirmation(self): @@ -439,7 +447,9 @@ def test_unload_scan_pack_ok(self): location = self.move_lines[0].location_dest_id data = self._data_for_batch(self.batch, location, pack=self.bin1) self.assert_response( - response, next_state="unload_set_destination", data=data, + response, + next_state="unload_set_destination", + data=data, ) def test_unload_scan_pack_wrong_barcode(self): @@ -543,7 +553,9 @@ def test_unload_scan_destination_ok(self): location = self.bin2_lines[0].location_dest_id data = self._data_for_batch(self.batch, location, pack=self.bin2) self.assert_response( - response, next_state="unload_single", data=data, + response, + next_state="unload_single", + data=data, ) def test_unload_scan_destination_one_line_of_picking_only(self): @@ -603,7 +615,9 @@ def test_unload_scan_destination_one_line_of_picking_only(self): location = bin3_line.location_dest_id data = self._data_for_batch(self.batch, location, pack=bin3) self.assert_response( - response, next_state="unload_single", data=data, + response, + next_state="unload_single", + data=data, ) def test_unload_scan_destination_last_line(self): @@ -735,7 +749,9 @@ def test_unload_scan_destination_need_confirmation(self): location = self.bin1_lines[0].location_dest_id data = self._data_for_batch(self.batch, location, pack=self.bin1) self.assert_response( - response, next_state="confirm_unload_set_destination", data=data, + response, + next_state="confirm_unload_set_destination", + data=data, ) def test_unload_scan_destination_with_confirmation(self): diff --git a/shopfloor/tests/test_delivery_done.py b/shopfloor/tests/test_delivery_done.py index 8c49038db3..1162aa1eb8 100644 --- a/shopfloor/tests/test_delivery_done.py +++ b/shopfloor/tests/test_delivery_done.py @@ -46,7 +46,8 @@ def test_done_all_qty_done(self): move_line.qty_done = move_line.product_uom_qty response = self.service.dispatch("done", params={"picking_id": self.picking.id}) self.assert_response_deliver( - response, message=self.service.msg_store.transfer_complete(self.picking), + response, + message=self.service.msg_store.transfer_complete(self.picking), ) self.assertEqual(self.picking.state, "done") @@ -79,7 +80,8 @@ def test_done_no_qty_done_confirm(self): "done", params={"picking_id": self.picking.id, "confirm": True} ) self.assert_response_deliver( - response, message=self.service.msg_store.transfer_no_qty_done(), + response, + message=self.service.msg_store.transfer_no_qty_done(), ) self.assertEqual(self.picking.state, "assigned") @@ -94,7 +96,8 @@ def test_done_some_qty_done_confirm(self): "done", params={"picking_id": self.picking.id, "confirm": True} ) self.assert_response_deliver( - response, message=self.service.msg_store.transfer_complete(self.picking), + response, + message=self.service.msg_store.transfer_complete(self.picking), ) self.assertEqual(self.picking.state, "done") self.assertEqual(self.picking.move_lines, self.raw_move) diff --git a/shopfloor/tests/test_delivery_list_stock_picking.py b/shopfloor/tests/test_delivery_list_stock_picking.py index 056557d407..ec82a350a5 100644 --- a/shopfloor/tests/test_delivery_list_stock_picking.py +++ b/shopfloor/tests/test_delivery_list_stock_picking.py @@ -21,7 +21,8 @@ def test_list_stock_picking_ko(self): """No picking is ready, no picking to list.""" response = self.service.dispatch("list_stock_picking", params={}) self.assert_response_manual_selection( - response, pickings=[], + response, + pickings=[], ) def test_list_stock_picking_ok(self): @@ -32,7 +33,8 @@ def test_list_stock_picking_ok(self): response = self.service.dispatch("list_stock_picking", params={}) # picking1 only available self.assert_response_manual_selection( - response, pickings=self.picking1, + response, + pickings=self.picking1, ) # prepare 2nd picking self._fill_stock_for_moves(self.picking2.move_lines) @@ -40,5 +42,6 @@ def test_list_stock_picking_ok(self): response = self.service.dispatch("list_stock_picking", params={}) # all pickings available self.assert_response_manual_selection( - response, pickings=self.picking1 + self.picking2, + response, + pickings=self.picking1 + self.picking2, ) diff --git a/shopfloor/tests/test_delivery_scan_deliver.py b/shopfloor/tests/test_delivery_scan_deliver.py index c1aa38a00a..ae2cd598f6 100644 --- a/shopfloor/tests/test_delivery_scan_deliver.py +++ b/shopfloor/tests/test_delivery_scan_deliver.py @@ -81,7 +81,8 @@ def test_scan_deliver_error_barcode_not_found(self): "scan_deliver", params={"barcode": "NO VALID BARCODE", "picking_id": None} ) self.assert_response_deliver( - response, message=self.service.msg_store.barcode_not_found(), + response, + message=self.service.msg_store.barcode_not_found(), ) def test_scan_deliver_error_barcode_not_found_keep_picking(self): @@ -168,7 +169,8 @@ def test_scan_deliver_scan_product_not_found(self): "scan_deliver", params={"barcode": self.free_product.barcode} ) self.assert_response_deliver( - response, message=self.service.msg_store.product_not_found_in_pickings(), + response, + message=self.service.msg_store.product_not_found_in_pickings(), ) def test_scan_deliver_scan_lot_ok(self): @@ -179,7 +181,8 @@ def test_scan_deliver_scan_lot_ok(self): def test_scan_deliver_scan_lot_not_found(self): response = self.service.dispatch("scan_deliver", params={"barcode": "FREE_LOT"}) self.assert_response_deliver( - response, message=self.service.msg_store.lot_not_found_in_pickings(), + response, + message=self.service.msg_store.lot_not_found_in_pickings(), ) def test_scan_deliver_scan_lot_in_mixed_package(self): @@ -217,13 +220,15 @@ def test_scan_deliver_picking_done(self): self.assertEqual(self.picking.state, "assigned") lot = self.raw_lot_move.move_line_ids.lot_id response = self.service.dispatch( - "scan_deliver", params={"barcode": lot.name, "picking_id": self.picking.id}, + "scan_deliver", + params={"barcode": lot.name, "picking_id": self.picking.id}, ) self.assertEqual(self.picking.state, "assigned") packages_f = self.pack3_move.move_line_ids.mapped("package_id") # While all lines are not processed, response still returns the picking self.assert_response_deliver( - response, picking=self.picking, + response, + picking=self.picking, ) response = None # Once all lines are processed, the last response has no picking returned @@ -234,7 +239,8 @@ def test_scan_deliver_picking_done(self): ) self.assertEqual(self.picking.state, "done") self.assert_response_deliver( - response, message=self.service.msg_store.transfer_complete(self.picking), + response, + message=self.service.msg_store.transfer_complete(self.picking), ) diff --git a/shopfloor/tests/test_location_content_transfer_base.py b/shopfloor/tests/test_location_content_transfer_base.py index f4076b1bfe..cbc1c2c852 100644 --- a/shopfloor/tests/test_location_content_transfer_base.py +++ b/shopfloor/tests/test_location_content_transfer_base.py @@ -105,7 +105,10 @@ def _assert_response_scan_destination( data = self.service._data_content_line_for_location(location, next_content) data["confirmation_required"] = confirmation_required self.assert_response( - response, next_state=state, data=data, message=message, + response, + next_state=state, + data=data, + message=message, ) def assert_response_scan_destination( diff --git a/shopfloor/tests/test_location_content_transfer_mix.py b/shopfloor/tests/test_location_content_transfer_mix.py index 2b440f5202..b7f6753cb5 100644 --- a/shopfloor/tests/test_location_content_transfer_mix.py +++ b/shopfloor/tests/test_location_content_transfer_mix.py @@ -158,7 +158,8 @@ def _location_content_transfer_process_line( self.assert_response_start( response, message=service.msg_store.location_content_transfer_complete( - pack_location, out_location, + pack_location, + out_location, ), ) self.assertEqual(move_line.state, "done") @@ -339,7 +340,8 @@ def test_with_zone_picking2(self): self.assert_response_start( response, message=self.service.msg_store.location_content_transfer_complete( - pack_first_pallet.location_id, pack_first_pallet.location_dest_id, + pack_first_pallet.location_id, + pack_first_pallet.location_dest_id, ), ) self.assertEqual(pack_first_pallet.qty_done, 4) diff --git a/shopfloor/tests/test_location_content_transfer_putaway.py b/shopfloor/tests/test_location_content_transfer_putaway.py index 5b82a61f41..6421f71bab 100644 --- a/shopfloor/tests/test_location_content_transfer_putaway.py +++ b/shopfloor/tests/test_location_content_transfer_putaway.py @@ -5,8 +5,7 @@ class TestLocationContentTransferPutaway(LocationContentTransferCommonCase): - """Tests with putaway when using option to ignore unavailable putaway locations - """ + """Tests with putaway when using option to ignore unavailable putaway locations""" @classmethod def setUpClassVars(cls, *args, **kwargs): @@ -70,7 +69,9 @@ def test_normal_putaway(self): "scan_location", params={"barcode": self.test_loc.barcode} ) self.assert_response( - response, next_state="start_single", data=self.ANY, + response, + next_state="start_single", + data=self.ANY, ) package_level_id = response["data"]["start_single"]["package_level"]["id"] package_level = self.env["stock.package_level"].browse(package_level_id) diff --git a/shopfloor/tests/test_location_content_transfer_set_destination_package_or_line.py b/shopfloor/tests/test_location_content_transfer_set_destination_package_or_line.py index 6212307b49..1853edba35 100644 --- a/shopfloor/tests/test_location_content_transfer_set_destination_package_or_line.py +++ b/shopfloor/tests/test_location_content_transfer_set_destination_package_or_line.py @@ -77,7 +77,8 @@ def test_set_destination_package_wrong_parameters(self): ) move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_set_destination_package_dest_location_nok(self): @@ -93,7 +94,9 @@ def test_set_destination_package_dest_location_nok(self): }, ) self.assert_response_scan_destination( - response, package_level, message=self.service.msg_store.no_location_found(), + response, + package_level, + message=self.service.msg_store.no_location_found(), ) # Destination location not allowed customer_location = self.env.ref("stock.stock_location_customers") @@ -255,7 +258,8 @@ def test_set_destination_line_wrong_parameters(self): ) move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_set_destination_line_dest_location_nok(self): @@ -272,7 +276,9 @@ def test_set_destination_line_dest_location_nok(self): }, ) self.assert_response_scan_destination( - response, move_line, message=self.service.msg_store.no_location_found(), + response, + move_line, + message=self.service.msg_store.no_location_found(), ) # Destination location not allowed customer_location = self.env.ref("stock.stock_location_customers") @@ -552,7 +558,9 @@ def setUpClassBaseData(cls): ) cls.move_product_a.product_uom_qty = 15 cls._update_qty_in_location( - cls.picking.location_id, cls.product_a, 5, + cls.picking.location_id, + cls.product_a, + 5, ) # Put product_b quantities in two different source locations to get # two stock move lines (6 and 4 to satisfy 10 qties) diff --git a/shopfloor/tests/test_location_content_transfer_single.py b/shopfloor/tests/test_location_content_transfer_single.py index 1a4c2daeca..ae416df886 100644 --- a/shopfloor/tests/test_location_content_transfer_single.py +++ b/shopfloor/tests/test_location_content_transfer_single.py @@ -321,7 +321,8 @@ def test_postpone_package_wrong_parameters(self): ) move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_postpone_package_ok(self): @@ -337,7 +338,8 @@ def test_postpone_package_ok(self): self.assertTrue(package_level.shopfloor_postponed) move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_postpone_sorter(self): @@ -379,7 +381,8 @@ def test_postpone_line_wrong_parameters(self): ) move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_postpone_line_ok(self): @@ -392,7 +395,8 @@ def test_postpone_line_ok(self): self.assertTrue(move_line.shopfloor_postponed) move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_stock_out_package_wrong_parameters(self): @@ -419,7 +423,8 @@ def test_stock_out_package_wrong_parameters(self): ) move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_stock_out_package_ok(self): @@ -434,7 +439,8 @@ def test_stock_out_package_ok(self): ) move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_stock_out_line_wrong_parameters(self): @@ -461,7 +467,8 @@ def test_stock_out_line_wrong_parameters(self): ) move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_dismiss_package_level_ok(self): @@ -507,7 +514,8 @@ def test_dismiss_package_level_error_no_location(self): params={"location_id": 0, "package_level_id": package_level.id}, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) @@ -550,7 +558,9 @@ def setUpClassBaseData(cls): ) cls.move_product_a.product_uom_qty = 15 cls._update_qty_in_location( - cls.content_loc, cls.product_a, 5, + cls.content_loc, + cls.product_a, + 5, ) # Put product_b quantities in two different source locations to get # two stock move lines (6 and 4 to satisfy 10 qties) @@ -611,7 +621,8 @@ def test_stock_out_package_split_move(self): # Check the response move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) def test_stock_out_line_split_move(self): @@ -667,5 +678,6 @@ def test_stock_out_line_split_move(self): # Check the response move_lines = self.service._find_transfer_move_lines(self.content_loc) self.assert_response_start_single( - response, move_lines.mapped("picking_id"), + response, + move_lines.mapped("picking_id"), ) diff --git a/shopfloor/tests/test_location_content_transfer_start.py b/shopfloor/tests/test_location_content_transfer_start.py index c193fd0316..ebdfb1c7bf 100644 --- a/shopfloor/tests/test_location_content_transfer_start.py +++ b/shopfloor/tests/test_location_content_transfer_start.py @@ -211,7 +211,8 @@ def test_scan_location_wrong_picking_type_allow_unreserve_ok(self): self.assert_response_scan_destination_all(response, new_picking) self.assertRecordValues(new_picking, [{"user_id": self.env.uid}]) self.assertRecordValues( - new_picking.move_line_ids, [{"qty_done": 10.0}, {"qty_done": 10.0}], + new_picking.move_line_ids, + [{"qty_done": 10.0}, {"qty_done": 10.0}], ) self.assertRecordValues(new_picking.package_level_ids, [{"is_done": True}]) @@ -282,7 +283,9 @@ def test_scan_location_create_moves(self): picking_type = self.menu.picking_type_ids # product_a alone self.env["stock.quant"]._update_available_quantity( - self.product_a, self.content_loc, 10, + self.product_a, + self.content_loc, + 10, ) # product_b in a package package = self.env["stock.quant.package"].create({}) diff --git a/shopfloor/tests/test_scan_anything.py b/shopfloor/tests/test_scan_anything.py index e1d20ac132..3e49d472ed 100644 --- a/shopfloor/tests/test_scan_anything.py +++ b/shopfloor/tests/test_scan_anything.py @@ -14,7 +14,8 @@ def _test_response_ok(self, rec_type, data, identifier): params = {"identifier": identifier} response = self.service.dispatch("scan", params=params) self.assert_response( - response, data={"type": rec_type, "identifier": identifier, "record": data}, + response, + data={"type": rec_type, "identifier": identifier, "record": data}, ) def _test_response_ko(self, identifier, tried=None): diff --git a/shopfloor/tests/test_single_pack_transfer_putaway.py b/shopfloor/tests/test_single_pack_transfer_putaway.py index aeb953a498..586fb145a9 100644 --- a/shopfloor/tests/test_single_pack_transfer_putaway.py +++ b/shopfloor/tests/test_single_pack_transfer_putaway.py @@ -42,7 +42,9 @@ def test_normal_putaway(self): "start", params={"barcode": self.shelf1.barcode} ) self.assert_response( - response, next_state="scan_location", data=self.ANY, + response, + next_state="scan_location", + data=self.ANY, ) package_level_id = response["data"]["scan_location"]["id"] package_level = self.env["stock.package_level"].browse(package_level_id) diff --git a/shopfloor/tests/test_user.py b/shopfloor/tests/test_user.py index e1175ae8bb..fa873cb42c 100644 --- a/shopfloor/tests/test_user.py +++ b/shopfloor/tests/test_user.py @@ -35,5 +35,6 @@ def test_menu_by_profile(self): response = self.service.dispatch("menu") self.assert_response( - response, data={"menus": [self._data_for_menu_item(menu)]}, + response, + data={"menus": [self._data_for_menu_item(menu)]}, ) diff --git a/shopfloor/tests/test_zone_picking_base.py b/shopfloor/tests/test_zone_picking_base.py index 2f7661ba24..69dbc125ba 100644 --- a/shopfloor/tests/test_zone_picking_base.py +++ b/shopfloor/tests/test_zone_picking_base.py @@ -255,7 +255,10 @@ def setUp(self): def _assert_response_select_zone(self, response, zone_locations, message=None): data = {"zones": self.service._data_for_select_zone(zone_locations)} self.assert_response( - response, next_state="start", data=data, message=message, + response, + next_state="start", + data=data, + message=message, ) def assert_response_start(self, response, zone_locations=None, message=None): @@ -268,7 +271,10 @@ def _assert_response_select_picking_type( ): data = self.service._data_for_select_picking_type(zone_location, picking_types) self.assert_response( - response, next_state=state, data=data, message=message, + response, + next_state=state, + data=data, + message=message, ) def assert_response_select_picking_type( @@ -303,7 +309,11 @@ def _assert_response_select_line( "location_will_be_empty" ] = move_line.location_id.planned_qty_in_location_is_empty(move_line) self.assert_response( - response, next_state=state, data=data, message=message, popup=popup, + response, + next_state=state, + data=data, + message=message, + popup=popup, ) def assert_response_select_line( @@ -367,7 +377,13 @@ def assert_response_set_line_destination( ) def _assert_response_zero_check( - self, state, response, zone_location, picking_type, location, message=None, + self, + state, + response, + zone_location, + picking_type, + location, + message=None, ): self.assert_response( response, @@ -381,7 +397,12 @@ def _assert_response_zero_check( ) def assert_response_zero_check( - self, response, zone_location, picking_type, location, message=None, + self, + response, + zone_location, + picking_type, + location, + message=None, ): self._assert_response_zero_check( "zero_check", @@ -393,7 +414,13 @@ def assert_response_zero_check( ) def _assert_response_change_pack_lot( - self, state, response, zone_location, picking_type, move_line, message=None, + self, + state, + response, + zone_location, + picking_type, + move_line, + message=None, ): self.assert_response( response, @@ -407,7 +434,12 @@ def _assert_response_change_pack_lot( ) def assert_response_change_pack_lot( - self, response, zone_location, picking_type, move_line, message=None, + self, + response, + zone_location, + picking_type, + move_line, + message=None, ): self._assert_response_change_pack_lot( "change_pack_lot", diff --git a/shopfloor/tests/test_zone_picking_change_pack_lot.py b/shopfloor/tests/test_zone_picking_change_pack_lot.py index bfcca57407..51985e041a 100644 --- a/shopfloor/tests/test_zone_picking_change_pack_lot.py +++ b/shopfloor/tests/test_zone_picking_change_pack_lot.py @@ -26,7 +26,8 @@ def test_change_pack_lot_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "change_pack_lot", @@ -38,7 +39,8 @@ def test_change_pack_lot_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "change_pack_lot", @@ -50,7 +52,8 @@ def test_change_pack_lot_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) def test_change_pack_lot_no_package_or_lot_for_barcode(self): diff --git a/shopfloor/tests/test_zone_picking_select_line.py b/shopfloor/tests/test_zone_picking_select_line.py index 7c5eadeddd..35a0ab8e73 100644 --- a/shopfloor/tests/test_zone_picking_select_line.py +++ b/shopfloor/tests/test_zone_picking_select_line.py @@ -85,7 +85,10 @@ def test_list_move_lines_order_by_location(self): zone_location, picking_type, order="location" ) self.assert_response_select_line( - response, zone_location, picking_type, move_lines, + response, + zone_location, + picking_type, + move_lines, ) def test_list_move_lines_order_by_priority(self): @@ -103,7 +106,10 @@ def test_list_move_lines_order_by_priority(self): zone_location, picking_type, order="priority" ) self.assert_response_select_line( - response, zone_location, picking_type, move_lines, + response, + zone_location, + picking_type, + move_lines, ) def test_scan_source_wrong_parameters(self): @@ -118,7 +124,8 @@ def test_scan_source_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "scan_source", @@ -129,7 +136,8 @@ def test_scan_source_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) def test_scan_source_barcode_location_not_allowed(self): @@ -145,7 +153,8 @@ def test_scan_source_barcode_location_not_allowed(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.location_not_allowed(), + response, + message=self.service.msg_store.location_not_allowed(), ) def test_scan_source_barcode_location_one_move_line(self): @@ -259,7 +268,9 @@ def test_scan_source_barcode_package(self): }, ) move_lines = self.service._find_location_move_lines( - zone_location, picking_type, package=package, + zone_location, + picking_type, + package=package, ) move_lines = move_lines.sorted(lambda l: l.move_id.priority, reverse=True) move_line = move_lines[0] @@ -309,7 +320,9 @@ def test_scan_source_barcode_product(self): }, ) move_line = self.service._find_location_move_lines( - zone_location, picking_type, product=self.product_a, + zone_location, + picking_type, + product=self.product_a, ) self.assert_response_set_line_destination( response, @@ -358,7 +371,9 @@ def test_scan_source_barcode_lot(self): }, ) move_lines = self.service._find_location_move_lines( - zone_location, picking_type, lot=lot, + zone_location, + picking_type, + lot=lot, ) move_lines = move_lines.sorted(lambda l: l.move_id.priority, reverse=True) move_line = move_lines[0] @@ -424,7 +439,9 @@ def test_scan_source_multi_users(self): picking_type = self.picking1.picking_type_id # - scan source response = self.service.scan_source( - zone_location.id, picking_type.id, self.zone_sublocation1.barcode, + zone_location.id, + picking_type.id, + self.zone_sublocation1.barcode, ) move_line = self.picking1.move_line_ids self.assertEqual(response["next_state"], "set_line_destination") @@ -444,7 +461,9 @@ def test_scan_source_multi_users(self): ) as work: service = work.component(usage="zone_picking") response = service.scan_source( - zone_location.id, picking_type.id, self.zone_sublocation1.barcode, + zone_location.id, + picking_type.id, + self.zone_sublocation1.barcode, ) self.assertEqual(response["next_state"], "select_line") self.assertEqual( @@ -463,7 +482,8 @@ def test_prepare_unload_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "prepare_unload", @@ -473,7 +493,8 @@ def test_prepare_unload_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) def test_prepare_unload_buffer_empty(self): @@ -490,7 +511,10 @@ def test_prepare_unload_buffer_empty(self): # check response move_lines = self.service._find_location_move_lines(zone_location, picking_type) self.assert_response_select_line( - response, zone_location, picking_type, move_lines, + response, + zone_location, + picking_type, + move_lines, ) def test_prepare_unload_buffer_one_line(self): @@ -518,7 +542,10 @@ def test_prepare_unload_buffer_one_line(self): ) # check response self.assert_response_unload_set_destination( - response, zone_location, picking_type, move_line, + response, + zone_location, + picking_type, + move_line, ) def test_prepare_unload_buffer_multi_line_same_destination(self): @@ -555,7 +582,10 @@ def test_prepare_unload_buffer_multi_line_same_destination(self): ) # check response self.assert_response_unload_all( - response, zone_location, picking_type, self.picking5.move_line_ids, + response, + zone_location, + picking_type, + self.picking5.move_line_ids, ) def test_list_move_lines_empty_location(self): @@ -573,7 +603,10 @@ def test_list_move_lines_empty_location(self): zone_location, picking_type, order="location" ) self.assert_response_select_line( - response, zone_location, picking_type, move_lines, + response, + zone_location, + picking_type, + move_lines, ) data_move_lines = response["data"]["select_line"]["move_lines"] # Check that the move line in "Zone sub-location 1" is about to empty diff --git a/shopfloor/tests/test_zone_picking_select_picking_type.py b/shopfloor/tests/test_zone_picking_select_picking_type.py index 76b999d929..7638292fa2 100644 --- a/shopfloor/tests/test_zone_picking_select_picking_type.py +++ b/shopfloor/tests/test_zone_picking_select_picking_type.py @@ -21,7 +21,8 @@ def test_list_move_lines_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "list_move_lines", @@ -31,7 +32,8 @@ def test_list_move_lines_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) def test_list_move_lines_ok(self): diff --git a/shopfloor/tests/test_zone_picking_set_line_destination.py b/shopfloor/tests/test_zone_picking_set_line_destination.py index 3099b76eb8..a4c1594b92 100644 --- a/shopfloor/tests/test_zone_picking_set_line_destination.py +++ b/shopfloor/tests/test_zone_picking_set_line_destination.py @@ -26,7 +26,8 @@ def test_set_destination_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "set_destination", @@ -40,7 +41,8 @@ def test_set_destination_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "set_destination", @@ -54,7 +56,8 @@ def test_set_destination_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) def test_set_destination_location_confirm(self): @@ -388,7 +391,10 @@ def test_set_destination_location_zero_check(self): self.assertTrue(location_is_empty()) # Check response self.assert_response_zero_check( - response, zone_location, picking_type, move_line.location_id, + response, + zone_location, + picking_type, + move_line.location_id, ) def test_set_destination_package_full_qty(self): @@ -544,5 +550,8 @@ def test_set_destination_package_zero_check(self): self.assertTrue(location_is_empty()) # Check response self.assert_response_zero_check( - response, zone_location, picking_type, move_line.location_id, + response, + zone_location, + picking_type, + move_line.location_id, ) diff --git a/shopfloor/tests/test_zone_picking_start.py b/shopfloor/tests/test_zone_picking_start.py index 6f20c4eb95..6bda88beaa 100644 --- a/shopfloor/tests/test_zone_picking_start.py +++ b/shopfloor/tests/test_zone_picking_start.py @@ -24,7 +24,8 @@ def setUpClassBaseData(cls, *args, **kwargs): } ) cls.extra_picking = extra_picking = cls._create_picking( - lines=[(cls.product_b, 10)], picking_type=bad_picking_type, + lines=[(cls.product_b, 10)], + picking_type=bad_picking_type, ) cls._fill_stock_for_moves( extra_picking.move_lines, in_package=True, location=cls.zone_sublocation1 @@ -128,10 +129,12 @@ def test_select_zone(self): def test_scan_location_wrong_barcode(self): """Scanned location invalid, no location found.""" response = self.service.dispatch( - "scan_location", params={"barcode": "UNKNOWN LOCATION"}, + "scan_location", + params={"barcode": "UNKNOWN LOCATION"}, ) self.assert_response_start( - response, message=self.service.msg_store.no_location_found(), + response, + message=self.service.msg_store.no_location_found(), ) def test_scan_location_not_allowed(self): @@ -139,10 +142,12 @@ def test_scan_location_not_allowed(self): types' source location. """ response = self.service.dispatch( - "scan_location", params={"barcode": self.customer_location.barcode}, + "scan_location", + params={"barcode": self.customer_location.barcode}, ) self.assert_response_start( - response, message=self.service.msg_store.location_not_allowed(), + response, + message=self.service.msg_store.location_not_allowed(), ) def test_scan_location_no_move_lines(self): @@ -151,17 +156,22 @@ def test_scan_location_no_move_lines(self): # no more lines available sub1_lines.picking_id.action_cancel() response = self.service.dispatch( - "scan_location", params={"barcode": self.zone_sublocation1.barcode}, + "scan_location", + params={"barcode": self.zone_sublocation1.barcode}, ) self.assert_response_start( - response, message=self.service.msg_store.no_lines_to_process(), + response, + message=self.service.msg_store.no_lines_to_process(), ) def test_scan_location_ok(self): """Scanned location valid, list of picking types of related move lines.""" response = self.service.dispatch( - "scan_location", params={"barcode": self.zone_location.barcode}, + "scan_location", + params={"barcode": self.zone_location.barcode}, ) self.assert_response_select_picking_type( - response, zone_location=self.zone_location, picking_types=self.picking_type, + response, + zone_location=self.zone_location, + picking_types=self.picking_type, ) diff --git a/shopfloor/tests/test_zone_picking_stock_issue.py b/shopfloor/tests/test_zone_picking_stock_issue.py index 88e66e8f2d..d755113e70 100644 --- a/shopfloor/tests/test_zone_picking_stock_issue.py +++ b/shopfloor/tests/test_zone_picking_stock_issue.py @@ -23,7 +23,8 @@ def test_stock_issue_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "stock_issue", @@ -34,7 +35,8 @@ def test_stock_issue_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "stock_issue", @@ -45,7 +47,8 @@ def test_stock_issue_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) def test_stock_issue_no_more_reservation(self): @@ -65,7 +68,10 @@ def test_stock_issue_no_more_reservation(self): self.assertFalse(move.move_line_ids) move_lines = self.service._find_location_move_lines(zone_location, picking_type) self.assert_response_select_line( - response, zone_location, picking_type, move_lines, + response, + zone_location, + picking_type, + move_lines, ) def test_stock_issue1(self): @@ -87,7 +93,10 @@ def test_stock_issue1(self): self.assertFalse(move.move_line_ids) move_lines = self.service._find_location_move_lines(zone_location, picking_type) self.assert_response_select_line( - response, zone_location, picking_type, move_lines, + response, + zone_location, + picking_type, + move_lines, ) # Check that the inventory exists inventory = self.env["stock.inventory"].search( @@ -129,7 +138,10 @@ def test_stock_issue2(self): self.assertTrue(move.move_line_ids) self.assertEqual(move.move_line_ids.location_id, location) self.assert_response_set_line_destination( - response, zone_location, picking_type, move.move_line_ids, + response, + zone_location, + picking_type, + move.move_line_ids, ) # Check the inventory inventory = self.env["stock.inventory"].search( @@ -173,7 +185,10 @@ def test_stock_issue3(self): self.assertTrue(move.move_line_ids) self.assertEqual(move.move_line_ids.location_id, self.zone_sublocation2) self.assert_response_set_line_destination( - response, zone_location, picking_type, move.move_line_ids, + response, + zone_location, + picking_type, + move.move_line_ids, ) # Check the inventory inventory = self.env["stock.inventory"].search( diff --git a/shopfloor/tests/test_zone_picking_unload_all.py b/shopfloor/tests/test_zone_picking_unload_all.py index 23ec7800e8..33997cf93d 100644 --- a/shopfloor/tests/test_zone_picking_unload_all.py +++ b/shopfloor/tests/test_zone_picking_unload_all.py @@ -23,7 +23,8 @@ def test_set_destination_all_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "set_destination_all", @@ -34,7 +35,8 @@ def test_set_destination_all_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) def test_set_destination_all_different_destination(self): @@ -147,7 +149,8 @@ def test_set_destination_all_confirm_destination(self): picking_type, buffer_lines, message=self.service.msg_store.confirm_location_changed( - packing_sublocation1, packing_sublocation2, + packing_sublocation1, + packing_sublocation2, ), confirmation_required=True, ) @@ -389,7 +392,10 @@ def test_unload_split_buffer_one_line(self): # check response buffer_lines = self.service._find_buffer_move_lines(zone_location, picking_type) self.assert_response_unload_set_destination( - response, zone_location, picking_type, buffer_lines, + response, + zone_location, + picking_type, + buffer_lines, ) def test_unload_split_buffer_multi_lines(self): diff --git a/shopfloor/tests/test_zone_picking_unload_set_destination.py b/shopfloor/tests/test_zone_picking_unload_set_destination.py index 6108454386..5e6b935032 100644 --- a/shopfloor/tests/test_zone_picking_unload_set_destination.py +++ b/shopfloor/tests/test_zone_picking_unload_set_destination.py @@ -44,7 +44,8 @@ def test_unload_set_destination_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "unload_set_destination", @@ -56,7 +57,8 @@ def test_unload_set_destination_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "unload_set_destination", diff --git a/shopfloor/tests/test_zone_picking_unload_single.py b/shopfloor/tests/test_zone_picking_unload_single.py index 03f72b41a4..1db582c00c 100644 --- a/shopfloor/tests/test_zone_picking_unload_single.py +++ b/shopfloor/tests/test_zone_picking_unload_single.py @@ -25,7 +25,8 @@ def test_unload_scan_pack_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "unload_scan_pack", @@ -37,7 +38,8 @@ def test_unload_scan_pack_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) # wrong package ID, and there is still a move line to unload # => get back on 'unload_single' screen @@ -128,7 +130,10 @@ def test_unload_scan_pack_barcode_match(self): }, ) self.assert_response_unload_set_destination( - response, zone_location, picking_type, move_line, + response, + zone_location, + picking_type, + move_line, ) def test_unload_scan_pack_barcode_not_match(self): diff --git a/shopfloor/tests/test_zone_picking_zero_check.py b/shopfloor/tests/test_zone_picking_zero_check.py index 49738d8366..48ad12ab06 100644 --- a/shopfloor/tests/test_zone_picking_zero_check.py +++ b/shopfloor/tests/test_zone_picking_zero_check.py @@ -24,7 +24,8 @@ def test_is_zero_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "is_zero", @@ -36,7 +37,8 @@ def test_is_zero_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) response = self.service.dispatch( "is_zero", @@ -48,7 +50,8 @@ def test_is_zero_wrong_parameters(self): }, ) self.assert_response_start( - response, message=self.service.msg_store.record_not_found(), + response, + message=self.service.msg_store.record_not_found(), ) def test_is_zero_is_empty(self): @@ -67,7 +70,10 @@ def test_is_zero_is_empty(self): ) move_lines = self.service._find_location_move_lines(zone_location, picking_type) self.assert_response_select_line( - response, zone_location, picking_type, move_lines, + response, + zone_location, + picking_type, + move_lines, ) def test_is_zero_is_not_empty(self): @@ -86,7 +92,10 @@ def test_is_zero_is_not_empty(self): ) move_lines = self.service._find_location_move_lines(zone_location, picking_type) self.assert_response_select_line( - response, zone_location, picking_type, move_lines, + response, + zone_location, + picking_type, + move_lines, ) inventory = self.env["stock.inventory"].search( [ @@ -100,6 +109,7 @@ def test_is_zero_is_not_empty(self): self.assertEqual( inventory.name, "Zero check issue on location {} ({})".format( - move_line.location_id.name, picking_type.name, + move_line.location_id.name, + picking_type.name, ), ) diff --git a/shopfloor_batch_automatic_creation/tests/test_batch_create.py b/shopfloor_batch_automatic_creation/tests/test_batch_create.py index 13bbc50695..d5c1fb1903 100644 --- a/shopfloor_batch_automatic_creation/tests/test_batch_create.py +++ b/shopfloor_batch_automatic_creation/tests/test_batch_create.py @@ -152,5 +152,7 @@ def test_cluster_picking_select(self): data = self.data.picking_batch(batch, with_pickings=True) self.assert_response( - response, next_state="confirm_start", data=data, + response, + next_state="confirm_start", + data=data, ) diff --git a/shopfloor_checkout_sync/actions/checkout_sync.py b/shopfloor_checkout_sync/actions/checkout_sync.py index fc08ca8382..656878de58 100644 --- a/shopfloor_checkout_sync/actions/checkout_sync.py +++ b/shopfloor_checkout_sync/actions/checkout_sync.py @@ -5,8 +5,7 @@ class CheckoutSyncAction(Component): - """Provide methods sync destination location on checkout/packing - """ + """Provide methods sync destination location on checkout/packing""" _name = "shopfloor.checkout.sync.action" _inherit = "shopfloor.process.action" diff --git a/shopfloor_mobile/controllers/main.py b/shopfloor_mobile/controllers/main.py index 0a9c2465ff..b92f255263 100644 --- a/shopfloor_mobile/controllers/main.py +++ b/shopfloor_mobile/controllers/main.py @@ -128,20 +128,23 @@ def _get_manifest(self): class ShopfloorMobileAppController(http.Controller, ShopfloorMobileAppMixin): @http.route( - ["/shopfloor_mobile/app", "/shopfloor_mobile/app/"], auth="public", + ["/shopfloor_mobile/app", "/shopfloor_mobile/app/"], + auth="public", ) def load_app(self, demo=False, **kw): return self._load_app(demo=True if demo else False, **kw) @http.route( - ["/shopfloormobile/scanner"], auth="public", + ["/shopfloormobile/scanner"], + auth="public", ) def load_app_backward(self, demo=False): # Backward compat redirect (url changed from /scanner to /app) return http.redirect_with_hash("/shopfloor_mobile/app", code=301) @http.route( - ["/shopfloor_mobile/assets/"], auth="public", + ["/shopfloor_mobile/assets/"], + auth="public", ) def load_assets(self, path_fragment="", **kw): return self._serve_assets(path_fragment=path_fragment, **kw) diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_lot.js b/shopfloor_mobile/static/wms/src/components/detail/detail_lot.js index 82c294f8af..fdeb2a9a72 100644 --- a/shopfloor_mobile/static/wms/src/components/detail/detail_lot.js +++ b/shopfloor_mobile/static/wms/src/components/detail/detail_lot.js @@ -24,14 +24,14 @@ Vue.component("detail-lot", { { path: "expire_date", label: "Expiry date", - renderer: function(rec, field) { + renderer: function (rec, field) { return self.utils.misc.render_field_date(rec, field); }, }, { path: "removal_date", label: "Removal date", - renderer: function(rec, field) { + renderer: function (rec, field) { return self.utils.misc.render_field_date(rec, field); }, }, diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_mixin.js b/shopfloor_mobile/static/wms/src/components/detail/detail_mixin.js index 00ba4e769c..5a0520063a 100644 --- a/shopfloor_mobile/static/wms/src/components/detail/detail_mixin.js +++ b/shopfloor_mobile/static/wms/src/components/detail/detail_mixin.js @@ -72,7 +72,7 @@ export var ItemDetailMixin = { }, }, computed: { - wrapper_klass: function() { + wrapper_klass: function () { return [ "detail", this.$options._componentTag, diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_transfer.js b/shopfloor_mobile/static/wms/src/components/detail/detail_transfer.js index 6bdd13a310..b16168f6a7 100644 --- a/shopfloor_mobile/static/wms/src/components/detail/detail_transfer.js +++ b/shopfloor_mobile/static/wms/src/components/detail/detail_transfer.js @@ -15,7 +15,7 @@ Vue.component("detail-transfer", { { path: "scheduled_date", label: "Scheduled on", - renderer: function(rec, field) { + renderer: function (rec, field) { return self.utils.misc.render_field_date(rec, field); }, }, diff --git a/shopfloor_mobile/static/wms/src/components/forms/form_edit_stock_picking.js b/shopfloor_mobile/static/wms/src/components/forms/form_edit_stock_picking.js index 90b799d65e..fa25195829 100644 --- a/shopfloor_mobile/static/wms/src/components/forms/form_edit_stock_picking.js +++ b/shopfloor_mobile/static/wms/src/components/forms/form_edit_stock_picking.js @@ -7,14 +7,14 @@ /* eslint-disable strict */ Vue.component("form-edit-stock-picking", { props: ["record", "form"], - data: function() { + data: function () { return { form_values: {}, changed: false, }; }, methods: { - on_select: function(selected, fname) { + on_select: function (selected, fname) { this.$set(this.form_values, fname, selected.id); this.changed = true; this.$emit("change", {changed: this.changed, values: this.form_values}); diff --git a/shopfloor_mobile/static/wms/src/components/input-number-spinner.js b/shopfloor_mobile/static/wms/src/components/input-number-spinner.js index ce675a54a2..0c452c7ad8 100644 --- a/shopfloor_mobile/static/wms/src/components/input-number-spinner.js +++ b/shopfloor_mobile/static/wms/src/components/input-number-spinner.js @@ -60,19 +60,19 @@ export var NumberSpinner = Vue.component("input-number-spinner", { default: true, }, }, - data: function() { + data: function () { return { value: 0, original_value: 0, }; }, methods: { - increase: function() { + increase: function () { if (this.max == undefined || this.value < this.max) { this.value += this.step; } }, - decrease: function() { + decrease: function () { if (this.value > this.min) { const new_val = this.value - this.step; this.value = new_val >= this.min ? new_val : this.min; @@ -81,17 +81,17 @@ export var NumberSpinner = Vue.component("input-number-spinner", { }, watch: { value: { - handler: function(newVal, oldVal) { + handler: function (newVal, oldVal) { this.value = newVal; this.$emit("input", this.value); }, }, }, - created: function() { + created: function () { this.original_value = parseInt(this.init_value); this.value = parseInt(this.init_value); }, - mounted: function() { + mounted: function () { if (this.$props.select_value_on_load) { const input = $("input", this.$el).get(0); input.focus(); diff --git a/shopfloor_mobile/static/wms/src/components/list.js b/shopfloor_mobile/static/wms/src/components/list.js index e3a2dbb7ca..a4feb4c4f0 100644 --- a/shopfloor_mobile/static/wms/src/components/list.js +++ b/shopfloor_mobile/static/wms/src/components/list.js @@ -12,13 +12,13 @@ Vue.component("list", { props: { records: { type: Array, - default: function() { + default: function () { return []; }, }, grouped_records: { type: Array, - default: function() { + default: function () { return []; }, }, @@ -30,7 +30,7 @@ Vue.component("list", { }, list_item_fields: { type: Array, - default: function() { + default: function () { return []; }, }, @@ -82,7 +82,7 @@ Vue.component("list", { }, klass() { const bits = ["list"]; - _.forEach(this.opts, function(v, k) { + _.forEach(this.opts, function (v, k) { if (v) { let bit = "with-" + k; if (typeof v === "string") { diff --git a/shopfloor_mobile/static/wms/src/components/manual_select.js b/shopfloor_mobile/static/wms/src/components/manual_select.js index 7fedbd95e2..4388321518 100644 --- a/shopfloor_mobile/static/wms/src/components/manual_select.js +++ b/shopfloor_mobile/static/wms/src/components/manual_select.js @@ -9,13 +9,13 @@ Vue.component("manual-select", { props: { records: { type: Array, - default: function() { + default: function () { return []; }, }, grouped_records: { type: Array, - default: function() { + default: function () { return []; }, }, @@ -28,7 +28,7 @@ Vue.component("manual-select", { }, list_item_fields: { type: Array, - default: function() { + default: function () { return []; }, }, @@ -37,7 +37,7 @@ Vue.component("manual-select", { default: "select", }, }, - data: function() { + data: function () { return { selected: null, }; @@ -54,7 +54,7 @@ Vue.component("manual-select", { selected = initValue ? initValue : []; if (this.opts.initSelectAll) { selected = []; - _.each(this.records, function(rec, __) { + _.each(this.records, function (rec, __) { selected.push(rec.id); }); } @@ -67,12 +67,12 @@ Vue.component("manual-select", { const self = this; let selected_records = null; if (this.opts.multiple) { - selected_records = _.filter(self.records, function(o) { + selected_records = _.filter(self.records, function (o) { return self.selected.includes(o.id); }); } else { selected_records = _.head( - _.filter(self.records, function(o) { + _.filter(self.records, function (o) { return self.selected === o.id; }) ); @@ -209,7 +209,7 @@ Vue.component("manual-select", { }, klass() { const bits = ["manual-select"]; - _.forEach(this.opts, function(v, k) { + _.forEach(this.opts, function (v, k) { if (v) { let bit = "with-" + k; if (typeof v === "string") { diff --git a/shopfloor_mobile/static/wms/src/components/misc.js b/shopfloor_mobile/static/wms/src/components/misc.js index 7fa5afba4c..1a2401d23d 100644 --- a/shopfloor_mobile/static/wms/src/components/misc.js +++ b/shopfloor_mobile/static/wms/src/components/misc.js @@ -10,7 +10,7 @@ import {ItemDetailMixin} from "./detail/detail_mixin.js"; Vue.component("reset-screen-button", { props: ["show_reset_button"], methods: { - reset: function() { + reset: function () { this.$emit("reset"); }, }, @@ -34,7 +34,7 @@ Vue.component("cancel-button", { // TODO: could be merged w/ userConfirmation Vue.component("last-operation", { // Props: ['info'], - data: function() { + data: function () { return {info: {}}; }, template: ` @@ -99,7 +99,7 @@ Vue.component("state-display-info", { info: Object, }, computed: { - title: function() { + title: function () { return _.isFunction(this.info.title) ? this.info.title() : this.info.title; }, }, @@ -117,7 +117,7 @@ Vue.component("edit-action", { record: Object, options: { type: Object, - default: function() { + default: function () { return { click_event: "edit", }; @@ -145,7 +145,7 @@ Vue.component("cancel-move-line-action", { }, options: { type: Object, - default: function() { + default: function () { // Take control of which package key (source or destination) is used // to cancel the line when cancel line action is available. return { @@ -160,7 +160,7 @@ Vue.component("cancel-move-line-action", { }; }, methods: { - on_user_confirm: function(answer) { + on_user_confirm: function (answer) { this.dialog = false; if (answer === "yes") { let data = {}; @@ -175,10 +175,10 @@ Vue.component("cancel-move-line-action", { }, computed: { // `package` is a reserved identifier! - the_package: function() { + the_package: function () { return _.result(this.record, this.$props.options.package_cancel_key); }, - message: function() { + message: function () { const item = this.the_package ? this.the_package.name : this.record.product.name; @@ -276,7 +276,7 @@ Vue.component("btn-back", { }, }, methods: { - on_back: function() { + on_back: function () { this.$root.trigger("go_back"); if (this.router_back) this.$router.back(); }, @@ -292,13 +292,13 @@ Vue.component("btn-reset-config", { props: { redirect: { type: Object, - default: function() { + default: function () { return {name: "home"}; }, }, }, methods: { - reset_data: function() { + reset_data: function () { this.$root._clearConfig(); this.$root._loadMenu(); this.$root.$router.push(this.$props.redirect); @@ -314,7 +314,7 @@ Vue.component("line-actions-popup", { }, actions: { type: Array, - default: function() { + default: function () { return []; }, }, @@ -408,19 +408,19 @@ Vue.component("screen-loading", { }); Vue.component("btn-fullscreen", { - data: function() { + data: function () { return { fullscreen_on: document.fullscreenElement ? true : false, }; }, computed: { - btn_label: function() { + btn_label: function () { const transition = this.fullscreen_on ? "exit" : "enter"; return this.$t("screen.settings.fullscreen." + transition); }, }, methods: { - go_fullscreen: function() { + go_fullscreen: function () { const elem = document.documentElement; if (elem.requestFullscreen) { elem.requestFullscreen(); @@ -436,7 +436,7 @@ Vue.component("btn-fullscreen", { } this.fullscreen_on = true; }, - leave_fullscreen: function() { + leave_fullscreen: function () { if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.mozCancelFullScreen) { diff --git a/shopfloor_mobile/static/wms/src/components/packaging-qty-picker.js b/shopfloor_mobile/static/wms/src/components/packaging-qty-picker.js index 9016f2440e..80579c1d77 100644 --- a/shopfloor_mobile/static/wms/src/components/packaging-qty-picker.js +++ b/shopfloor_mobile/static/wms/src/components/packaging-qty-picker.js @@ -8,7 +8,7 @@ export var PackagingQtyPickerMixin = { props: { options: Object, }, - data: function() { + data: function () { return { value: 0, original_value: 0, @@ -17,7 +17,7 @@ export var PackagingQtyPickerMixin = { }; }, methods: { - on_change_pkg_qty: function(event) { + on_change_pkg_qty: function (event) { const input = event.target; let new_qty = parseInt(input.value || 0, 10); const data = $(input).data(); @@ -41,7 +41,7 @@ export var PackagingQtyPickerMixin = { .closest(".inner-wrapper") .addClass("error shake-it") .delay(800) - .queue(function() { + .queue(function () { // End animation $(this) .removeClass("error shake-it", 2000, "easeInOutQuad") @@ -50,7 +50,7 @@ export var PackagingQtyPickerMixin = { $(input).val(new_qty); }); }, - packaging_by_id: function(id) { + packaging_by_id: function (id) { // Special case for UOM ids as they can clash w/ pkg ids // we prefix it w/ "uom-" id = id.startsWith("uom-") ? id : parseInt(id, 10); @@ -71,7 +71,7 @@ export var PackagingQtyPickerMixin = { * @param {*} min_unit minimal unit of measure as a tuple (qty, name). Default: to UoM unit. */ - product_qty_by_packaging: function() { + product_qty_by_packaging: function () { return this._product_qty_by_packaging(this.sorted_packaging, this.value); }, /** @@ -81,11 +81,11 @@ export var PackagingQtyPickerMixin = { * @param {*} pkg_by_qty packaging records sorted by major qty * @param {*} qty total qty to satisfy */ - _product_qty_by_packaging: function(pkg_by_qty, qty) { + _product_qty_by_packaging: function (pkg_by_qty, qty) { const self = this; let res = {}; // const min_unit = _.last(pkg_by_qty); - pkg_by_qty.forEach(function(pkg) { + pkg_by_qty.forEach(function (pkg) { let qty_per_pkg = 0; [qty_per_pkg, qty] = self._qty_by_pkg(pkg.qty, qty); if (qty_per_pkg) res[pkg.id] = qty_per_pkg; @@ -99,7 +99,7 @@ export var PackagingQtyPickerMixin = { * @param {*} pkg_by_qty * @param {*} qty */ - _qty_by_pkg: function(pkg_qty, qty) { + _qty_by_pkg: function (pkg_qty, qty) { const precision = this.unit_uom.rounding || 3; let qty_per_pkg = 0; // TODO: anything better to do like `float_compare`? @@ -109,22 +109,22 @@ export var PackagingQtyPickerMixin = { } return [qty_per_pkg, qty]; }, - _compute_qty: function() { + _compute_qty: function () { const self = this; let value = 0; - _.forEach(this.qty_by_pkg, function(qty, id) { + _.forEach(this.qty_by_pkg, function (qty, id) { value += self.packaging_by_id(id).qty * qty; }); return value; }, - compute_qty: function(newVal, oldVal) { + compute_qty: function (newVal, oldVal) { this.value = this._compute_qty(); }, _init_editable() { const self = this; this.$watch( "qty_by_pkg", - function() { + function () { self.compute_qty(); }, {deep: true} @@ -134,7 +134,7 @@ export var PackagingQtyPickerMixin = { // hooking via `v-on:change` we don't get the full event but only the qty :/ // And forget about using v-text-field because it loses the full event object $(".pkg-value", this.$el).change(this.on_change_pkg_qty); - $(".pkg-value", this.$el).on("focus click", function() { + $(".pkg-value", this.$el).on("focus click", function () { $(this).select(); }); }, @@ -143,7 +143,7 @@ export var PackagingQtyPickerMixin = { this.compute_qty(); }, }, - created: function() { + created: function () { this.original_value = parseInt(this.opts.init_value, 10); this.value = parseInt(this.opts.init_value, 10); }, @@ -158,7 +158,7 @@ export var PackagingQtyPickerMixin = { }); return opts; }, - unit_uom: function() { + unit_uom: function () { let unit = {}; if (!_.isEmpty(this.opts.uom)) { // Create an object like the packaging @@ -172,7 +172,7 @@ export var PackagingQtyPickerMixin = { } return unit; }, - packaging: function() { + packaging: function () { let unit = []; if (!_.isEmpty(this.unit_uom)) { unit = [this.unit_uom]; @@ -182,7 +182,7 @@ export var PackagingQtyPickerMixin = { /** * Sort packaging by qty and exclude the ones w/ qty = 0 */ - sorted_packaging: function() { + sorted_packaging: function () { return _.reverse( _.sortBy(_.filter(this.packaging, _.property("qty")), _.property("qty")) ); @@ -191,11 +191,11 @@ export var PackagingQtyPickerMixin = { * Collect qty of contained packaging inside bigger packaging. * Eg: "1 Pallet" contains "4 Big boxes". */ - contained_packaging: function() { + contained_packaging: function () { const self = this; let res = {}; const packaging = this.sorted_packaging; - _.forEach(packaging, function(pkg, i) { + _.forEach(packaging, function (pkg, i) { if (packaging[i + 1]) { const next_pkg = packaging[i + 1]; res[pkg.id] = { @@ -229,10 +229,10 @@ export var PackagingQtyPicker = Vue.component("packaging-qty-picker", { // }, // }, // }, - mounted: function() { + mounted: function () { this._init_editable(); }, - updated: function() { + updated: function () { this.$root.trigger("qty_edit", this.value); }, template: ` @@ -266,7 +266,7 @@ export var PackagingQtyPicker = Vue.component("packaging-qty-picker", { export var PackagingQtyPickerDisplay = Vue.component("packaging-qty-picker-display", { mixins: [PackagingQtyPickerMixin], - mounted: function() { + mounted: function () { this._init_readonly(); }, template: ` diff --git a/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/mixins.js b/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/mixins.js index 19022657a0..652baaed8a 100644 --- a/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/mixins.js +++ b/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/mixins.js @@ -13,7 +13,7 @@ export var ListActionsConsumerMixin = { _get_list_item_actions(to_enable) { let actions = []; const avail_list_item_actions = this._get_available_list_item_actions(); - to_enable.forEach(function(action) { + to_enable.forEach(function (action) { if ( typeof action === "string" && !_.isUndefined(avail_list_item_actions[action]) diff --git a/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_select.js b/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_select.js index 692c9f8c71..5b4048405f 100644 --- a/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_select.js +++ b/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_select.js @@ -16,13 +16,13 @@ Vue.component("detail-picking-select", { return { action_qty_edit: { comp_name: "edit-action", - get_record: function(rec, action) { + get_record: function (rec, action) { return rec; }, - get_options: function(rec, action) { + get_options: function (rec, action) { return {click_event: "qty_edit"}; }, - enabled: function(rec, action) { + enabled: function (rec, action) { return true; }, }, diff --git a/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_summary.js b/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_summary.js index 0b8a450b1d..0ddfa153d2 100644 --- a/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_summary.js +++ b/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_summary.js @@ -37,7 +37,7 @@ Vue.component("picking-summary", { return { action_change_pkg: { comp_name: "edit-action", - get_record: function(rec, action) { + get_record: function (rec, action) { /** * Here we can get records grouped. * If lines have a dest package or not @@ -53,10 +53,10 @@ Vue.component("picking-summary", { } return rec; }, - get_options: function(rec, action) { + get_options: function (rec, action) { return {click_event: "pkg_change_type"}; }, - enabled: function(rec, action) { + enabled: function (rec, action) { // Exclude for non-packaged records. // NOTE: `pack` is available only if records are grouped. // See `utils.group_by_pack`. @@ -65,19 +65,19 @@ Vue.component("picking-summary", { }, action_cancel_line: { comp_name: "cancel-move-line-action", - get_options: function(rec, action) { + get_options: function (rec, action) { return { package_cancel_key: self.$props.action_cancel_package_key, }; }, - get_record: function(rec, action) { + get_record: function (rec, action) { if (rec.records) { // lines grouped, get real line return rec.records[0]; } return rec; }, - enabled: function(rec, action) { + enabled: function (rec, action) { return true; }, }, @@ -93,14 +93,14 @@ Vue.component("picking-summary-content", { index: Number, count: Number, }, - data: function() { + data: function () { return { panel: [], }; }, watch: { panel: { - handler: function(newVal, oldVal) { + handler: function (newVal, oldVal) { // The panel is opened $(this.$parent.$el).toggleClass("inner-panel-expanded", newVal == 0); }, diff --git a/shopfloor_mobile/static/wms/src/components/screen.js b/shopfloor_mobile/static/wms/src/components/screen.js index f18b3e2b14..2a86fd7a8c 100644 --- a/shopfloor_mobile/static/wms/src/components/screen.js +++ b/shopfloor_mobile/static/wms/src/components/screen.js @@ -9,7 +9,7 @@ Vue.component("Screen", { props: { screen_info: { type: Object, - default: function() { + default: function () { return {}; }, }, @@ -75,7 +75,7 @@ Vue.component("Screen", { mounted() { this.$watch( "drawer", - value => { + (value) => { if (value) // Refresh menu items and their counters when the drawer is expanded this.$root.loadMenu(true); @@ -85,14 +85,14 @@ Vue.component("Screen", { // Manage popup display by passed property this.$watch( "screen_info.user_popup", - value => { + (value) => { this.show_popup = Boolean(value); }, {immediate: true} ); this.$watch( "screen_info.user_message", - value => { + (value) => { this.show_message = !this.info.noUserMessage && !_.isEmpty(value); }, {immediate: true} @@ -229,7 +229,7 @@ Vue.component("nav-items", { }); Vue.component("nav-items-extra", { methods: { - navigation: function() { + navigation: function () { return [ { id: "home", diff --git a/shopfloor_mobile/static/wms/src/components/searchbar/searchbar.js b/shopfloor_mobile/static/wms/src/components/searchbar/searchbar.js index 072e99c60b..99d636f1ab 100644 --- a/shopfloor_mobile/static/wms/src/components/searchbar/searchbar.js +++ b/shopfloor_mobile/static/wms/src/components/searchbar/searchbar.js @@ -8,7 +8,7 @@ */ Vue.component("searchbar", { - data: function() { + data: function () { return { entered: "", autofocus: { @@ -26,7 +26,7 @@ Vue.component("searchbar", { }, }, methods: { - search: function(e) { + search: function (e) { e.preventDefault(); // Talk to parent this.$emit("found", { @@ -35,7 +35,7 @@ Vue.component("searchbar", { }); if (this.reset_on_submit) this.reset(); }, - reset: function() { + reset: function () { this.entered = ""; }, }, diff --git a/shopfloor_mobile/static/wms/src/components/userInformation/userInformation.js b/shopfloor_mobile/static/wms/src/components/userInformation/userInformation.js index db4691da22..99ef27e592 100644 --- a/shopfloor_mobile/static/wms/src/components/userInformation/userInformation.js +++ b/shopfloor_mobile/static/wms/src/components/userInformation/userInformation.js @@ -17,14 +17,14 @@ Vue.component("user-information", { `, computed: { - alert_type: function() { + alert_type: function () { return _.result(this.message, "message_type", "info"); }, - message_lines: function() { + message_lines: function () { const msg = _.result(this.message, "body"); return msg ? msg.split("\n") : []; }, - support_url: function() { + support_url: function () { return _.result(this.message, "support_url", ""); }, }, @@ -40,10 +40,10 @@ Vue.component("user-popup", { }, computed: { dialog: { - get: function() { + get: function () { return this.visible; }, - set: function(value) { + set: function (value) { if (!value) { this.$emit("close"); } diff --git a/shopfloor_mobile/static/wms/src/demo/demo.core.js b/shopfloor_mobile/static/wms/src/demo/demo.core.js index d603024abc..dac6fd330e 100644 --- a/shopfloor_mobile/static/wms/src/demo/demo.core.js +++ b/shopfloor_mobile/static/wms/src/demo/demo.core.js @@ -140,7 +140,7 @@ export class DemoTools { let move_lines = []; _.forEach( _.range(1, options.move_lines_count || this.getRandomInt(10)), - function() { + function () { move_lines.push(self.makeProductFullDetail({}, {})); } ); @@ -358,7 +358,7 @@ export class DemoTools { const picking = this.makeSimpleRecord(defaults, options); if (!options.no_lines) { picking.move_lines = this.makePickingLines({}, options); - picking.move_lines.forEach(function(line) { + picking.move_lines.forEach(function (line) { // Avoid cyclic references to the same picking record line.picking = _.cloneDeep(picking); }); @@ -515,7 +515,7 @@ export class DemoTools { // Find insert index to keep items w/ same scenario grouped let index = 0; - this.app_menus.every(function(item, i) { + this.app_menus.every(function (item, i) { if (item.scenario == new_item.scenario) { index = i; return false; diff --git a/shopfloor_mobile/static/wms/src/demo/demo.delivery.js b/shopfloor_mobile/static/wms/src/demo/demo.delivery.js index fe6f6c1dfb..0f19827870 100644 --- a/shopfloor_mobile/static/wms/src/demo/demo.delivery.js +++ b/shopfloor_mobile/static/wms/src/demo/demo.delivery.js @@ -33,7 +33,7 @@ const manual_selection_pickings = _.sampleSize(pickings, _.random(1, 8)); let scan_deliver = {}; -manual_selection_pickings.forEach(function(p) { +manual_selection_pickings.forEach(function (p) { scan_deliver[p.name] = { // All line have a destination pack next_state: "deliver", diff --git a/shopfloor_mobile/static/wms/src/demo/demo.zone_picking.js b/shopfloor_mobile/static/wms/src/demo/demo.zone_picking.js index 39036244ed..7492bb2483 100644 --- a/shopfloor_mobile/static/wms/src/demo/demo.zone_picking.js +++ b/shopfloor_mobile/static/wms/src/demo/demo.zone_picking.js @@ -75,7 +75,7 @@ const move_lines = demotools.makePickingLines( {lines_count: 30, line_random_pack: true, picking_auto: true} ); const select_line_move_lines = _.orderBy(move_lines, ["priority"], ["desc"]); -_.forEach(select_line_move_lines, function(line, i) { +_.forEach(select_line_move_lines, function (line, i) { // Simulate random flag line.location_will_be_empty = i % 3 == 0; }); @@ -120,7 +120,7 @@ const DEMO_CASE_1 = { }, }, }, - list_move_lines: function(data) { + list_move_lines: function (data) { let res = _.cloneDeep(list_move_lines); if (data.order == "location") { res.data.select_line.move_lines = _.orderBy( @@ -190,7 +190,7 @@ const DEMO_CASE_1 = { select_line: _.cloneDeep(list_move_lines.data.select_line), }, }, - set_destination_all: function(data) { + set_destination_all: function (data) { if (!data.confirmation) { const _data = _.extend(_.cloneDeep(unload_all_data), { confirmation_required: true, @@ -249,7 +249,7 @@ const DEMO_CASE_1 = { unload_set_destination: unload_set_destination_data, }, }, - unload_scan_destination: function(data) { + unload_scan_destination: function (data) { if (!data.confirmation) { const _data = _.extend(_.cloneDeep(unload_set_destination_data), { confirmation_required: true, diff --git a/shopfloor_mobile/static/wms/src/fetch.js b/shopfloor_mobile/static/wms/src/fetch.js index 9db1b941c9..958d5918b2 100644 --- a/shopfloor_mobile/static/wms/src/fetch.js +++ b/shopfloor_mobile/static/wms/src/fetch.js @@ -15,7 +15,7 @@ var _oldFetch = fetch; /** * Patch `fetch` to trigger events on start and end request. */ -window.fetch = function() { +window.fetch = function () { // Create hooks var fetchStart = new Event("fetchStart", { view: document, @@ -35,11 +35,11 @@ window.fetch = function() { document.dispatchEvent(fetchStart); fetchCall - .then(function() { + .then(function () { // Trigger the fetchEnd event document.dispatchEvent(fetchEnd); }) - .catch(function() { + .catch(function () { // Trigger the fetchEnd event document.dispatchEvent(fetchEnd); }); diff --git a/shopfloor_mobile/static/wms/src/homepage.js b/shopfloor_mobile/static/wms/src/homepage.js index f36eb1ab0b..29ee2cde43 100644 --- a/shopfloor_mobile/static/wms/src/homepage.js +++ b/shopfloor_mobile/static/wms/src/homepage.js @@ -13,7 +13,7 @@ export var HomePage = Vue.component("home-page", { }, }, methods: { - nuke_data_and_reload: function() { + nuke_data_and_reload: function () { if (!this.$root.demo_mode) { return; } diff --git a/shopfloor_mobile/static/wms/src/loginpage.js b/shopfloor_mobile/static/wms/src/loginpage.js index d33166fdad..ffc7395372 100644 --- a/shopfloor_mobile/static/wms/src/loginpage.js +++ b/shopfloor_mobile/static/wms/src/loginpage.js @@ -7,14 +7,14 @@ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ export var LoginPage = Vue.component("login-page", { - data: function() { + data: function () { return { apikey: "", error: "", }; }, computed: { - screen_info: function() { + screen_info: function () { return { title: this.$t("screen.login.title"), klass: "login", @@ -23,19 +23,19 @@ export var LoginPage = Vue.component("login-page", { showMenu: false, }; }, - user_message: function() { + user_message: function () { return {body: this.error, message_type: "error"}; }, }, methods: { - login: function(evt) { + login: function (evt) { evt.preventDefault(); // Call odoo application load => set the result in the local storage in json this.error = ""; this.$root.apikey = this.apikey; this.$root ._loadConfig() - .catch(error => { + .catch((error) => { this._handle_invalid_key(); }) .then(() => { diff --git a/shopfloor_mobile/static/wms/src/main.js b/shopfloor_mobile/static/wms/src/main.js index 62e4cf5b63..c56e7547b3 100644 --- a/shopfloor_mobile/static/wms/src/main.js +++ b/shopfloor_mobile/static/wms/src/main.js @@ -30,7 +30,7 @@ var EventHub = new Vue(); Vue.mixin(GlobalMixin); let app_components = {}; -_.forEach(process_registry.all(), function(process, key) { +_.forEach(process_registry.all(), function (process, key) { app_components[process.key] = process.component; }); if (app_components.length) @@ -45,7 +45,7 @@ const app = new Vue({ }, }), components: app_components, - data: function() { + data: function () { return { demo_mode: false, global_state_key: "", @@ -60,79 +60,79 @@ const app = new Vue({ registry: process_registry, }; }, - created: function() { + created: function () { const self = this; this.demo_mode = this.app_info.demo_mode; this.loadConfig(); - document.addEventListener("fetchStart", function() { + document.addEventListener("fetchStart", function () { self.loading = true; }); - document.addEventListener("fetchEnd", function() { + document.addEventListener("fetchEnd", function () { self.loading = false; }); }, - mounted: function() { + mounted: function () { const self = this; // components can trigger `state:change` on the root // and the current state gets stored into `global_state_key` - this.$root.$on("state:change", function(key) { + this.$root.$on("state:change", function (key) { self.global_state_key = key; }); - this.$root.event_hub.$on("profile:selected", function(profile) { + this.$root.event_hub.$on("profile:selected", function (profile) { self.profile = profile; self.loadMenu(true); }); }, computed: { - app_info: function() { + app_info: function () { return shopfloor_app_info; }, - has_profile: function() { + has_profile: function () { return !_.isEmpty(this.profile); }, // TODO: we can add an handler for this and avoid duplicate code profile: { - get: function() { + get: function () { if (_.isEmpty(this.current_profile)) { this.current_profile = this.$storage.get("profile"); } return this.current_profile; }, - set: function(v) { + set: function (v) { this.current_profile = v; this.$storage.set("profile", v); }, }, - profiles: function() { + profiles: function () { return this.appconfig ? this.appconfig.profiles || [] : []; }, appmenu: { - get: function() { + get: function () { if (_.isEmpty(this.profile_menu)) { this.profile_menu = this.$storage.get("menu"); } return this.profile_menu || []; }, - set: function(v) { + set: function (v) { this.profile_menu = v; this.$storage.set("menu", v); }, }, apikey: { - get: function() { + get: function () { if (!this.current_apikey) { this.current_apikey = this.$storage.get("apikey"); } return this.current_apikey; }, - set: function(v) { + set: function (v) { this.current_apikey = v; this.$storage.set("apikey", v); }, }, }, methods: { - getOdoo: function(odoo_params) { + getOdoo: function (odoo_params) { const params = _.defaults({}, odoo_params, { apikey: this.apikey, debug: this.demo_mode, @@ -145,7 +145,7 @@ const app = new Vue({ } return new OdooClass(params); }, - loadConfig: function(force) { + loadConfig: function (force) { if (this.appconfig && !force) { return this.appconfig; } @@ -160,10 +160,10 @@ const app = new Vue({ } this._loadConfig(); }, - _loadConfig: function() { + _loadConfig: function () { const self = this; const odoo = self.getOdoo({usage: "app"}); - return odoo.call("user_config").then(function(result) { + return odoo.call("user_config").then(function (result) { if (!_.isUndefined(result.data)) { self.appconfig = result.data; self.authenticated = true; @@ -174,40 +174,40 @@ const app = new Vue({ } }); }, - _clearConfig: function(reload = true) { + _clearConfig: function (reload = true) { this.$storage.remove("appconfig"); if (reload) return this._loadConfig(); }, - _clearAppData: function() { + _clearAppData: function () { this.apikey = ""; this.appmenu = []; this.profile = null; this._clearConfig(false); }, - loadMenu: function(force) { + loadMenu: function (force) { if (this.appmenu && !force) { return this.appmenu; } this._loadMenu(); return this.appmenu; }, - _loadMenu: function() { + _loadMenu: function () { const self = this; const odoo = self.getOdoo({ usage: "user", profile_id: this.profile.id, }); - return odoo.call("menu").then(function(result) { + return odoo.call("menu").then(function (result) { self.appmenu = result.data; }); }, - logout: function() { + logout: function () { this.authenticated = false; this._clearAppData(); this.$router.push({name: "login"}); }, // Likely not needed anymore - loadJS: function(url, script_id) { + loadJS: function (url, script_id) { if (script_id && !document.getElementById(script_id)) { console.debug("Load JS", url); var script = document.createElement("script"); diff --git a/shopfloor_mobile/static/wms/src/mixin.js b/shopfloor_mobile/static/wms/src/mixin.js index 2037cf13db..91a6cef87f 100644 --- a/shopfloor_mobile/static/wms/src/mixin.js +++ b/shopfloor_mobile/static/wms/src/mixin.js @@ -13,7 +13,7 @@ export var GlobalMixin = { Includes tha parent key by default. */ - make_component_key: function(bits) { + make_component_key: function (bits) { const parent_key = _.result(this.$parent, "$options._componentTag", ""); if (parent_key) bits.unshift(parent_key + "-"); bits.unshift(this.$options._componentTag); @@ -24,7 +24,7 @@ export var GlobalMixin = { /* Provide utils to all components */ - utils: function() { + utils: function () { return { misc: utils, colors: color_registry, diff --git a/shopfloor_mobile/static/wms/src/router.js b/shopfloor_mobile/static/wms/src/router.js index 217a1e2f08..dd8307a625 100644 --- a/shopfloor_mobile/static/wms/src/router.js +++ b/shopfloor_mobile/static/wms/src/router.js @@ -23,7 +23,7 @@ let routes = [ // { path: '*', component: NotFound }, ]; let registered = []; -_.forEach(process_registry.all(), function(process, key) { +_.forEach(process_registry.all(), function (process, key) { routes.push({ name: process.key, path: process.path, diff --git a/shopfloor_mobile/static/wms/src/scenario/checkout.js b/shopfloor_mobile/static/wms/src/scenario/checkout.js index 306c0c61fc..6df4fa4a45 100644 --- a/shopfloor_mobile/static/wms/src/scenario/checkout.js +++ b/shopfloor_mobile/static/wms/src/scenario/checkout.js @@ -199,7 +199,7 @@ const Checkout = { `, computed: { - existing_package_select_fields: function() { + existing_package_select_fields: function () { return [ {path: "weight"}, {path: "move_line_count", label: "Line count"}, @@ -208,13 +208,13 @@ const Checkout = { }, }, methods: { - screen_title: function() { + screen_title: function () { if (_.isEmpty(this.current_doc()) || this.state_is("confirm_start")) return this.menu_item().name; let title = this.current_doc().record.name; return title; }, - current_doc: function() { + current_doc: function () { const data = this.state_get_data("select_line"); if (_.isEmpty(data)) { return null; @@ -224,7 +224,7 @@ const Checkout = { identifier: data.picking.name, }; }, - manual_selection_manual_select_options: function() { + manual_selection_manual_select_options: function () { return { group_title_default: "Pickings to process", group_color: this.utils.colors.color_for("screen_step_todo"), @@ -238,12 +238,12 @@ const Checkout = { }, }; }, - select_line_manual_select_opts: function() { + select_line_manual_select_opts: function () { return { group_color: this.utils.colors.color_for("screen_step_todo"), }; }, - select_package_manual_select_opts: function() { + select_package_manual_select_opts: function () { return { multiple: true, initSelectAll: true, @@ -252,7 +252,7 @@ const Checkout = { }; }, }, - data: function() { + data: function () { return { usage: "checkout", initial_state_key: "select_document", @@ -262,12 +262,12 @@ const Checkout = { title: "Choose an order to pack", scan_placeholder: "Scan pack / picking / location", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("scan_document", {barcode: scanned.text}) ); }, - on_manual_selection: evt => { + on_manual_selection: (evt) => { this.wait_call(this.odoo.call("list_stock_picking")); }, }, @@ -283,7 +283,7 @@ const Checkout = { this.state_to("init"); this.reset_notification(); }, - on_select: selected => { + on_select: (selected) => { this.wait_call( this.odoo.call("select", { picking_id: selected.id, @@ -301,7 +301,7 @@ const Checkout = { select: "on_select", back: "on_back", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("scan_line", { picking_id: this.state.data.picking.id, @@ -309,7 +309,7 @@ const Checkout = { }) ); }, - on_select: selected => { + on_select: (selected) => { if (!selected) { return; } @@ -337,7 +337,7 @@ const Checkout = { ); }, // FIXME: is not to change qty - on_edit_package: pkg => { + on_edit_package: (pkg) => { this.state_set_data({package: pkg}, change_quantity); this.state_to("change_quantity"); }, @@ -365,7 +365,7 @@ const Checkout = { selected: this.state.data.selected_move_lines, }); }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("scan_package_action", { picking_id: this.state.data.picking.id, @@ -377,7 +377,7 @@ const Checkout = { }) ); }, - on_select: selected => { + on_select: (selected) => { if (!selected) { return; } @@ -401,7 +401,7 @@ const Checkout = { ); } }, - on_qty_edit: record => { + on_qty_edit: (record) => { this.state_set_data( { picking: this.state.data.picking, @@ -465,7 +465,7 @@ const Checkout = { this.state_to("select_package"); this.reset_notification(); }, - on_qty_update: qty => { + on_qty_update: (qty) => { console.log(qty); this.state.data.qty = qty; }, @@ -488,7 +488,7 @@ const Checkout = { select: "on_select", back: "on_back", }, - on_scan: scanned => { + on_scan: (scanned) => { const selected_lines = this.state_get_data("select_package") .selected; this.wait_call( @@ -502,7 +502,7 @@ const Checkout = { }) ); }, - on_select: selected => { + on_select: (selected) => { if (!selected) { return; } @@ -540,7 +540,7 @@ const Checkout = { this.state_to("start"); this.reset_notification(); }, - on_pkg_change_type: pkg => { + on_pkg_change_type: (pkg) => { this.wait_call( this.odoo.call("list_packaging", { picking_id: this.state.data.picking.id, @@ -548,7 +548,7 @@ const Checkout = { }) ); }, - on_cancel: data => { + on_cancel: (data) => { this.wait_call( this.odoo.call("cancel_line", { picking_id: this.state.data.picking.id, @@ -580,7 +580,7 @@ const Checkout = { events: { select: "on_select", }, - on_select: selected => { + on_select: (selected) => { if (!selected) { return; } diff --git a/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js b/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js index ae172a39ca..7520d870d8 100644 --- a/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js +++ b/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js @@ -103,7 +103,7 @@ const ClusterPicking = { `, computed: { - manual_select_picking_fields: function() { + manual_select_picking_fields: function () { return [ {path: "picking_count", label: "Operations"}, {path: "move_line_count", label: "Lines"}, @@ -111,7 +111,7 @@ const ClusterPicking = { }, }, methods: { - screen_title: function() { + screen_title: function () { if (_.isEmpty(this.current_batch()) || this.state_is("confirm_start")) return this.menu_item().name; let title = this.current_batch().name; @@ -121,17 +121,17 @@ const ClusterPicking = { } return title; }, - current_batch: function() { + current_batch: function () { return this.state_get_data("confirm_start"); }, - current_picking: function() { + current_picking: function () { const data = this.state_get_data("start_line") || {}; if (!data.picking) { return null; } return data.picking; }, - current_doc: function() { + current_doc: function () { const picking = this.current_picking(); if (!picking) { return {}; @@ -141,7 +141,7 @@ const ClusterPicking = { identifier: picking.name, }; }, - action_full_bin: function() { + action_full_bin: function () { this.wait_call( this.odoo.call("prepare_unload", { picking_batch_id: this.current_batch().id, @@ -149,7 +149,7 @@ const ClusterPicking = { ); }, }, - data: function() { + data: function () { // TODO: add a title to each screen return { usage: "cluster_picking", @@ -157,10 +157,10 @@ const ClusterPicking = { scan_destination_qty: 0, states: { start: { - on_get_work: evt => { + on_get_work: (evt) => { this.wait_call(this.odoo.call("find_batch")); }, - on_manual_selection: evt => { + on_manual_selection: (evt) => { this.wait_call(this.odoo.call("list_batch")); }, }, @@ -169,7 +169,7 @@ const ClusterPicking = { this.state_to("start"); this.reset_notification(); }, - on_select: selected => { + on_select: (selected) => { this.wait_call( this.odoo.call("select", { picking_batch_id: selected.id, @@ -194,7 +194,7 @@ const ClusterPicking = { this.odoo.call("unassign", { picking_batch_id: this.current_batch().id, }) - ).then(function() { + ).then(function () { self.state_reset_data_all(); }); }, @@ -206,7 +206,7 @@ const ClusterPicking = { }, // Here we have to use some info sent back from `select` // or from `find_batch` that we pass to scan line - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("scan_line", { picking_batch_id: this.current_batch().id, @@ -216,7 +216,7 @@ const ClusterPicking = { ); }, // Additional actions - on_action: action => { + on_action: (action) => { this.state["on_" + action].call(this); }, on_action_full_bin: () => { @@ -253,10 +253,10 @@ const ClusterPicking = { "start_line" ).quantity; }, - on_qty_edit: qty => { + on_qty_edit: (qty) => { this.scan_destination_qty = parseInt(qty, 10); }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("scan_destination_pack", { picking_batch_id: this.current_batch().id, @@ -271,7 +271,7 @@ const ClusterPicking = { }, }, zero_check: { - on_action: action => { + on_action: (action) => { this.state["on_" + action].call(this); }, on_action_confirm_zero: () => { @@ -322,7 +322,7 @@ const ClusterPicking = { title: "Unload all bins confirm", scan_placeholder: "Scan location", }, - on_user_confirm: answer => { + on_user_confirm: (answer) => { // TODO: check if this used // -> no flag is set to enable the confirmation dialog, // we only display a message, unlike `confirm_start` @@ -347,7 +347,7 @@ const ClusterPicking = { title: "Unload single bin", scan_placeholder: "Scan location", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("unload_scan_pack", { picking_batch_id: this.current_batch().id, @@ -362,7 +362,7 @@ const ClusterPicking = { title: "Set destination", scan_placeholder: "Scan location", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("unload_scan_destination", { picking_batch_id: this.current_batch().id, @@ -377,7 +377,7 @@ const ClusterPicking = { title: "Set destination confirm", scan_placeholder: "Scan location", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("unload_scan_destination", { picking_batch_id: this.current_batch().id, @@ -393,7 +393,7 @@ const ClusterPicking = { title: "Change pack or lot", scan_placeholder: "Scan pack or lot", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("change_pack_lot", { picking_batch_id: this.current_batch().id, diff --git a/shopfloor_mobile/static/wms/src/scenario/delivery.js b/shopfloor_mobile/static/wms/src/scenario/delivery.js index 124599cffe..bb7d755e31 100644 --- a/shopfloor_mobile/static/wms/src/scenario/delivery.js +++ b/shopfloor_mobile/static/wms/src/scenario/delivery.js @@ -55,26 +55,26 @@ const Delivery = { `, methods: { - screen_title: function() { + screen_title: function () { if (_.isEmpty(this.current_doc()) || this.state_is(this.initial_state_key)) return this.menu_item().name; return this.current_picking().name; }, - current_doc: function() { + current_doc: function () { const picking = this.current_picking(); return { record: picking, identifier: picking.name, }; }, - current_picking: function() { + current_picking: function () { const data = this.state_get_data("deliver"); if (_.isEmpty(data) || _.isEmpty(data.picking)) { return {}; } return data.picking; }, - has_picking: function() { + has_picking: function () { return !_.isEmpty(this.current_picking()); }, deliver_picking_summary_records_grouped(picking) { @@ -84,14 +84,14 @@ const Delivery = { this.utils.misc.group_by_pack, "package_src" ), - group_color_maker: function(lines) { + group_color_maker: function (lines) { return self.utils.misc.move_lines_completeness(lines) == 100 ? "screen_step_done" : "screen_step_todo"; }, }); }, - deliver_move_line_list_options: function(picking) { + deliver_move_line_list_options: function (picking) { return { list_item_options: { actions: ["action_cancel_line"], @@ -100,10 +100,10 @@ const Delivery = { }, }; }, - move_line_detail_fields: function() { + move_line_detail_fields: function () { return [{path: "package_src.name", klass: "loud"}]; }, - manual_select_options: function() { + manual_select_options: function () { return { show_title: false, showActions: false, @@ -115,7 +115,7 @@ const Delivery = { }, }; }, - manual_select_picking_fields: function() { + manual_select_picking_fields: function () { const self = this; return [ {path: "name", klass: "loud", action_val_path: "name"}, @@ -124,7 +124,7 @@ const Delivery = { { path: "move_line_count", label: "Lines", - renderer: function(rec, field) { + renderer: function (rec, field) { return ( self.utils.misc.completed_move_lines(rec.move_lines) + " / " + @@ -134,7 +134,7 @@ const Delivery = { }, ]; }, - existing_package_select_fields: function() { + existing_package_select_fields: function () { return [ {path: "weight"}, {path: "move_line_count", label: "Line count"}, @@ -142,7 +142,7 @@ const Delivery = { ]; }, }, - data: function() { + data: function () { return { usage: "delivery", initial_state_key: "select_document", @@ -153,12 +153,12 @@ const Delivery = { title: "Start by scanning something", scan_placeholder: "Scan pack / picking", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("scan_deliver", {barcode: scanned.text}) ); }, - on_manual_selection: evt => { + on_manual_selection: (evt) => { this.wait_call(this.odoo.call("list_stock_picking")); }, }, @@ -170,7 +170,7 @@ const Delivery = { events: { cancel_picking_line: "on_cancel", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("scan_deliver", { barcode: scanned.text, @@ -178,10 +178,10 @@ const Delivery = { }) ); }, - on_manual_selection: evt => { + on_manual_selection: (evt) => { this.wait_call(this.odoo.call("list_stock_picking")); }, - on_cancel: data => { + on_cancel: (data) => { let endpoint, endpoint_data; // TODO: can't we have a single endpoint as per checkout.summary.destroy? if (data.package_id) { @@ -216,25 +216,25 @@ const Delivery = { select: "on_select", go_back: "on_back", }, - on_scan: scanned => { + on_scan: (scanned) => { this.state_set_data({filtered: scanned.text}); }, on_back: () => { this.state_to("start"); this.reset_notification(); }, - on_select: selected => { + on_select: (selected) => { this.wait_call( this.odoo.call("scan_deliver", {barcode: selected.name}) ); }, - visible_records: records => { + visible_records: (records) => { const self = this; let visible_records = this.utils.misc.order_picking_by_completeness( records ); if (this.state.data.filtered) { - visible_records = _.filter(visible_records, function(rec) { + visible_records = _.filter(visible_records, function (rec) { return rec.name.search(self.state.data.filtered) > 0; }); } diff --git a/shopfloor_mobile/static/wms/src/scenario/form.js b/shopfloor_mobile/static/wms/src/scenario/form.js index 934fe32a10..539eed4d14 100644 --- a/shopfloor_mobile/static/wms/src/scenario/form.js +++ b/shopfloor_mobile/static/wms/src/scenario/form.js @@ -24,7 +24,7 @@ const Form = { `, - data: function() { + data: function () { return { usage: "", form_name: "", @@ -33,7 +33,7 @@ const Form = { user_message: {}, }; }, - mounted: function() { + mounted: function () { this.usage = this.$route.params.form_name; const odoo_params = { usage: this.usage, @@ -45,14 +45,14 @@ const Form = { } }, methods: { - on_change: function(form_data) { + on_change: function (form_data) { if (!form_data.changed) { return; } const self = this; let form_values = form_data.values; form_values["_id"] = this.record.id; - this.odoo.call("update", form_values).then(function(result) { + this.odoo.call("update", form_values).then(function (result) { self._load_form_data(result); /** * TODO: dirty hack to be able to display the message to the user @@ -62,16 +62,16 @@ const Form = { * by form as you might want to stay in the same place on save. * */ - setTimeout(function() { + setTimeout(function () { self.$root.trigger("go_back"); self.$router.back(); }, 1500); }); }, - _getFormData: function(record_id) { + _getFormData: function (record_id) { this.odoo.call(record_id, {}, "GET").then(this._load_form_data); }, - _load_form_data: function(result) { + _load_form_data: function (result) { this.odoo_data = result.data || {}; this.record = this.odoo_data.record || {}; this.form = this.odoo_data.form || {}; @@ -91,14 +91,14 @@ const Form = { }, }, computed: { - screen_info: function() { + screen_info: function () { return { title: this.screen_title, klass: "form", user_message: this.user_message, }; }, - screen_title: function() { + screen_title: function () { let title = "Edit"; // TODO: this should come from the form if (!_.isEmpty(this.record)) { title = "Edit: " + this.record.name; diff --git a/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js b/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js index d9cefd93a1..30f4009169 100644 --- a/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js +++ b/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js @@ -85,12 +85,12 @@ const LocationContentTransfer = { `, methods: { - screen_title: function() { + screen_title: function () { if (!this.has_picking()) return this.menu_item().name; return this.current_picking().name; }, // TODO: if we have this working we can remove the picking detail? - current_doc: function() { + current_doc: function () { const picking = this.current_picking(); return { record: picking, @@ -98,14 +98,14 @@ const LocationContentTransfer = { }; }, // TODO: ask Joél if this is needed - current_picking: function() { + current_picking: function () { const data = this.state_get_data("start"); if (_.isEmpty(data) || _.isEmpty(data.move_line.picking)) { return {}; } return data.move_line.picking; }, - has_picking: function() { + has_picking: function () { return !_.isEmpty(this.current_picking()); }, /** @@ -115,7 +115,7 @@ const LocationContentTransfer = { * We'll work alway with multiple records and loop on them. * TODO: this should be computed to be cached. */ - wrapped_context: function() { + wrapped_context: function () { const data = this.state.data; let res = { has_records: true, @@ -140,14 +140,14 @@ const LocationContentTransfer = { res.location_dest = res.has_records ? res.records[0].location_dest : null; return res; }, - move_line_detail_list_options: function(move_line) { + move_line_detail_list_options: function (move_line) { return this.utils.misc.move_line_product_detail_options(move_line, { loud_labels: true, fields_blacklist: ["product.qty_available"], fields: [{path: "location_src.name", label: "From"}], }); }, - line_actions: function() { + line_actions: function () { let actions = [ {name: "Postpone line", event_name: "action_postpone"}, {name: "Declare stock out", event_name: "action_stock_out"}, @@ -158,10 +158,10 @@ const LocationContentTransfer = { return actions; }, // Common actions - on_line_action: function(action) { + on_line_action: function (action) { this["on_" + action.event_name].call(this); }, - on_action_postpone: function() { + on_action_postpone: function () { let endpoint, endpoint_data; const data = this.state.data; if (data.package_level) { @@ -179,11 +179,11 @@ const LocationContentTransfer = { } this.wait_call(this.odoo.call(endpoint, endpoint_data)); }, - on_action_stock_out: function() { + on_action_stock_out: function () { this.state_set_data(this.state.data, "stock_issue"); this.state_to("stock_issue"); }, - on_action_open_package: function() { + on_action_open_package: function () { const data = this.state.data; let endpoint_data = { location_id: data.package_level.location_src.id, @@ -192,7 +192,7 @@ const LocationContentTransfer = { this.wait_call(this.odoo.call("dismiss_package_level", endpoint_data)); }, }, - data: function() { + data: function () { const self = this; return { usage: "location_content_transfer", @@ -209,7 +209,7 @@ const LocationContentTransfer = { title: "Start by scanning a location", scan_placeholder: "Scan location", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("scan_location", {barcode: scanned.text}) ); @@ -220,7 +220,7 @@ const LocationContentTransfer = { title: "Scan destination location for all items", scan_placeholder: "Scan location", }, - on_scan: scanned => { + on_scan: (scanned) => { const data = this.state.data; this.wait_call( this.odoo.call("set_destination_all", { @@ -241,7 +241,7 @@ const LocationContentTransfer = { display_info: { scan_placeholder: "Scan pack / product / lot", }, - on_scan: scanned => { + on_scan: (scanned) => { let endpoint, endpoint_data; const data = this.state.data; if (data.package_level) { @@ -273,10 +273,10 @@ const LocationContentTransfer = { events: { qty_edit: "on_qty_update", }, - on_qty_update: qty => { + on_qty_update: (qty) => { this.scan_destination_qty = parseInt(qty, 10); }, - on_scan: scanned => { + on_scan: (scanned) => { let endpoint, endpoint_data; const data = this.state.data; if (data.package_level) { diff --git a/shopfloor_mobile/static/wms/src/scenario/mixins.js b/shopfloor_mobile/static/wms/src/scenario/mixins.js index 1c1b89fc42..0dc5139fe5 100644 --- a/shopfloor_mobile/static/wms/src/scenario/mixins.js +++ b/shopfloor_mobile/static/wms/src/scenario/mixins.js @@ -5,7 +5,7 @@ */ export var ScenarioBaseMixin = { - data: function() { + data: function () { return { messages: { message: { @@ -27,11 +27,11 @@ export var ScenarioBaseMixin = { }; }, watch: { - "$route.params.menu_id": function() { + "$route.params.menu_id": function () { this.menu_item_id = this._get_menu_item_id(); }, }, - created: function() { + created: function () { this.menu_item_id = this._get_menu_item_id(); }, beforeRouteUpdate(to, from, next) { @@ -39,7 +39,7 @@ export var ScenarioBaseMixin = { this._state_load(to.params.state); next(); }, - beforeMount: function() { + beforeMount: function () { /* Ensure initial state is set. beforeRouteUpdate` runs only if the route has changed, @@ -50,7 +50,7 @@ export var ScenarioBaseMixin = { this._state_load(this.$route.params.state); }, computed: { - odoo: function() { + odoo: function () { const odoo_params = { process_menu_id: this.menu_item_id, profile_id: this.$root.profile.id, @@ -65,24 +65,24 @@ export var ScenarioBaseMixin = { standalone object w/ their own class. */ state: { - get: function() { + get: function () { if (_.isEmpty(this.current_state)) { return this._make_current_state(); } return this.current_state; }, - set: function(data) { + set: function (data) { this.current_state = this._make_current_state(data); }, }, - search_input_placeholder: function() { + search_input_placeholder: function () { const placeholder = this.state.display_info.scan_placeholder; return _.isFunction(placeholder) ? placeholder.call(this) : placeholder; }, - show_cancel_button: function() { + show_cancel_button: function () { return this.state.display_info.show_cancel_button; }, - screen_info: function() { + screen_info: function () { return { // you can provide a different screen title title: this.screen_title ? this.screen_title() : this.menu_item().name, @@ -93,13 +93,13 @@ export var ScenarioBaseMixin = { noUserMessage: this.need_confirmation, }; }, - user_message: function() { + user_message: function () { if (_.result(this.messages, "message.body")) { return this.messages.message; } return null; }, - user_popup: function() { + user_popup: function () { if (_.result(this.messages, "popup.body")) { return this.messages.popup; } @@ -107,7 +107,7 @@ export var ScenarioBaseMixin = { }, }, methods: { - _get_menu_item_id: function() { + _get_menu_item_id: function () { const menu_id = Number.parseInt(this.$route.params.menu_id, 10); if (Number.isNaN(menu_id)) { /* @@ -130,7 +130,7 @@ export var ScenarioBaseMixin = { * * @param {*} state_key: a state key other that current_state_key */ - _get_state_spec: function(state_key) { + _get_state_spec: function (state_key) { // TODO: this function is the 1st step towards moving state definition // out of the component data (which makes no sense). return this.states[state_key || this.current_state_key]; @@ -143,7 +143,7 @@ export var ScenarioBaseMixin = { * * @param {*} data */ - _make_current_state: function(data = {}) { + _make_current_state: function (data = {}) { const state = { key: this.current_state_key, data: data, @@ -152,30 +152,30 @@ export var ScenarioBaseMixin = { _.defaults(state, {display_info: {}}); return state; }, - screen_klass: function() { + screen_klass: function () { return this.usage + " " + "state-" + this.current_state_key; }, - menu_item: function() { + menu_item: function () { const self = this; return _.head( - _.filter(this.$root.appmenu.menus, function(m) { + _.filter(this.$root.appmenu.menus, function (m) { return m.id === self.menu_item_id; }) ); }, - make_state_component_key: function(bits) { + make_state_component_key: function (bits) { bits.unshift(this.current_state_key); bits.unshift(this.usage); return this.make_component_key(bits); }, - storage_key: function(state_key) { + storage_key: function (state_key) { state_key = _.isUndefined(state_key) ? this.current_state_key : state_key; return this.usage + "." + state_key; }, /* Switch state to given one. */ - state_to: function(state_key) { + state_to: function (state_key) { const self = this; return this.$router .push({ @@ -191,27 +191,27 @@ export var ScenarioBaseMixin = { }); }, // Generic states methods - state_is: function(state_key) { + state_is: function (state_key) { return state_key == this.current_state_key; }, - state_in: function(state_keys) { + state_in: function (state_keys) { return _.filter(state_keys, this.state_is).length > 0; }, - state_reset_data: function(state_key) { + state_reset_data: function (state_key) { state_key = state_key || this.current_state_key; this.$root.$storage.remove(this.storage_key(state_key)); }, - _state_get_data: function(state_key) { + _state_get_data: function (state_key) { return this.$root.$storage.get(this.storage_key(state_key), {}); }, - _state_set_data: function(state_key, v) { + _state_set_data: function (state_key, v) { this.$root.$storage.set(this.storage_key(state_key), v); }, - state_get_data: function(state_key) { + state_get_data: function (state_key) { state_key = state_key || this.current_state_key; return this._state_get_data(state_key); }, - state_set_data: function(data, state_key, reload_state = true) { + state_set_data: function (data, state_key, reload_state = true) { state_key = state_key || this.current_state_key; const new_data = _.merge({}, this.state_get_data(state_key), data); // Trigger update of computed `state.data` and refreshes the UI. @@ -220,16 +220,16 @@ export var ScenarioBaseMixin = { this._reload_current_state(); } }, - _reload_current_state: function() { + _reload_current_state: function () { // Force re-computation of current state data. this.state = this.state_get_data(); }, state_reset_data_all() { const self = this; - const keys_to_clear = _.filter(this.$storage.keys(), x => { + const keys_to_clear = _.filter(this.$storage.keys(), (x) => { return x.includes(self.usage); }); - keys_to_clear.forEach(key => { + keys_to_clear.forEach((key) => { // Key includes the whole string w/ prefix, need the state key only self.state_reset_data(_.last(key.split("."))); }); @@ -237,7 +237,7 @@ export var ScenarioBaseMixin = { /* Loads a new state, handle transition, setup event handlers. */ - _state_load: function(state_key, promise) { + _state_load: function (state_key, promise) { if (state_key == "init") { /* Alias "init" to the initial state @@ -282,25 +282,25 @@ export var ScenarioBaseMixin = { // notify root this.$root.$emit("state:change", this._global_state_key(state_key)); }, - _global_state_key: function(state_key) { + _global_state_key: function (state_key) { return this.usage + "/" + state_key; }, - wait_call: function(promise, callback) { + wait_call: function (promise, callback) { return promise.then(this.on_call_success, this.on_call_error); }, - on_state_enter: function() { + on_state_enter: function () { const state = this._get_state_spec(); if (state.enter) { state.enter(); } }, - on_state_exit: function() { + on_state_exit: function () { const state = this._get_state_spec(); if (state.exit) { state.exit(); } }, - on_call_success: function(result) { + on_call_success: function (result) { if (_.isUndefined(result)) { console.error(result); alert("Something went wrong. Check log."); @@ -336,16 +336,16 @@ export var ScenarioBaseMixin = { this.state_to(state_key); } }, - on_call_error: function(result) { + on_call_error: function (result) { alert(result.status + " " + result.error); }, - on_reset: function(e) { + on_reset: function (e) { this.state_reset_data_all(); this.reset_notification(); this.state_to("start"); }, // Specific states methods - on_scan: function(scanned) { + on_scan: function (scanned) { const state = this._get_state_spec(); if (state.on_scan) { state.on_scan(scanned); @@ -353,29 +353,29 @@ export var ScenarioBaseMixin = { }, // TODO: get rid of this as it's used on cluster_picking only and // we can use state events binding. - on_cancel: function() { + on_cancel: function () { const state = this._get_state_spec(); if (state.on_cancel) { state.on_cancel(); } }, - on_user_confirm: function(answer) { + on_user_confirm: function (answer) { const state = this._get_state_spec(); state.on_user_confirm(answer); this.need_confirmation = false; this.reset_notification(); }, - set_message: function(message) { + set_message: function (message) { this.$set(this.messages, "message", message); }, - set_popup: function(popup) { + set_popup: function (popup) { this.$set(this.messages, "popup", popup); }, - reset_notification: function() { + reset_notification: function () { this.$set(this.messages, "message", {body: null, message_type: null}); this.$set(this.messages, "popup", {body: null}); }, - display_app_error: function(error) { + display_app_error: function (error) { let parts = [error.status, error.name]; if (error.description) { parts.push("\n" + error.description); @@ -387,7 +387,7 @@ export var ScenarioBaseMixin = { support_url_text: "View / share log entry", }); }, - _state_bind_events: function() { + _state_bind_events: function () { const state = this._get_state_spec(); if (state.events) { /* @@ -407,7 +407,7 @@ export var ScenarioBaseMixin = { to a particular event fired on a specific state */ const self = this; - _.each(state.events, function(handler, name) { + _.each(state.events, function (handler, name) { if (typeof handler == "string") handler = state[handler]; const event_name = self._global_state_key(self.state.key) + ":" + name; diff --git a/shopfloor_mobile/static/wms/src/scenario/scan_anything.js b/shopfloor_mobile/static/wms/src/scenario/scan_anything.js index 8b824254b0..402eabf4e4 100644 --- a/shopfloor_mobile/static/wms/src/scenario/scan_anything.js +++ b/shopfloor_mobile/static/wms/src/scenario/scan_anything.js @@ -34,7 +34,7 @@ const ScanAnything = { `, - data: function() { + data: function () { return { usage: "scan_anything", scan_full_data: {}, @@ -61,18 +61,18 @@ const ScanAnything = { next(); }, methods: { - on_reset: function(e) { + on_reset: function (e) { this.scan_data = {}; this.$router.push({name: "scan_anything", params: {identifier: undefined}}); }, - getData: function(identifier) { - this.odoo.call("scan", {identifier: identifier}).then(result => { + getData: function (identifier) { + this.odoo.call("scan", {identifier: identifier}).then((result) => { this.scan_full_data = result || {}; this.scan_data = result.data || {}; this.scan_message = result.message || null; }); }, - on_scan: function(scanned) { + on_scan: function (scanned) { if (this.$route.params.identifier == scanned.text) { // scanned same resource, just reload this.getData(scanned.text); @@ -96,14 +96,14 @@ const ScanAnything = { }, }, computed: { - screen_info: function() { + screen_info: function () { return { title: this.screen_title, klass: "scan-anything", user_message: this.scan_message, }; }, - screen_title: function() { + screen_title: function () { let title = "Scan"; if (this.$route.params.identifier) { title = "Scanned: " + this.$route.params.identifier; @@ -112,13 +112,13 @@ const ScanAnything = { what: this.$route.params.identifier, }); }, - displayOnly: function() { + displayOnly: function () { return this.$route.query.displayOnly; }, - showBackBtn: function() { + showBackBtn: function () { return "childOf" in this.$route.query || this.displayOnly; }, - showResetBtn: function() { + showResetBtn: function () { return !_.isEmpty(this.scan_data); }, }, diff --git a/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js b/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js index 44559eed02..367478c478 100644 --- a/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js +++ b/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js @@ -10,7 +10,7 @@ import {ScenarioBaseMixin} from "./mixins.js"; import {process_registry} from "../services/process_registry.js"; export var SinglePackStatesMixin = { - data: function() { + data: function () { return { states: { // Generic state for when to start w/ scanning a pack or loc @@ -19,7 +19,7 @@ export var SinglePackStatesMixin = { title: "Start by scanning a pack or a location", scan_placeholder: "Scan pack", }, - on_scan: scanned => { + on_scan: (scanned) => { const data = this.state.data; this.wait_call( this.odoo.call("start", { @@ -85,7 +85,7 @@ const SinglePackTransfer = { `, - data: function() { + data: function () { return { usage: "single_pack_transfer", show_reset_button: true, diff --git a/shopfloor_mobile/static/wms/src/scenario/zone_picking.js b/shopfloor_mobile/static/wms/src/scenario/zone_picking.js index d1ba49d82a..4f4a604823 100644 --- a/shopfloor_mobile/static/wms/src/scenario/zone_picking.js +++ b/shopfloor_mobile/static/wms/src/scenario/zone_picking.js @@ -208,26 +208,26 @@ const TEMPLATES = { const ZonePicking = { mixins: [ScenarioBaseMixin], methods: { - screen_klass: function() { + screen_klass: function () { return ( this.$super(ScenarioBaseMixin).screen_klass() + " device-mode-" + this.device_mode ); }, - screen_title: function() { + screen_title: function () { const record = this.current_picking_type(); if (!record) return this.menu_item().name; return record.name; }, // TODO: if we have this working we can remove the picking detail? - current_doc: function() { + current_doc: function () { const record = this.current_picking_type(); return { record: record, }; }, - current_picking_type: function() { + current_picking_type: function () { if ( ["start", "scan_location", "select_picking_type"].includes( this.current_state_key @@ -241,7 +241,7 @@ const ZonePicking = { } return data.picking_type; }, - current_zone_location: function() { + current_zone_location: function () { if (["start", "scan_location"].includes(this.current_state_key)) { return {}; } @@ -251,7 +251,7 @@ const ZonePicking = { } return data.zone_location; }, - scan_location_manual_select_options: function() { + scan_location_manual_select_options: function () { return { group_title_default: "Available zones", group_color: this.utils.colors.color_for("screen_step_todo"), @@ -262,7 +262,7 @@ const ZonePicking = { }, }; }, - manual_select_zone_fields: function() { + manual_select_zone_fields: function () { return [ { path: "name", @@ -270,7 +270,7 @@ const ZonePicking = { }, ]; }, - select_picking_type_manual_select_options: function() { + select_picking_type_manual_select_options: function () { return { group_title_default: "Available operation types", group_color: this.utils.colors.color_for("screen_step_todo"), @@ -281,7 +281,7 @@ const ZonePicking = { }, }; }, - manual_select_picking_type_fields: function() { + manual_select_picking_type_fields: function () { return [ { path: "name", @@ -296,9 +296,9 @@ const ZonePicking = { name: record.name, }); }, - select_line_table_headers: function() { + select_line_table_headers: function () { // Convert to v-data-table keys - let headers = _.map(this.move_line_list_fields(true), function(field) { + let headers = _.map(this.move_line_list_fields(true), function (field) { return { text: field.label, value: field.path, @@ -308,12 +308,12 @@ const ZonePicking = { }); return headers; }, - select_line_table_items: function() { + select_line_table_items: function () { const self = this; // Convert to v-data-table keys - let items = _.map(this.state.data.move_lines, function(record) { + let items = _.map(this.state.data.move_lines, function (record) { let item_data = {}; - _.forEach(self.move_line_list_fields(true), function(field) { + _.forEach(self.move_line_list_fields(true), function (field) { item_data[field.path] = _.result(record, field.path); if (field.renderer) { item_data[field.path] = field.renderer(record, field); @@ -324,7 +324,7 @@ const ZonePicking = { }); return items; }, - select_line_move_line_detail_options: function() { + select_line_move_line_detail_options: function () { let options = { key_title: "location_src.name", group_color: this.utils.colors.color_for("screen_step_todo"), @@ -334,7 +334,7 @@ const ZonePicking = { list_item_options: { loud_title: true, fields: this.move_line_list_fields(), - list_item_klass_maker: function(rec) { + list_item_klass_maker: function (rec) { return rec.location_will_be_empty ? "location-will-be-empty" : ""; @@ -343,14 +343,14 @@ const ZonePicking = { }; return options; }, - move_line_list_fields: function(table_mode = false) { + move_line_list_fields: function (table_mode = false) { const self = this; let fields = [ {path: "product.display_name", label: table_mode ? "Product" : null}, { path: "package_src.name", label: "Pack / Lot", - renderer: function(rec, field) { + renderer: function (rec, field) { const pkg = _.result(rec, "package_src.name", ""); const lot = _.result(rec, "lot.name", ""); return lot ? pkg + "\n" + lot : pkg; @@ -360,7 +360,7 @@ const ZonePicking = { path: "quantity", label: "Qty", render_component: "packaging-qty-picker-display", - render_options: function(record) { + render_options: function (record) { return self.utils.misc.move_line_qty_picker_options(record); }, }, @@ -368,7 +368,7 @@ const ZonePicking = { { path: "picking.scheduled_date", label: "Date", - renderer: function(rec, field) { + renderer: function (rec, field) { return self.utils.misc.render_field_date(rec, field); }, }, @@ -376,7 +376,7 @@ const ZonePicking = { path: "priority", label: table_mode ? "Priority" : null, render_component: "priority-widget", - render_options: function(record) { + render_options: function (record) { return {priority: parseInt(record.priority || "0", 10)}; }, }, @@ -426,12 +426,12 @@ const ZonePicking = { this.utils.misc.group_by_pack, "package_dest" ), - group_color_maker: function(lines) { + group_color_maker: function (lines) { return "screen_step_todo"; }, }); }, - picking_summary_move_line_list_options: function(move_lines) { + picking_summary_move_line_list_options: function (move_lines) { return { group_color: this.state_in(["unload_set_destination"]) ? this.utils.colors.color_for("screen_step_done") @@ -443,7 +443,7 @@ const ZonePicking = { }, }; }, - picking_summary_move_line_detail_fields: function() { + picking_summary_move_line_detail_fields: function () { return [{path: "package_src.name", klass: "loud"}]; }, }, @@ -455,7 +455,7 @@ const ZonePicking = { }, device_mode() { let _mode = "mobile"; - _.forEach(this.media_queries, function(mode, query) { + _.forEach(this.media_queries, function (mode, query) { if (window.matchMedia(query).matches) { _mode = mode; } @@ -463,7 +463,7 @@ const ZonePicking = { return _mode; }, }, - data: function() { + data: function () { return { usage: "zone_picking", initial_state_key: "scan_location", @@ -487,12 +487,12 @@ const ZonePicking = { this.state_to("init"); this.reset_notification(); }, - on_select: selected => { + on_select: (selected) => { this.wait_call( this.odoo.call("scan_location", {barcode: selected.barcode}) ); }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("scan_location", {barcode: scanned.text}) ); @@ -509,7 +509,7 @@ const ZonePicking = { this.state_to("init"); this.reset_notification(); }, - on_select: selected => { + on_select: (selected) => { this.list_move_lines(selected.id); }, }, @@ -530,16 +530,16 @@ const ZonePicking = { }) ); }, - on_scan: scanned => { + on_scan: (scanned) => { this.scan_source(scanned.text); }, - on_select: selected => { + on_select: (selected) => { let path = "package_src.name"; let barcode = _.result(selected, path); while (!barcode) { _.forEach( ["lot.name", "product.barcode", "location_src.barcode"], - function(path) { + function (path) { barcode = _.result(selected, path); } ); @@ -565,7 +565,7 @@ const ZonePicking = { events: { qty_edit: "on_qty_update", }, - on_qty_update: qty => { + on_qty_update: (qty) => { this.scan_destination_qty = parseInt(qty, 10); if (this.state.data.move_line.quantity != qty) { this.state.display_info.scan_placeholder = this.state.display_info.scan_placeholder_partial; @@ -573,7 +573,7 @@ const ZonePicking = { this.state.display_info.scan_placeholder = this.state.display_info.scan_placeholder_full; } }, - on_scan: scanned => { + on_scan: (scanned) => { const data = this.state.data; this.wait_call( this.odoo.call("set_destination", { @@ -586,7 +586,7 @@ const ZonePicking = { }) ); }, - on_action: action => { + on_action: (action) => { this.state["on_" + action.event_name].call(this); }, on_action_stock_out: () => { @@ -605,7 +605,7 @@ const ZonePicking = { title: "Unload all bins", scan_placeholder: "Scan location", }, - on_scan: scanned => { + on_scan: (scanned) => { this.state_set_data({location_barcode: scanned.text}); this.wait_call( this.odoo.call("set_destination_all", { @@ -630,7 +630,7 @@ const ZonePicking = { title: "Unload single pack", scan_placeholder: "Scan pack", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("unload_scan_pack", { zone_location_id: this.current_zone_location().id, @@ -646,7 +646,7 @@ const ZonePicking = { title: "Set destination", scan_placeholder: "Scan location", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("unload_set_destination", { zone_location_id: this.current_zone_location().id, @@ -663,7 +663,7 @@ const ZonePicking = { title: "Change pack or lot", scan_placeholder: "Scan pack or lot", }, - on_scan: scanned => { + on_scan: (scanned) => { this.wait_call( this.odoo.call("change_pack_lot", { zone_location_id: this.current_zone_location().id, @@ -678,7 +678,7 @@ const ZonePicking = { enter: () => { this.reset_notification(); }, - on_action: action => { + on_action: (action) => { this.state["on_" + action].call(this); }, on_confirm_stock_issue: () => { @@ -697,10 +697,10 @@ const ZonePicking = { }, }, zero_check: { - on_action: action => { + on_action: (action) => { this.state["on_" + action].call(this); }, - is_zero: zero_flag => { + is_zero: (zero_flag) => { this.wait_call( this.odoo.call("is_zero", { zone_location_id: this.current_zone_location().id, @@ -728,7 +728,7 @@ const ZonePicking = { }, media_queries: { type: Object, - default: function() { + default: function () { return { "(min-width: 500px)": "desktop", }; @@ -736,7 +736,7 @@ const ZonePicking = { }, compiled_templates: { type: Object, - default: function() { + default: function () { return TEMPLATES; }, }, diff --git a/shopfloor_mobile/static/wms/src/services/odoo.js b/shopfloor_mobile/static/wms/src/services/odoo.js index 1e4f0c175d..024894e438 100644 --- a/shopfloor_mobile/static/wms/src/services/odoo.js +++ b/shopfloor_mobile/static/wms/src/services/odoo.js @@ -33,13 +33,13 @@ export class OdooMixin { } else if (method == "POST") { params.body = JSON.stringify(data); } - return fetch(this._get_url(endpoint), params).then(response => { + return fetch(this._get_url(endpoint), params).then((response) => { if (!response.ok) { let handler = self["_handle_" + response.status.toString()]; if (_.isUndefined(handler)) { handler = this._handle_error; } - return response.json().then(json => { + return response.json().then((json) => { return {error: handler.call(this, response, json)}; }); } diff --git a/shopfloor_mobile/static/wms/src/services/registry.js b/shopfloor_mobile/static/wms/src/services/registry.js index bdf980c9b2..1803dda23d 100644 --- a/shopfloor_mobile/static/wms/src/services/registry.js +++ b/shopfloor_mobile/static/wms/src/services/registry.js @@ -93,7 +93,7 @@ export class ProcessRegistry { * Keys can be Lodash-like paths to the destination keys to override. */ _override(orig_obj, overrides) { - _.forEach(overrides, function(value, path) { + _.forEach(overrides, function (value, path) { _.set(orig_obj, path, value); }); } diff --git a/shopfloor_mobile/static/wms/src/settings/language.js b/shopfloor_mobile/static/wms/src/settings/language.js index 54049bf606..d906eeb5fe 100644 --- a/shopfloor_mobile/static/wms/src/settings/language.js +++ b/shopfloor_mobile/static/wms/src/settings/language.js @@ -23,7 +23,7 @@ export var Language = Vue.component("language", { `, methods: { - on_select: function(selected) { + on_select: function (selected) { const self = this; this.$i18n.locale = selected.id; // this.$root.trigger("language:selected", selected, true); diff --git a/shopfloor_mobile/static/wms/src/settings/profile.js b/shopfloor_mobile/static/wms/src/settings/profile.js index d1c3198ae3..2724261170 100644 --- a/shopfloor_mobile/static/wms/src/settings/profile.js +++ b/shopfloor_mobile/static/wms/src/settings/profile.js @@ -5,7 +5,7 @@ */ export var Profile = Vue.component("profile", { - data: function() { + data: function () { return { current_profile_id: this.$root.has_profile ? this.$root.profile.id : null, profile_selected: false, @@ -51,13 +51,13 @@ export var Profile = Vue.component("profile", { `, methods: { - on_select: function(selected) { + on_select: function (selected) { if (!_.isEmpty(selected)) { this.$root.trigger("profile:selected", selected, true); this.$root.$router.push({name: "home"}); } }, - logout: function() { + logout: function () { this.$root.logout(); }, }, diff --git a/shopfloor_mobile/static/wms/src/settings/settings.js b/shopfloor_mobile/static/wms/src/settings/settings.js index bb5a1cf957..67f80dfb3d 100644 --- a/shopfloor_mobile/static/wms/src/settings/settings.js +++ b/shopfloor_mobile/static/wms/src/settings/settings.js @@ -5,7 +5,7 @@ */ export var SettingsControlPanel = Vue.component("settings-control-panel", { - data: function() { + data: function () { return {}; }, template: ` diff --git a/shopfloor_mobile/static/wms/src/utils.js b/shopfloor_mobile/static/wms/src/utils.js index 68cdd369e1..444ecd400c 100644 --- a/shopfloor_mobile/static/wms/src/utils.js +++ b/shopfloor_mobile/static/wms/src/utils.js @@ -14,22 +14,22 @@ export class Utils { group_key: "location_src", group_no_title: false, name_prefix: "Location", - prepare_records: function(recs) { + prepare_records: function (recs) { return recs; }, - group_color_maker: function(recs) { + group_color_maker: function (recs) { return ""; }, }); const res = []; const locations = _.uniqBy( - _.map(lines, function(x) { + _.map(lines, function (x) { return x[options.group_key]; }), "id" ); const grouped = _.groupBy(lines, options.group_key + ".id"); - _.forEach(grouped, function(value, loc_id) { + _.forEach(grouped, function (value, loc_id) { const location = _.first(_.filter(locations, {id: parseInt(loc_id)})); const title = options.group_no_title ? "" @@ -51,26 +51,26 @@ export class Utils { let self = this; // {key: 'no-group', location_src: {}, location_dest: {} records: []} options = _.defaults(options || {}, { - prepare_records: function(recs) { + prepare_records: function (recs) { return recs; }, }); const res = []; const locations = _.uniqBy( _.concat( - _.map(lines, function(x) { + _.map(lines, function (x) { return x.location_src; }), - _.map(lines, function(x) { + _.map(lines, function (x) { return x.location_dest; }) ), "id" ); const grouped = _.chain(lines) - .groupBy(item => `${item.location_src.id}--${item.location_dest.id}`) + .groupBy((item) => `${item.location_src.id}--${item.location_dest.id}`) .value(); - _.forEach(grouped, function(value, loc_ids) { + _.forEach(grouped, function (value, loc_ids) { const [src_id, dest_id] = loc_ids.split("--"); const src_loc = _.first(_.filter(locations, {id: parseInt(src_id)})); const dest_loc = _.first(_.filter(locations, {id: parseInt(dest_id)})); @@ -89,12 +89,12 @@ export class Utils { let self = this; const res = []; const packs = _.uniqBy( - _.map(lines, function(x) { + _.map(lines, function (x) { return _.result(x, package_key); }), "id" ); - const grouped = _.groupBy(lines, function(l) { + const grouped = _.groupBy(lines, function (l) { const pack_id = _.result(l, package_key + ".id"); if (pack_id) { return "pack-" + pack_id; @@ -102,7 +102,7 @@ export class Utils { return "raw-" + l.id + l.product.id; }); let counter = 0; - _.forEach(grouped, function(products, key) { + _.forEach(grouped, function (products, key) { counter++; let pack = null; if (key.startsWith("pack")) { @@ -126,7 +126,7 @@ export class Utils { group_by_package_type(lines) { const res = []; const grouped = _.groupBy(lines, "package_dest.packaging.name"); - _.forEach(grouped, function(products, packaging_name) { + _.forEach(grouped, function (products, packaging_name) { res.push({ _is_group: true, // groupBy gives undefined as string @@ -141,7 +141,7 @@ export class Utils { only_one_package(lines) { let res = []; let pkg_seen = []; - lines.forEach(function(line) { + lines.forEach(function (line) { if (line.package_dest) { if (!pkg_seen.includes(line.package_dest.id)) { // got a pack @@ -157,7 +157,7 @@ export class Utils { } completed_move_lines(move_lines) { - return _.filter(move_lines, function(l) { + return _.filter(move_lines, function (l) { return l.qty_done > 0; }).length; } @@ -175,7 +175,7 @@ export class Utils { order_picking_by_completeness(pickings) { const self = this; - const ordered = _.sortBy(pickings, function(rec) { + const ordered = _.sortBy(pickings, function (rec) { return self.picking_completeness(rec); }); return _.reverse(ordered); @@ -239,7 +239,7 @@ export class Utils { path: "quantity", label: "Qty", render_component: "packaging-qty-picker-display", - render_options: function(record) { + render_options: function (record) { return self.move_line_qty_picker_options(record); }, }, @@ -255,7 +255,7 @@ export class Utils { options.fields = options.fields_extend_default ? default_fields.concat(options.fields || []) : options.fields || []; - options.fields = _.filter(options.fields, function(field) { + options.fields = _.filter(options.fields, function (field) { return !options.fields_blacklist.includes(field.path); }); return options; diff --git a/shopfloor_mobile_custom_example/static/wms/src/scenario/checkout.js b/shopfloor_mobile_custom_example/static/wms/src/scenario/checkout.js index 28b90450ff..26fc141ee4 100644 --- a/shopfloor_mobile_custom_example/static/wms/src/scenario/checkout.js +++ b/shopfloor_mobile_custom_example/static/wms/src/scenario/checkout.js @@ -10,7 +10,7 @@ import {process_registry} from "/shopfloor_mobile/assets/src/services/process_re // Clone the original component const DemoCheckout = process_registry.extend("checkout", { // `extend` accepts a path to the final key - "methods.screen_title": function() { + "methods.screen_title": function () { return this.$t("shopfloor_demo.checkout.title"); }, }); diff --git a/stock_available_to_promise_release/models/res_config_settings.py b/stock_available_to_promise_release/models/res_config_settings.py index 1ad4cbc238..bcb63505c0 100644 --- a/stock_available_to_promise_release/models/res_config_settings.py +++ b/stock_available_to_promise_release/models/res_config_settings.py @@ -9,8 +9,10 @@ class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" stock_reservation_horizon = fields.Integer( - related="company_id.stock_reservation_horizon", readonly=False, + related="company_id.stock_reservation_horizon", + readonly=False, ) stock_release_max_prep_time = fields.Integer( - related="company_id.stock_release_max_prep_time", readonly=False, + related="company_id.stock_release_max_prep_time", + readonly=False, ) diff --git a/stock_available_to_promise_release/models/stock_move.py b/stock_available_to_promise_release/models/stock_move.py index 0a2c8da213..6c4ef5399d 100644 --- a/stock_available_to_promise_release/models/stock_move.py +++ b/stock_available_to_promise_release/models/stock_move.py @@ -45,7 +45,8 @@ class StockMove(models.Model): " to moves with higher priority (in initial demand's UoM).", ) release_ready = fields.Boolean( - compute="_compute_release_ready", search="_search_release_ready", + compute="_compute_release_ready", + search="_search_release_ready", ) need_release = fields.Boolean(index=True, copy=False) zip_code = fields.Char(related="partner_id.zip", store=True) @@ -216,14 +217,18 @@ def _compute_ordered_available_to_promise(self): real_promised = available_qty - previous_promised_qty uom_promised = product_uom._compute_quantity( - real_promised, move.product_uom, rounding_method="HALF-UP", + real_promised, + move.product_uom, + rounding_method="HALF-UP", ) move.ordered_available_to_promise_uom_qty = max( - min(uom_promised, move.product_uom_qty), 0.0, + min(uom_promised, move.product_uom_qty), + 0.0, ) move.ordered_available_to_promise_qty = max( - min(real_promised, move.product_qty), 0.0, + min(real_promised, move.product_qty), + 0.0, ) def _search_ordered_available_to_promise_uom_qty(self, operator, value): diff --git a/stock_available_to_promise_release/tests/test_reservation.py b/stock_available_to_promise_release/tests/test_reservation.py index a4c7d2b5ce..147a193d6d 100644 --- a/stock_available_to_promise_release/tests/test_reservation.py +++ b/stock_available_to_promise_release/tests/test_reservation.py @@ -781,7 +781,10 @@ def test_count_fields(self): (self.product4, 10), ], ) - picking2 = self._create_picking_chain(self.wh, [(self.product1, 20)],) + picking2 = self._create_picking_chain( + self.wh, + [(self.product1, 20)], + ) self.assertEqual(self.product1.move_need_release_count, 2) self.assertEqual(self.product2.move_need_release_count, 1) self.assertEqual(picking1.need_release_count, 4) @@ -793,9 +796,13 @@ def test_search_picking(self): not_need_release = self._create_picking_chain(self.wh, [(self.product1, 20)]) self.wh.delivery_route_id.write({"available_to_promise_defer_pull": True}) picking1 = self._create_picking_chain( - self.wh, [(self.product1, 20), (self.product2, 10)], + self.wh, + [(self.product1, 20), (self.product2, 10)], + ) + picking2 = self._create_picking_chain( + self.wh, + [(self.product3, 20)], ) - picking2 = self._create_picking_chain(self.wh, [(self.product3, 20)],) self._update_qty_in_location(self.loc_bin1, self.product3, 20.0) pickings = self.env["stock.picking"].search( @@ -841,7 +848,8 @@ def test_picking_type_count(self): ], ) picking1 = self._create_picking_chain( - self.wh, [(self.product1, 20), (self.product2, 10)], + self.wh, + [(self.product1, 20), (self.product2, 10)], ) picking2 = self._create_picking_chain(self.wh, [(self.product3, 20)]) diff --git a/stock_available_to_promise_release_dynamic_routing/tests/test_release_dynamic_routing.py b/stock_available_to_promise_release_dynamic_routing/tests/test_release_dynamic_routing.py index ae52890aa8..cdb6fb69c2 100644 --- a/stock_available_to_promise_release_dynamic_routing/tests/test_release_dynamic_routing.py +++ b/stock_available_to_promise_release_dynamic_routing/tests/test_release_dynamic_routing.py @@ -64,7 +64,8 @@ def test_dynamic_routing_pull_printed(self): self._update_qty_in_location(self.location_hb_1, self.product2, 10.0) pickings = self._create_picking_chain( - self.wh, [(self.product1, 20), (self.product2, 10)], + self.wh, + [(self.product1, 20), (self.product2, 10)], ) self.assertEqual(len(pickings), 1, "expect only the last out->customer") cust_picking = pickings @@ -134,7 +135,8 @@ def test_dynamic_routing_change_picking_type_printed(self): self._update_qty_in_location(self.loc_bin1, self.product2, 10.0) pickings = self._create_picking_chain( - self.wh, [(self.product1, 20), (self.product2, 10)], + self.wh, + [(self.product1, 20), (self.product2, 10)], ) self.assertEqual(len(pickings), 1, "expect only the last out->customer") cust_picking = pickings @@ -173,7 +175,11 @@ def test_dynamic_routing_change_picking_type_out_printed(self): "location_id": pick_type_routing.default_location_src_id.id, "picking_type_id": self.wh.pick_type_id.id, "rule_ids": [ - (0, 0, {"method": "pull", "picking_type_id": pick_type_routing.id},) + ( + 0, + 0, + {"method": "pull", "picking_type_id": pick_type_routing.id}, + ) ], } ) @@ -194,7 +200,8 @@ def test_dynamic_routing_change_picking_type_out_printed(self): self._update_qty_in_location(self.loc_bin1, self.product2, 10.0) pickings = self._create_picking_chain( - self.wh, [(self.product1, 20), (self.product2, 10)], + self.wh, + [(self.product1, 20), (self.product2, 10)], ) self.assertEqual(len(pickings), 1, "expect only the last out->customer") cust_picking = pickings diff --git a/stock_dynamic_routing/models/stock_routing.py b/stock_dynamic_routing/models/stock_routing.py index 9bb0808c4a..b5c9a190df 100644 --- a/stock_dynamic_routing/models/stock_routing.py +++ b/stock_dynamic_routing/models/stock_routing.py @@ -23,7 +23,10 @@ class StockRouting(models.Model): _rec_name = "location_id" location_id = fields.Many2one( - comodel_name="stock.location", required=True, ondelete="cascade", index=True, + comodel_name="stock.location", + required=True, + ondelete="cascade", + index=True, ) picking_type_id = fields.Many2one( comodel_name="stock.picking.type", diff --git a/stock_dynamic_routing/models/stock_routing_rule.py b/stock_dynamic_routing/models/stock_routing_rule.py index 3d2f141df1..95ab26f7f2 100644 --- a/stock_dynamic_routing/models/stock_routing_rule.py +++ b/stock_dynamic_routing/models/stock_routing_rule.py @@ -39,10 +39,12 @@ class StockRoutingRule(models.Model): help="Operation type that will be applied on the move.", ) location_src_id = fields.Many2one( - comodel_name="stock.location", compute="_compute_location_src_id", + comodel_name="stock.location", + compute="_compute_location_src_id", ) location_dest_id = fields.Many2one( - comodel_name="stock.location", compute="_compute_location_dest_id", + comodel_name="stock.location", + compute="_compute_location_dest_id", ) rule_domain = fields.Char( string="Source Routing Domain", diff --git a/stock_reception_screen/models/stock_move.py b/stock_reception_screen/models/stock_move.py index 4e97b6e864..76434d9e59 100644 --- a/stock_reception_screen/models/stock_move.py +++ b/stock_reception_screen/models/stock_move.py @@ -10,11 +10,13 @@ class StockMove(models.Model): reception_screen_current_step = fields.Char( related="picking_id.reception_screen_id.current_step" ) - last_move_line_lot_id = fields.Many2one(comodel_name="stock.production.lot",) + last_move_line_lot_id = fields.Many2one( + comodel_name="stock.production.lot", + ) vendor_code = fields.Char(compute="_compute_vendor_code") def action_select_product(self): - """"Same than `action_select_move` excepting that as we we are in the + """ "Same than `action_select_move` excepting that as we we are in the 'select_product' step and that the user already selected the right move through this button, we automatically go to the next step (done by `process_select_product`). diff --git a/stock_reception_screen/models/stock_reception_screen.py b/stock_reception_screen/models/stock_reception_screen.py index c66e071481..19005df018 100644 --- a/stock_reception_screen/models/stock_reception_screen.py +++ b/stock_reception_screen/models/stock_reception_screen.py @@ -159,9 +159,12 @@ class StockReceptionScreen(models.Model): # NOTE: Mainly not related as we want to store these data on the current # package when the "select_packaging" step is confirmed by the user product_packaging_id = fields.Many2one( - "product.packaging", domain="[('product_id', '=', current_move_product_id)]", + "product.packaging", + domain="[('product_id', '=', current_move_product_id)]", + ) + package_storage_type_id = fields.Many2one( + "stock.package.storage.type", ) - package_storage_type_id = fields.Many2one("stock.package.storage.type",) package_storage_type_height_required = fields.Boolean( related="package_storage_type_id.height_required" ) diff --git a/stock_reception_screen/static/src/js/autofocus.js b/stock_reception_screen/static/src/js/autofocus.js index 658734c971..93618031f3 100644 --- a/stock_reception_screen/static/src/js/autofocus.js +++ b/stock_reception_screen/static/src/js/autofocus.js @@ -1,4 +1,4 @@ -odoo.define("stock_reception_screen.autofocus", function(require) { +odoo.define("stock_reception_screen.autofocus", function (require) { "use strict"; var FormRenderer = require("web.FormRenderer"); @@ -7,7 +7,7 @@ odoo.define("stock_reception_screen.autofocus", function(require) { // compute field FormRenderer.include({ - _custom_autofocus: function() { + _custom_autofocus: function () { if (this.mode === "readonly") { return; } @@ -41,7 +41,7 @@ odoo.define("stock_reception_screen.autofocus", function(require) { } } }, - _updateView: function() { + _updateView: function () { this._super.apply(this, arguments); this._custom_autofocus(); }, diff --git a/stock_storage_type/models/stock_location.py b/stock_storage_type/models/stock_location.py index fdd3d48cdc..f87bf21874 100644 --- a/stock_storage_type/models/stock_location.py +++ b/stock_storage_type/models/stock_location.py @@ -149,7 +149,9 @@ def _compute_location_will_contain_lot_ids(self): ) | rec.mapped("in_move_line_ids.lot_id") @api.depends( - "quant_ids.quantity", "in_move_ids", "in_move_line_ids", + "quant_ids.quantity", + "in_move_ids", + "in_move_line_ids", ) def _compute_location_is_empty(self): for rec in self: @@ -342,8 +344,10 @@ def select_allowed_locations( ), ] ) - pertinent_loc_s_t_domain = compatible_locations._domain_location_storage_type_constraints( # noqa - package_storage_type, quants, products + pertinent_loc_s_t_domain = ( + compatible_locations._domain_location_storage_type_constraints( # noqa + package_storage_type, quants, products + ) ) pertinent_loc_storage_types = LocStorageType.search(pertinent_loc_s_t_domain) diff --git a/stock_storage_type/models/stock_storage_location_sequence.py b/stock_storage_type/models/stock_storage_location_sequence.py index c316ef2358..02a09d0dc0 100644 --- a/stock_storage_type/models/stock_storage_location_sequence.py +++ b/stock_storage_type/models/stock_storage_location_sequence.py @@ -13,7 +13,10 @@ class StockStorageLocationSequence(models.Model): "stock.package.storage.type", required=True ) sequence = fields.Integer(required=True) - location_id = fields.Many2one("stock.location", required=True,) + location_id = fields.Many2one( + "stock.location", + required=True, + ) location_putaway_strategy = fields.Selection( related="location_id.pack_putaway_strategy" ) @@ -36,7 +39,8 @@ def _format_package_storage_type_message(self, last=False): pack_storage_strat = strat[1] break msg = ' * {} ({})'.format( - self.location_id.name, pack_storage_strat, + self.location_id.name, + pack_storage_strat, ) if last: # If last, we want to check if restrictions are defined on diff --git a/stock_storage_type_putaway_abc/models/stock_location.py b/stock_storage_type_putaway_abc/models/stock_location.py index fd906f27fb..f746cafb94 100644 --- a/stock_storage_type_putaway_abc/models/stock_location.py +++ b/stock_storage_type_putaway_abc/models/stock_location.py @@ -61,7 +61,9 @@ def _sort_abc_locations(self, product_abc): product_abc = product_abc or "a" # group locations by abc_storage and max_height data = self.read_group( - [("id", "in", self.ids)], ["max_height"], ["max_height"], + [("id", "in", self.ids)], + ["max_height"], + ["max_height"], ) locations_grouped = {} max_heights = set()