Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ");
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ");
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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]);
},
/**
*
Expand Down Expand Up @@ -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;
},
Expand Down Expand Up @@ -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")
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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)";
}
Expand Down Expand Up @@ -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 [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* @author Simone Orsi <simahawk@gmail.com>
* 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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
* @author Simone Orsi <simahawk@gmail.com>
* 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],
Expand All @@ -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;
},
Expand All @@ -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"},
Expand All @@ -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 "";
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -66,18 +68,21 @@ 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
return rec.records[0];
}
return rec;
},
/* eslint-disable no-unused-vars */
enabled: function (rec, action) {
return true;
},
Expand All @@ -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);
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -102,15 +102,15 @@ 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;
},
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
});
Expand Down Expand Up @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
},
Expand Down Expand Up @@ -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;
Expand Down
Loading