Skip to content
Merged
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
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
^shopfloor_mobile/|
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
Expand Down
4 changes: 2 additions & 2 deletions shopfloor_mobile/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
{
"name": "Shopfloor mobile",
"summary": "Mobile frontend for WMS Shopfloor app",
"version": "16.0.1.4.0",
"version": "18.0.1.0.0",
"depends": ["shopfloor", "shopfloor_mobile_base"],
"author": "Camptocamp, BCIM, Akretion, Odoo Community Association (OCA)",
"maintainers": ["simahawk"],
"website": "https://github.com/OCA/stock-logistics-shopfloor",
"category": "Warehouse Management",
"license": "AGPL-3",
"installable": False,
"installable": True,
"data": ["templates/assets.xml"],
}
3 changes: 3 additions & 0 deletions shopfloor_mobile/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
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 @@ -4,7 +4,7 @@
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/

import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js";
import {ItemDetailMixin} from "/shopfloor_mobile_base/static/src/components/detail/detail_mixin.esm.js";

Vue.component("detail-location", {
mixins: [ItemDetailMixin],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/

import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js";
import {ItemDetailMixin} from "/shopfloor_mobile_base/static/src/components/detail/detail_mixin.esm.js";

// TODO: this should be probably merged or combined w/ detail-product
Vue.component("detail-lot", {
Expand Down 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 @@ -4,7 +4,7 @@
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/

import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js";
import {ItemDetailMixin} from "/shopfloor_mobile_base/static/src/components/detail/detail_mixin.esm.js";

// TODO: this should probably trashed in favour of detail-transfer
// ATM is used only by single pack transfer to display package level info.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/

import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js";
import {ItemDetailMixin} from "/shopfloor_mobile_base/static/src/components/detail/detail_mixin.esm.js";

Vue.component("detail-package", {
mixins: [ItemDetailMixin],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/

import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js";
import {ItemDetailMixin} from "/shopfloor_mobile_base/static/src/components/detail/detail_mixin.esm.js";

// TODO: refactor according to new data from backend and maybe merge w/ `detail-lot`
Vue.component("detail-product", {
Expand Down 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,7 @@
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/

import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js";
import {ItemDetailMixin} from "/shopfloor_mobile_base/static/src/components/detail/detail_mixin.esm.js";

Vue.component("detail-transfer", {
mixins: [ItemDetailMixin],
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,9 +4,7 @@
* 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";
import {ItemDetailMixin} from "/shopfloor_mobile_base/static/src/components/detail/detail_mixin.esm.js";

// TODO: could be merged w/ userConfirmation
Vue.component("last-operation", {
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]);
Copy link

@ivantodorovich ivantodorovich Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

underscore (_) has been slowly being removed from Odoo. In 18.0, there are very few cases still using it. At some point in a future version it won't be available anymore.

It's recommended to migrate to the vanilla js alternatives

Copy link
Contributor Author

@simahawk simahawk Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not underscore, is lodash, and we have a frozen version here ;)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, alright then 😅

},
/**
*
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 {ItemDetailMixin} from "/shopfloor_mobile_base/static/src/components/detail/detail_mixin.esm.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,10 +4,9 @@
* 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";
import {ItemDetailMixin} from "/shopfloor_mobile_base/static/wms/src/components/detail/detail_mixin.js";
/* eslint-disable sort-imports */
import {PickingDetailListMixin} from "./mixins.esm.js";
import {ItemDetailMixin} from "/shopfloor_mobile_base/static/src/components/detail/detail_mixin.esm.js";

Vue.component("picking-summary", {
mixins: [PickingDetailListMixin],
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
Loading