diff --git a/shopfloor_mobile/static/wms/src/components/batch_picking_detail.js b/shopfloor_mobile/static/wms/src/components/batch_picking_detail.esm.js similarity index 98% rename from shopfloor_mobile/static/wms/src/components/batch_picking_detail.js rename to shopfloor_mobile/static/wms/src/components/batch_picking_detail.esm.js index de9240389e8..bbd16083802 100644 --- a/shopfloor_mobile/static/wms/src/components/batch_picking_detail.js +++ b/shopfloor_mobile/static/wms/src/components/batch_picking_detail.esm.js @@ -4,7 +4,6 @@ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ -/* eslint-disable strict */ Vue.component("batch-picking-detail", { props: ["record"], methods: { diff --git a/shopfloor_mobile/static/wms/src/components/batch_picking_line_detail.js b/shopfloor_mobile/static/wms/src/components/batch_picking_line_detail.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/components/batch_picking_line_detail.js rename to shopfloor_mobile/static/wms/src/components/batch_picking_line_detail.esm.js diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_location.js b/shopfloor_mobile/static/wms/src/components/detail/detail_location.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/components/detail/detail_location.js rename to shopfloor_mobile/static/wms/src/components/detail/detail_location.esm.js diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_lot.js b/shopfloor_mobile/static/wms/src/components/detail/detail_lot.esm.js similarity index 98% rename from shopfloor_mobile/static/wms/src/components/detail/detail_lot.js rename to shopfloor_mobile/static/wms/src/components/detail/detail_lot.esm.js index 9c45b6ab81a..f34f8addcb4 100644 --- a/shopfloor_mobile/static/wms/src/components/detail/detail_lot.js +++ b/shopfloor_mobile/static/wms/src/components/detail/detail_lot.esm.js @@ -44,6 +44,7 @@ Vue.component("detail-lot", { {path: "product_name", label: "Name"}, ]; }, + /* eslint-disable no-unused-vars */ render_packaging(record, field) { return [record.name, "(" + record.code + ")", "= " + record.qty].join(" "); }, diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_operation.js b/shopfloor_mobile/static/wms/src/components/detail/detail_operation.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/components/detail/detail_operation.js rename to shopfloor_mobile/static/wms/src/components/detail/detail_operation.esm.js diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_package.js b/shopfloor_mobile/static/wms/src/components/detail/detail_package.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/components/detail/detail_package.js rename to shopfloor_mobile/static/wms/src/components/detail/detail_package.esm.js diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_picking.js b/shopfloor_mobile/static/wms/src/components/detail/detail_picking.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/components/detail/detail_picking.js rename to shopfloor_mobile/static/wms/src/components/detail/detail_picking.esm.js diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_product.js b/shopfloor_mobile/static/wms/src/components/detail/detail_product.esm.js similarity index 99% rename from shopfloor_mobile/static/wms/src/components/detail/detail_product.js rename to shopfloor_mobile/static/wms/src/components/detail/detail_product.esm.js index fc3d1db0ca1..c4092cd47b1 100644 --- a/shopfloor_mobile/static/wms/src/components/detail/detail_product.js +++ b/shopfloor_mobile/static/wms/src/components/detail/detail_product.esm.js @@ -36,6 +36,7 @@ Vue.component("detail-product", { {path: "product_name", label: "Name"}, ]; }, + /* eslint-disable no-unused-vars */ render_packaging(record, field) { return [record.name, "(" + record.code + ")", "= " + record.qty].join(" "); }, diff --git a/shopfloor_mobile/static/wms/src/components/detail/detail_transfer.js b/shopfloor_mobile/static/wms/src/components/detail/detail_transfer.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/components/detail/detail_transfer.js rename to shopfloor_mobile/static/wms/src/components/detail/detail_transfer.esm.js 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.esm.js similarity index 97% rename from shopfloor_mobile/static/wms/src/components/forms/form_edit_stock_picking.js rename to shopfloor_mobile/static/wms/src/components/forms/form_edit_stock_picking.esm.js index fa251958299..cddee46e238 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.esm.js @@ -4,7 +4,6 @@ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ -/* eslint-disable strict */ Vue.component("form-edit-stock-picking", { props: ["record", "form"], data: function () { diff --git a/shopfloor_mobile/static/wms/src/components/manual_select_color.js b/shopfloor_mobile/static/wms/src/components/manual_select_color.esm.js similarity index 97% rename from shopfloor_mobile/static/wms/src/components/manual_select_color.js rename to shopfloor_mobile/static/wms/src/components/manual_select_color.esm.js index 3ed682f4c75..c275c4c31c8 100644 --- a/shopfloor_mobile/static/wms/src/components/manual_select_color.js +++ b/shopfloor_mobile/static/wms/src/components/manual_select_color.esm.js @@ -8,7 +8,7 @@ const Base = Vue.options.components["manual-select"]; const Custom = Base.extend({ methods: { selected_color_klass(rec, modifier) { - let color; + let color = ""; if (rec && rec.qty_done && rec.quantity) { if (rec.qty_done < rec.quantity) color = this.utils.colors.color_for("item_selected_partial"); diff --git a/shopfloor_mobile/static/wms/src/components/misc.js b/shopfloor_mobile/static/wms/src/components/misc.esm.js similarity index 99% rename from shopfloor_mobile/static/wms/src/components/misc.js rename to shopfloor_mobile/static/wms/src/components/misc.esm.js index ca53b36a8e1..b5093e3b6ae 100644 --- a/shopfloor_mobile/static/wms/src/components/misc.js +++ b/shopfloor_mobile/static/wms/src/components/misc.esm.js @@ -4,8 +4,6 @@ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ -/* eslint-disable strict */ - import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js"; // TODO: could be merged w/ userConfirmation diff --git a/shopfloor_mobile/static/wms/src/components/packaging-qty-picker.js b/shopfloor_mobile/static/wms/src/components/packaging-qty-picker.esm.js similarity index 92% rename from shopfloor_mobile/static/wms/src/components/packaging-qty-picker.js rename to shopfloor_mobile/static/wms/src/components/packaging-qty-picker.esm.js index 6976c8918d9..b34dbc5d74f 100644 --- a/shopfloor_mobile/static/wms/src/components/packaging-qty-picker.js +++ b/shopfloor_mobile/static/wms/src/components/packaging-qty-picker.esm.js @@ -8,12 +8,14 @@ export var PackagingQtyPickerMixin = { props: { - options: Object, // options are replaced by props + // Options are replaced by props + options: Object, mode: String, qtyInit: Number, uom: {type: Object, required: true}, availablePackaging: Array, - pkgNameKey: String, // "code" or "name" + // "code" or "name" + pkgNameKey: String, }, data: function () { return { @@ -56,8 +58,8 @@ export var PackagingQtyPickerMixin = { 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); - return _.find(this.sorted_packaging, ["id", id]); + const _id = id.startsWith("uom-") ? id : parseInt(id, 10); + return _.find(this.sorted_packaging, ["id", _id]); }, /** * @@ -89,10 +91,9 @@ export var PackagingQtyPickerMixin = { const res = {}; // Const min_unit = _.last(pkg_by_qty); pkg_by_qty.forEach(function (pkg) { - let qty_per_pkg = 0; - [qty_per_pkg, qty] = self._qty_by_pkg(pkg.qty, qty); - res[pkg.id] = qty_per_pkg; - if (!qty) return; + const [_qty_per_pkg, _qty] = self._qty_by_pkg(pkg.qty, qty); + res[pkg.id] = _qty_per_pkg; + if (!_qty) return; }); return res; }, @@ -140,7 +141,7 @@ export var PackagingQtyPickerMixin = { * Include the uom */ sorted_packaging: function () { - let packagings = _.reverse( + const packagings = _.reverse( _.sortBy( _.filter(this.availablePackaging, _.property("qty")), _.property("qty") @@ -158,10 +159,10 @@ export var PackagingQtyPickerMixin = { */ contained_packaging: function () { const self = this; - let res = {}, - qty_per_pkg, - remaining, - elected_next_pkg; + const res = {}; + let qty_per_pkg = [], + remaining = 0, + elected_next_pkg = {}; const packaging = this.sorted_packaging; _.forEach(packaging, function (pkg, i) { const next_pkgs = packaging.slice(i + 1); @@ -192,14 +193,15 @@ export var PackagingQtyPicker = Vue.component("packaging-qty-picker", { }, data: function () { return { - panel: 0, // expand panel by default + // Expand panel by default + panel: 0, }; }, watch: { qty_by_pkg: { deep: true, handler: function () { - // prevent watched qty to update again qty_by_pkg + // Prevent watched qty to update again qty_by_pkg this.qty_by_pkg_manual = true; this.compute_qty(); this.qty_by_pkg_manual = false; @@ -215,7 +217,7 @@ export var PackagingQtyPicker = Vue.component("packaging-qty-picker", { }, computed: { qty_color: function () { - if (this.qty == this.qtyTodo) { + if (this.qty === this.qtyTodo) { if (this.readonly) return ""; return "background-color: rgb(143, 191, 68)"; } @@ -305,10 +307,10 @@ export var PackagingQtyPickerDisplay = Vue.component("packaging-qty-picker-displ }, computed: { visible_packaging: function () { - let packagings = _.filter(this.sorted_packaging, this.display_pkg); + const packagings = _.filter(this.sorted_packaging, this.display_pkg); // Do not display if only uom packaging if ( - packagings.length == 1 && + packagings.length === 1 && packagings[0].id.toString().startsWith("uom-") ) return []; 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.esm.js similarity index 96% rename from shopfloor_mobile/static/wms/src/components/scenario_picking_detail/mixins.js rename to shopfloor_mobile/static/wms/src/components/scenario_picking_detail/mixins.esm.js index c13283b592c..c8e47fd570c 100644 --- a/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/mixins.js +++ b/shopfloor_mobile/static/wms/src/components/scenario_picking_detail/mixins.esm.js @@ -3,9 +3,8 @@ * @author Simone Orsi * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ -/* eslint-disable strict */ -/* eslint-disable no-implicit-globals */ -import {PickingDetailMixin} from "../detail/detail_picking.js"; + +import {PickingDetailMixin} from "../detail/detail_picking.esm.js"; // Maybe worth to move it to its own file export var ListActionsConsumerMixin = { 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.esm.js similarity index 93% rename from shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_select.js rename to shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_select.esm.js index 3b42a9b0fec..cc3167a7517 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.esm.js @@ -3,10 +3,9 @@ * @author Simone Orsi * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ -/* eslint-disable strict */ -/* eslint-disable no-implicit-globals */ -import {PickingDetailSelectMixin} from "./mixins.js"; + import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js"; +import {PickingDetailSelectMixin} from "./mixins.esm.js"; Vue.component("detail-picking-select", { mixins: [PickingDetailSelectMixin], @@ -16,12 +15,15 @@ Vue.component("detail-picking-select", { return { action_qty_edit: { comp_name: "edit-action", + /* eslint-disable no-unused-vars */ get_record: function (rec, action) { return rec; }, + /* eslint-disable no-unused-vars */ get_options: function (rec, action) { return {click_event: "qty_edit"}; }, + /* eslint-disable no-unused-vars */ enabled: function (rec, action) { return true; }, @@ -43,7 +45,7 @@ Vue.component("picking-select-line-content", { // Display detail fields on demand if the package contains only 1 line if ( this.options.show_oneline_package_content && - record.package_dest.move_line_count == 1 + record.package_dest.move_line_count === 1 ) { fields = [ {path: "product.display_name", label: "Product"}, @@ -69,6 +71,7 @@ Vue.component("picking-select-line-content", { opts.loud_title = true; return opts; }, + /* eslint-disable no-unused-vars */ get_wrapper_klass(record) { return ""; }, 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.esm.js similarity index 94% rename from shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_summary.js rename to shopfloor_mobile/static/wms/src/components/scenario_picking_detail/picking_summary.esm.js index 3e95d14586d..18b504cfe4f 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.esm.js @@ -4,9 +4,8 @@ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ -/* eslint-disable strict */ -/* eslint-disable no-implicit-globals */ -import {PickingDetailListMixin} from "./mixins.js"; +/* eslint-disable sort-imports */ +import {PickingDetailListMixin} from "./mixins.esm.js"; import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js"; Vue.component("picking-summary", { @@ -38,6 +37,7 @@ Vue.component("picking-summary", { return { action_change_pkg: { comp_name: "edit-action", + /* eslint-disable no-unused-vars */ get_record: function (rec, action) { /** * Here we can get records grouped. @@ -54,9 +54,11 @@ Vue.component("picking-summary", { } return rec; }, + /* eslint-disable no-unused-vars */ get_options: function (rec, action) { return {click_event: "pkg_change_type"}; }, + /* eslint-disable no-unused-vars */ enabled: function (rec, action) { // Exclude for non-packaged records. // NOTE: `pack` is available only if records are grouped. @@ -66,11 +68,13 @@ Vue.component("picking-summary", { }, action_cancel_line: { comp_name: "cancel-move-line-action", + /* eslint-disable no-unused-vars */ get_options: function (rec, action) { return { package_cancel_key: self.$props.action_cancel_package_key, }; }, + /* eslint-disable no-unused-vars */ get_record: function (rec, action) { if (rec.records) { // Lines grouped, get real line @@ -78,6 +82,7 @@ Vue.component("picking-summary", { } return rec; }, + /* eslint-disable no-unused-vars */ enabled: function (rec, action) { return true; }, @@ -102,9 +107,10 @@ Vue.component("picking-summary-content", { }, watch: { panel: { + /* eslint-disable no-unused-vars */ handler: function (newVal, oldVal) { // The panel is opened - $(this.$parent.$el).toggleClass("inner-panel-expanded", newVal == 0); + $(this.$parent.$el).toggleClass("inner-panel-expanded", newVal === 0); }, }, }, diff --git a/shopfloor_mobile/static/wms/src/demo/demo.checkout.js b/shopfloor_mobile/static/wms/src/demo/demo.checkout.esm.js similarity index 97% rename from shopfloor_mobile/static/wms/src/demo/demo.checkout.js rename to shopfloor_mobile/static/wms/src/demo/demo.checkout.esm.js index 18f2adf0d36..ef5fcb488f8 100644 --- a/shopfloor_mobile/static/wms/src/demo/demo.checkout.js +++ b/shopfloor_mobile/static/wms/src/demo/demo.checkout.esm.js @@ -72,7 +72,7 @@ const DEMO_CHECKOUT = { scan_package_action: function (data) { const res = data_for_select_package; const line = res.data.select_package.selected_move_lines.find(function (x) { - return x.product.barcode == data.barcode; + return x.product.barcode === data.barcode; }); line.qty_done++; return res; @@ -102,7 +102,7 @@ const DEMO_CHECKOUT = { set_line_qty: function (data) { const res = data_for_set_line_qty; const line = res.data.select_package.selected_move_lines.filter(function (x) { - return x.id == data.move_line_id; + return x.id === data.move_line_id; })[0]; line.qty_done = line.quantity; return res; @@ -110,7 +110,7 @@ const DEMO_CHECKOUT = { reset_line_qty: function (data) { const res = data_for_set_line_qty; const line = res.data.select_package.selected_move_lines.filter(function (x) { - return x.id == data.move_line_id; + return x.id === data.move_line_id; })[0]; line.qty_done = 0; return res; diff --git a/shopfloor_mobile/static/wms/src/demo/demo.cluster_picking.js b/shopfloor_mobile/static/wms/src/demo/demo.cluster_picking.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/demo/demo.cluster_picking.js rename to shopfloor_mobile/static/wms/src/demo/demo.cluster_picking.esm.js diff --git a/shopfloor_mobile/static/wms/src/demo/demo.delivery.js b/shopfloor_mobile/static/wms/src/demo/demo.delivery.esm.js similarity index 93% rename from shopfloor_mobile/static/wms/src/demo/demo.delivery.js rename to shopfloor_mobile/static/wms/src/demo/demo.delivery.esm.js index 625207189ce..48121f6c50b 100644 --- a/shopfloor_mobile/static/wms/src/demo/demo.delivery.js +++ b/shopfloor_mobile/static/wms/src/demo/demo.delivery.esm.js @@ -14,9 +14,9 @@ for (let i = 1; i < count + 1; i++) { {}, {lines_count: demotools.getRandomInt(5), line_random_pack: true} ); - for (let i = 0; i < demotools.getRandomInt(move_lines.length); i++) { + for (let j = 0; j < demotools.getRandomInt(move_lines.length); j++) { // Set some as done - move_lines[i].qty_done = move_lines[i].quantity; + move_lines[j].qty_done = move_lines[j].quantity; } pickings.push( demotools.makePicking( diff --git a/shopfloor_mobile/static/wms/src/demo/demo.location_content_transfer.js b/shopfloor_mobile/static/wms/src/demo/demo.location_content_transfer.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/demo/demo.location_content_transfer.js rename to shopfloor_mobile/static/wms/src/demo/demo.location_content_transfer.esm.js diff --git a/shopfloor_mobile/static/wms/src/demo/demo.scan_anything.js b/shopfloor_mobile/static/wms/src/demo/demo.scan_anything.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/demo/demo.scan_anything.js rename to shopfloor_mobile/static/wms/src/demo/demo.scan_anything.esm.js diff --git a/shopfloor_mobile/static/wms/src/demo/demo.single_pack_transfer.js b/shopfloor_mobile/static/wms/src/demo/demo.single_pack_transfer.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/demo/demo.single_pack_transfer.js rename to shopfloor_mobile/static/wms/src/demo/demo.single_pack_transfer.esm.js diff --git a/shopfloor_mobile/static/wms/src/demo/demo.zone_picking.js b/shopfloor_mobile/static/wms/src/demo/demo.zone_picking.esm.js similarity index 98% rename from shopfloor_mobile/static/wms/src/demo/demo.zone_picking.js rename to shopfloor_mobile/static/wms/src/demo/demo.zone_picking.esm.js index 62b92b2b7d5..c87c034e17e 100644 --- a/shopfloor_mobile/static/wms/src/demo/demo.zone_picking.js +++ b/shopfloor_mobile/static/wms/src/demo/demo.zone_picking.esm.js @@ -64,7 +64,7 @@ const move_lines = demotools.makePickingLines( const select_line_move_lines = _.orderBy(move_lines, ["priority"], ["desc"]); _.forEach(select_line_move_lines, function (line, i) { // Simulate random flag - line.location_will_be_empty = i % 3 == 0; + line.location_will_be_empty = i % 3 === 0; // Simulate adding 1 qty line.qty_done++; }); @@ -111,7 +111,7 @@ const DEMO_CASE_1 = { }, list_move_lines: function (data) { const res = _.cloneDeep(list_move_lines); - if (data.order == "location") { + if (data.order === "location") { res.data.select_line.move_lines = _.orderBy( res.data.select_line.move_lines, ["location_src.name"] diff --git a/shopfloor_mobile/static/wms/src/i18n/add_translations_to_registry.js b/shopfloor_mobile/static/wms/src/i18n/add_translations_to_registry.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/i18n/add_translations_to_registry.js rename to shopfloor_mobile/static/wms/src/i18n/add_translations_to_registry.esm.js diff --git a/shopfloor_mobile/static/wms/src/scenario/checkout.js b/shopfloor_mobile/static/wms/src/scenario/checkout.esm.js similarity index 99% rename from shopfloor_mobile/static/wms/src/scenario/checkout.js rename to shopfloor_mobile/static/wms/src/scenario/checkout.esm.js index 44ea4f746a7..40d66f33b4a 100644 --- a/shopfloor_mobile/static/wms/src/scenario/checkout.js +++ b/shopfloor_mobile/static/wms/src/scenario/checkout.esm.js @@ -4,10 +4,11 @@ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ +/* eslint-disable sort-imports */ import {ScenarioBaseMixin} from "/shopfloor_mobile_base/static/wms/src/scenario/mixins.js"; -import {process_registry} from "/shopfloor_mobile_base/static/wms/src/services/process_registry.js"; -import {checkout_states} from "./checkout_states.js"; import event_hub from "/shopfloor_mobile_base/static/wms/src/services/event_hub.js"; +import {process_registry} from "/shopfloor_mobile_base/static/wms/src/services/process_registry.js"; +import {checkout_states} from "./checkout_states.esm.js"; const Checkout = { mixins: [ScenarioBaseMixin], @@ -297,7 +298,7 @@ const Checkout = { path: "priority", render_component: "priority-widget", render_options: function (record) { - const priority = parseInt(record.priority); + const priority = parseInt(record.priority, 10) || 0; // We need to pass the label to the component as an option instead of using "display_no_value" // because pickings with no priority will still have a string value of "0" // and the label would always be displayed. @@ -351,7 +352,7 @@ const Checkout = { select_line_detail_picking_select_props: function () { const picking = this.state.data.picking; const lines = picking.move_lines; - let grouped_lines = undefined; + let grouped_lines = []; if (this.state.data.group_lines_by_location) { grouped_lines = this.select_line_manual_select_group_lines(lines); } diff --git a/shopfloor_mobile/static/wms/src/scenario/checkout_states.js b/shopfloor_mobile/static/wms/src/scenario/checkout_states.esm.js similarity index 99% rename from shopfloor_mobile/static/wms/src/scenario/checkout_states.js rename to shopfloor_mobile/static/wms/src/scenario/checkout_states.esm.js index b79bd44736a..bd2c21243c9 100644 --- a/shopfloor_mobile/static/wms/src/scenario/checkout_states.js +++ b/shopfloor_mobile/static/wms/src/scenario/checkout_states.esm.js @@ -24,6 +24,7 @@ export const checkout_states = function ($instance) { $instance.odoo.call("scan_document", {barcode: scanned.text}) ); }, + // eslint-disable-next-line no-unused-vars on_manual_selection: (evt) => { $instance.wait_call($instance.odoo.call("list_stock_picking")); }, @@ -150,7 +151,8 @@ export const checkout_states = function ($instance) { ); }) ); - let endpoint, move_line; + let endpoint = "", + move_line = {}; if (to_unselect) { endpoint = "reset_line_qty"; move_line = to_unselect; diff --git a/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js b/shopfloor_mobile/static/wms/src/scenario/cluster_picking.esm.js similarity index 98% rename from shopfloor_mobile/static/wms/src/scenario/cluster_picking.js rename to shopfloor_mobile/static/wms/src/scenario/cluster_picking.esm.js index 91ff499d2fb..f66dad97514 100644 --- a/shopfloor_mobile/static/wms/src/scenario/cluster_picking.js +++ b/shopfloor_mobile/static/wms/src/scenario/cluster_picking.esm.js @@ -189,10 +189,10 @@ const ClusterPicking = { scan_destination_qty: 0, states: { start: { - on_get_work: (evt) => { + on_get_work: () => { this.wait_call(this.odoo.call("find_batch")); }, - on_manual_selection: (evt) => { + on_manual_selection: () => { this.wait_call(this.odoo.call("list_batch")); }, }, @@ -375,8 +375,8 @@ const ClusterPicking = { // FIXME: use state_load or traverse the state // this.current_state_key = "unload_all"; // this.state.on_scan(scanned, confirmation); - confirmation = this.state.data.confirmation || ""; - this.states.unload_all.on_scan(scanned, confirmation); + const confirm = this.state.data.confirmation || confirmation; + this.states.unload_all.on_scan(scanned, confirm); }, }, unload_single: { @@ -422,7 +422,8 @@ const ClusterPicking = { this.wait_call( this.odoo.call("unload_scan_destination", { picking_batch_id: this.current_batch().id, - package_id: null, // FIXME: where does it come from? backend data? + // FIXME: where does it come from? backend data? + package_id: null, barcode: scanned.text, confirmation: this.state.data.confirmation || "", }) diff --git a/shopfloor_mobile/static/wms/src/scenario/delivery.js b/shopfloor_mobile/static/wms/src/scenario/delivery.esm.js similarity index 98% rename from shopfloor_mobile/static/wms/src/scenario/delivery.js rename to shopfloor_mobile/static/wms/src/scenario/delivery.esm.js index c9a2f9b5660..b4b7c292151 100644 --- a/shopfloor_mobile/static/wms/src/scenario/delivery.js +++ b/shopfloor_mobile/static/wms/src/scenario/delivery.esm.js @@ -129,12 +129,13 @@ const Delivery = { "package_src" ), group_color_maker: function (lines) { - return self.utils.wms.move_lines_completeness(lines) == 100 + return self.utils.wms.move_lines_completeness(lines) === 100 ? "screen_step_done" : "screen_step_todo"; }, }); }, + /* eslint-disable no-unused-vars */ deliver_move_line_list_options: function (picking) { return { list_item_options: { @@ -174,9 +175,8 @@ const Delivery = { const operation_progress = this._get_operation_progress_data(); if (operation_progress.done === operation_progress.to_do) { return this.utils.colors.color_for("screen_step_done"); - } else { - return this.utils.colors.color_for("screen_step_todo"); } + return this.utils.colors.color_for("screen_step_todo"); }, _get_operation_progress_data: function () { return _.result(this.state, "data.sublocation.operation_progress", false); @@ -202,6 +202,7 @@ const Delivery = { { path: "move_line_count", label: "Lines", + renderer: function (rec, field) { return ( self.utils.wms.completed_move_lines(rec.move_lines) + @@ -236,6 +237,7 @@ const Delivery = { this.odoo.call("scan_deliver", {barcode: scanned.text}) ); }, + on_manual_selection: (evt) => { this.wait_call(this.odoo.call("list_stock_picking")); }, @@ -257,6 +259,7 @@ const Delivery = { }) ); }, + on_manual_selection: (evt) => { this.wait_call( this.odoo.call("list_stock_picking", { @@ -265,7 +268,8 @@ const Delivery = { ); }, on_cancel: (data) => { - let endpoint, endpoint_data; + let endpoint = ""; + let endpoint_data = ""; // TODO: can't we have a single endpoint as per checkout.summary.destroy? if (data.package_id) { endpoint = "reset_qty_done_pack"; diff --git a/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js b/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.esm.js similarity index 97% rename from shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js rename to shopfloor_mobile/static/wms/src/scenario/location_content_transfer.esm.js index c5246af8d0a..6f21fe59cac 100644 --- a/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.js +++ b/shopfloor_mobile/static/wms/src/scenario/location_content_transfer.esm.js @@ -190,10 +190,11 @@ const LocationContentTransfer = { }, // Common actions on_line_action: function (action) { - this["on_" + action.event_name].call(this); + this["on_" + action.event_name](this); }, on_action_postpone: function () { - let endpoint, endpoint_data; + let endpoint = ""; + let endpoint_data = {}; const data = this.state.data; if (data.package_level) { endpoint = "postpone_package"; @@ -235,9 +236,11 @@ const LocationContentTransfer = { }, }, get_work: { + /* eslint-disable no-unused-vars */ on_get_work: (evt) => { this.wait_call(this.odoo.call("find_work")); }, + /* eslint-disable no-unused-vars */ on_manual_selection: (evt) => { this.state_to("scan_location"); }, @@ -292,7 +295,8 @@ const LocationContentTransfer = { ), }, on_scan: (scanned) => { - let endpoint, endpoint_data; + let endpoint = ""; + let endpoint_data = {}; const data = this.state.data; if (data.package_level) { endpoint = "scan_package"; @@ -329,7 +333,8 @@ const LocationContentTransfer = { this.scan_destination_qty = parseInt(qty, 10); }, on_scan: (scanned) => { - let endpoint, endpoint_data; + let endpoint = ""; + let endpoint_data = {}; const data = this.state.data; if (data.package_level) { endpoint = "set_destination_package"; @@ -363,7 +368,8 @@ const LocationContentTransfer = { this.reset_notification(); }, on_confirm_stock_issue: () => { - let endpoint, endpoint_data; + let endpoint = ""; + let endpoint_data = {}; const data = this.state.data; if (data.package_level) { endpoint = "stock_out_package"; diff --git a/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js b/shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.js rename to shopfloor_mobile/static/wms/src/scenario/single_pack_transfer.esm.js diff --git a/shopfloor_mobile/static/wms/src/scenario/zone_picking.js b/shopfloor_mobile/static/wms/src/scenario/zone_picking.esm.js similarity index 97% rename from shopfloor_mobile/static/wms/src/scenario/zone_picking.js rename to shopfloor_mobile/static/wms/src/scenario/zone_picking.esm.js index 91f646378db..0f45156ac47 100644 --- a/shopfloor_mobile/static/wms/src/scenario/zone_picking.js +++ b/shopfloor_mobile/static/wms/src/scenario/zone_picking.esm.js @@ -378,6 +378,7 @@ const ZonePicking = { }, ]; }, + /* eslint-disable no-unused-vars */ picking_type_render_lines_count(record, field) { return _.template("(${counters}) ${name}")({ counters: this.$t("misc.lines_count", record), @@ -525,9 +526,8 @@ const ZonePicking = { renderer: function (rec, field) { if (rec.handle_complete_mix_pack) { return ""; - } else { - return rec.product.display_name; } + return rec.product.display_name; }, }, { @@ -583,7 +583,7 @@ const ZonePicking = { }, toggle_sort_lines_by() { this.order_lines_by = - this.order_lines_by == "priority" ? "location" : "priority"; + this.order_lines_by === "priority" ? "location" : "priority"; return this.list_move_lines(this.current_picking_type().id); }, list_move_lines(picking_type_id) { @@ -594,7 +594,7 @@ const ZonePicking = { return this.wait_call(this.odoo.call("list_move_lines", {})); }, scan_source(barcode) { - let data = { + const data = { barcode: barcode, confirmation: this.state.data.confirmation_required || "", }; @@ -670,7 +670,7 @@ const ZonePicking = { }, computed: { sort_lines_by_btn_label() { - return this.order_lines_by == "priority" + return this.order_lines_by === "priority" ? this.$t("order_lines_by.location") : this.$t("order_lines_by.priority"); }, @@ -783,12 +783,11 @@ const ZonePicking = { return "Scan product / lot"; } return "Scan product"; - } else { - if (this.any_line_with_lot()) { - return "Scan pack / product / lot"; - } - return "Scan pack / product"; } + if (this.any_line_with_lot()) { + return "Scan pack / product / lot"; + } + return "Scan pack / product"; } if (this.any_line_with_lot()) { return "Scan location / pack / product / lot"; @@ -817,8 +816,8 @@ const ZonePicking = { while (!barcode) { _.forEach( ["lot.name", "product.barcode", "location_src.barcode"], - function (path) { - barcode = _.result(selected, path); + function (pth) { + barcode = _.result(selected, pth); } ); } @@ -863,16 +862,14 @@ const ZonePicking = { // Only locations are allowed. display_info.scan_placeholder = display_info.scan_placeholder_location; + } else if (full_qty === 0 || full_qty === false) { + // Only packages are allowed. + display_info.scan_placeholder = + display_info.scan_placeholder_package; } else { - if (!full_qty) { - // Only packages are allowed. - display_info.scan_placeholder = - display_info.scan_placeholder_package; - } else { - // Both are allowed. - display_info.scan_placeholder = - display_info.scan_placeholder_full; - } + // Both are allowed. + display_info.scan_placeholder = + display_info.scan_placeholder_full; } }, on_scan: (scanned) => { @@ -889,7 +886,7 @@ const ZonePicking = { barcode: scanned.text, quantity: quantity, confirmation: data.confirmation_required || "", - // package_id: data.is_complete_mix_pack ? data.move_line.package_src.id : null, + // Package_id: data.is_complete_mix_pack ? data.move_line.package_src.id : null, handle_complete_mix_pack: data.handle_complete_mix_pack, }) ); diff --git a/shopfloor_mobile/static/wms/src/screen.js b/shopfloor_mobile/static/wms/src/screen.esm.js similarity index 100% rename from shopfloor_mobile/static/wms/src/screen.js rename to shopfloor_mobile/static/wms/src/screen.esm.js diff --git a/shopfloor_mobile/static/wms/src/wms_utils.js b/shopfloor_mobile/static/wms/src/wms_utils.esm.js similarity index 89% rename from shopfloor_mobile/static/wms/src/wms_utils.js rename to shopfloor_mobile/static/wms/src/wms_utils.esm.js index a086133c321..4c4c43974aa 100644 --- a/shopfloor_mobile/static/wms/src/wms_utils.js +++ b/shopfloor_mobile/static/wms/src/wms_utils.esm.js @@ -7,16 +7,17 @@ import {utils_registry} from "/shopfloor_mobile_base/static/wms/src/services/utils_registry.js"; export class WMSUtils { - group_lines_by_location(lines, options) { + group_lines_by_location(lines, opts) { const self = this; // {'key': 'no-group', 'title': '', 'records': []} - options = _.defaults(options || {}, { + const options = _.defaults(opts || {}, { group_key: "location_src", group_no_title: false, name_prefix: "Location", prepare_records: function (recs) { return recs; }, + /* eslint-disable no-unused-vars */ group_color_maker: function (recs) { return ""; }, @@ -32,11 +33,12 @@ export class WMSUtils { // TODO: grouped.forEach? _.forEach(grouped, function (value, loc_id) { const location = _.first(_.filter(locations, {id: parseInt(loc_id, 10)})); - const title = options.group_no_title - ? "" - : options.name_prefix - ? options.name_prefix + ": " + location.name - : location.name; + let title = location.name; + if (options.group_no_title) { + title = ""; + } else if (options.name_prefix) { + title = options.name_prefix + ": " + location.name; + } res.push({ _is_group: true, key: loc_id, @@ -48,10 +50,10 @@ export class WMSUtils { return res; } - group_lines_by_locations(lines, options) { + group_lines_by_locations(lines, opts) { const self = this; // {key: 'no-group', location_src: {}, location_dest: {} records: []} - options = _.defaults(options || {}, { + const options = _.defaults(opts || {}, { prepare_records: function (recs) { return recs; }, @@ -86,10 +88,10 @@ export class WMSUtils { return res; } - group_lines_by_product(lines, options) { + group_lines_by_product(lines, opts) { const self = this; // {'key': 'no-group', 'title': '', 'records': []} - options = _.defaults(options || {}, { + const options = _.defaults(opts || {}, { group_no_title: false, prepare_records: function (recs) { return recs; @@ -101,18 +103,19 @@ export class WMSUtils { const res = []; const products = _.uniqBy( _.map(lines, function (x) { - return x["product"]; + return x.product; }), "id" ); const grouped = _.groupBy(lines, "product.id"); _.forEach(grouped, function (value, prod_id) { const product = _.first(_.filter(products, {id: parseInt(prod_id, 10)})); - const title = options.group_no_title - ? "" - : options.name_prefix - ? options.name_prefix + ": " + product.name - : product.name; + let title = product.name; + if (options.group_no_title) { + title = ""; + } else if (options.name_prefix) { + title = `${options.name_prefix}: ${product.name}`; + } res.push({ _is_group: true, key: prod_id, @@ -169,8 +172,8 @@ export class WMSUtils { res.push({ _is_group: true, // GroupBy gives undefined as string - key: packaging_name == "undefined" ? "no-packaging" : packaging_name, - title: packaging_name == "undefined" ? "" : packaging_name, + key: packaging_name === "undefined" ? "no-packaging" : packaging_name, + title: packaging_name === "undefined" ? "" : packaging_name, records: products, }); }); @@ -201,7 +204,7 @@ export class WMSUtils { const res = []; grouped.forEach(function (group) { if (group.pack) { - let single_line = group.records[0]; + const single_line = group.records[0]; single_line._grouped_by_pack = true; single_line._pack_lines = group.records; res.push(single_line); @@ -244,11 +247,11 @@ export class WMSUtils { line = line.records[0]; } let klass = ""; - if (line.qty_done == line.quantity) { + if (line.qty_done === line.quantity) { klass = "done screen_step_done lighten-1"; } else if (line.qty_done && line.qty_done < line.quantity) { klass = "partial screen_step_todo lighten-2"; - } else if (line.qty_done == 0) { + } else if (line.qty_done === 0) { klass = "not-done screen_step_todo lighten-1"; } return "move-line-" + klass; @@ -259,7 +262,7 @@ export class WMSUtils { if (!records) { return; } - let avg_progress = + const avg_progress = records.reduce((acc, next) => { return next.progress + acc; }, 0) / records.length; @@ -283,7 +286,7 @@ export class WMSUtils { * * @param {*} line The move line */ - move_line_product_detail_options(line, options = {}) { + move_line_product_detail_options(line, opts = {}) { const self = this; const default_fields = [ {path: "product.supplier_code", label: "Vendor code", klass: "loud"}, @@ -301,7 +304,7 @@ export class WMSUtils { }, {path: "product.qty_available", label: "Qty on hand"}, ]; - options = _.defaults({}, options, { + const options = _.defaults({}, opts, { main: true, key_title: "product.display_name", title_action_field: { diff --git a/shopfloor_mobile/templates/assets.xml b/shopfloor_mobile/templates/assets.xml index c2e969c95dd..2aa88816d49 100644 --- a/shopfloor_mobile/templates/assets.xml +++ b/shopfloor_mobile/templates/assets.xml @@ -18,123 +18,123 @@ /> @@ -147,32 +147,32 @@