Skip to content

Commit

Permalink
Merge pull request OCA#31 from camptocamp/location-content-transfer-f…
Browse files Browse the repository at this point in the history
…rontend

Location content transfer frontend
  • Loading branch information
simahawk authored Jul 17, 2020
2 parents b803cde + 59bb1c1 commit 3be5478
Show file tree
Hide file tree
Showing 23 changed files with 775 additions and 153 deletions.
1 change: 1 addition & 0 deletions shopfloor/actions/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def _package_level_parser(self):
return [
"id",
"is_done",
("picking_id:picking", self._simple_record_parser()),
("package_id:package_src", self._package_parser),
("location_dest_id:location_dest", self._location_parser),
(
Expand Down
1 change: 1 addition & 0 deletions shopfloor/services/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def package_level(self):
return {
"id": {"required": True, "type": "integer"},
"is_done": {"type": "boolean", "nullable": False, "required": True},
"picking": self._schema_dict_of(self._simple_record()),
"package_src": self._schema_dict_of(self.package()),
"location_src": self._schema_dict_of(self.location()),
"location_dest": self._schema_dict_of(self.location()),
Expand Down
1 change: 1 addition & 0 deletions shopfloor/tests/test_actions_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def test_data_package_level(self):
expected = {
"id": package_level.id,
"is_done": False,
"picking": self.picking.jsonify(["id", "name"])[0],
"package_src": self._expected_package(package_level.package_id),
"location_dest": self._expected_location(package_level.location_dest_id),
"location_src": self._expected_location(
Expand Down
4 changes: 3 additions & 1 deletion shopfloor_mobile/static/wms/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<!-- TODO: make file local -->
<script src="https://unpkg.com/vue-i18n/dist/vue-i18n.js"></script>
<script src="src/services/odoo.js" type="module"></script>
<script src="src/services/config.js" type="module"></script>
<script src="src/services/process_registry.js" type="module"></script>
<script src="src/utils.js" type="module"></script>
<script src="src/homepage.js" type="module"></script>
Expand Down Expand Up @@ -72,6 +71,9 @@
<script src="src/scenario/cluster_picking.js" type="module"></script>
<script src="src/scenario/checkout.js" type="module"></script>
<script src="src/scenario/delivery.js" type="module"></script>
<script src="src/scenario/location_content_transfer.js" type="module"></script>
<!-- FIXME: drop -->
<script src="src/demo/demo.location_content_transfer.js" type="module"></script>
<script src="src/scenario/scan_anything.js" type="module"></script>
<script type="module" src="src/main.js"></script>
</head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: rename as we used this not only for batch picking
export var batch_picking_line = Vue.component("batch-picking-line-detail", {
props: {
line: Object,
Expand All @@ -9,26 +10,19 @@ export var batch_picking_line = Vue.component("batch-picking-line-detail", {
type: Boolean,
default: false,
},
defaultDestinationKey: {
type: String,
default: "package_dest",
},
},
data() {
return {
dialog: false,
};
},
computed: {
has_destination_pack() {
return _.result(this.line, "package_dest.id");
},
},
methods: {
full_detail_fields() {
return [
{path: "batch.name", label: "Batch"},
{path: "picking.name", label: "Picking"},
{path: "picking.origin", label: "Origin"},
{path: "picking.partner.name", label: "Customer"},
{path: "location_dest.name", label: "Destination"},
];
destination() {
return _.result(this.line, this.$props.defaultDestinationKey);
},
},
template: `
Expand All @@ -48,48 +42,34 @@ export var batch_picking_line = Vue.component("batch-picking-line-detail", {
/>
<item-detail-card
v-if="articleScanned && has_destination_pack"
v-if="articleScanned && destination"
:key="'batch-picking-line-detail-3'"
:record="line"
:options="{main: true, key_title: 'package_dest.name', title_action_field: {action_val_path: 'package_dest.name'}}"
:card_color="utils.colors.color_for(has_destination_pack ? 'screen_step_done': 'screen_step_todo')"
:options="{main: true, key_title: defaultDestinationKey + '.name', title_action_field: {action_val_path: defaultDestinationKey + '.name'}}"
:card_color="utils.colors.color_for(destination ? 'screen_step_done': 'screen_step_todo')"
/>
<v-card class="pa-2" :color="utils.colors.color_for('screen_step_todo')" v-if="showQtyPicker">
<packaging-qty-picker :options="utils.misc.move_line_qty_picker_options(line)" />
</v-card>
<item-detail-card
v-if="articleScanned && !has_destination_pack"
v-if="articleScanned && !destination"
:key="'batch-picking-line-detail-4'"
:record="line"
:options="{main: true, title_action_field: {action_val_path: 'name'}}"
:card_color="utils.colors.color_for(has_destination_pack ? 'screen_step_done': 'screen_step_todo')"
:card_color="utils.colors.color_for(destination ? 'screen_step_done': 'screen_step_todo')"
>
<template v-slot:title>
Destination pack not selected.
Destination not selected.
</template>
</item-detail-card>
<!--
<v-expansion-panels>
<v-expansion-panel class="with-card">
<v-expansion-panel-header>Full details</v-expansion-panel-header>
<v-expansion-panel-content>
<item-detail-card
:key="'batch-picking-line-detail-4'"
:record="line"
:options="{no_title: true, loud_labels: true, no_outline: true, fields: full_detail_fields()}"
/>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
-->
</div>
`,
});

// TODO: use `misc.line-actions-popup` instead
export var batch_picking_line_actions = Vue.component("batch-picking-line-actions", {
props: ["line"],
data() {
Expand Down Expand Up @@ -149,32 +129,3 @@ export var batch_picking_line_actions = Vue.component("batch-picking-line-action
</div>
`,
});

export var batch_picking_line_stock_out = Vue.component(
"batch-picking-line-stock-out",
{
props: ["line"],
methods: {
handle_action(action) {
this.$emit("action", action);
},
},
template: `
<div class="batch-picking-line-stock-out">
<batch-picking-line-detail :line="line" />
<div class="button-list button-vertical-list full">
<v-row align="center">
<v-col class="text-center" cols="12">
<btn-action @click="handle_action('confirm_stock_issue')">Confirm stock = 0</btn-action>
</v-col>
</v-row>
<v-row align="center">
<v-col class="text-center" cols="12">
<v-btn x-large color="default" @click="handle_action('back')">back</v-btn>
</v-col>
</v-row>
</div>
</div>
`,
}
);
106 changes: 104 additions & 2 deletions shopfloor_mobile/static/wms/src/components/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ Vue.component("state-display-info", {
props: {
info: Object,
},
computed: {
title: function() {
return _.isFunction(this.info.title) ? this.info.title() : this.info.title;
},
},
template: `
<div class="state-display-info" v-if="info.title">
<div class="state-display-info" v-if="title">
<v-alert tile dense type="info" :icon="false">
<div class="state-title">{{ info.title }}</div>
<div class="state-title">{{ title }}</div>
</v-alert>
</div>
`,
Expand Down Expand Up @@ -266,3 +271,100 @@ Vue.component("btn-back", {
</btn-action>
`,
});

Vue.component("btn-reset-config", {
props: {
redirect: {
type: Object,
default: function() {
return {name: "home"};
},
},
},
methods: {
reset_data: function() {
this.$root._clearConfig();
this.$root._loadMenu();
this.$root.$router.push(this.$props.redirect);
},
},
template: `<btn-action action="warn" @click="reset_data()">Reload config and menu</btn-action>`,
});

Vue.component("line-actions-popup", {
props: {
line: {
type: Object,
},
actions: {
type: Array,
default: function() {
return [];
},
},
},
data() {
return {
dialog: false,
};
},
methods: {
handle_action(action) {
this.dialog = false;
this.$emit("action", action);
},
},
template: `
<div :class="$options._componentTag">
<v-dialog v-model="dialog" fullscreen tile class="actions fullscreen text-center">
<template v-slot:activator="{ on }">
<div class="button-list button-vertical-list full">
<v-row class="actions bottom-actions">
<v-col class="text-center" cols="12">
<btn-action v-on="on">Action</btn-action>
</v-col>
</v-row>
</div>
</template>
<v-card>
<div class="button-list button-vertical-list full">
<v-row align="center" v-for="action in actions">
<v-col class="text-center" cols="12">
<btn-action @click="handle_action(action)">{{ action.name }}</btn-action>
</v-col>
</v-row>
<v-row align="center">
<v-col class="text-center" cols="12">
<v-btn x-large @click="dialog = false">Back</v-btn>
</v-col>
</v-row>
</div>
</v-card>
</v-dialog>
</div>
`,
});

Vue.component("line-stock-out", {
methods: {
handle_action(action) {
this.$emit(action);
},
},
template: `
<div :class="$options._componentTag">
<div class="button-list button-vertical-list full">
<v-row align="center">
<v-col class="text-center" cols="12">
<btn-action @click="handle_action('confirm_stock_issue')">Confirm stock = 0</btn-action>
</v-col>
</v-row>
<v-row align="center">
<v-col class="text-center" cols="12">
<btn-back />
</v-col>
</v-row>
</div>
</div>
`,
});
1 change: 0 additions & 1 deletion shopfloor_mobile/static/wms/src/components/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Vue.component("Screen", {
},
show_profile_not_ready() {
return (
!this.$root.demo_mode &&
!this.$root.has_profile &&
this.$route.name != "profile" &&
this.$route.name != "settings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ Vue.component("user-information", {
props: ["message"],
template: `
<v-alert :type="alert_type" tile>
{{ message.body }}
{{ _.result(message, "body") }}
</v-alert>
`,
computed: {
alert_type: function() {
return this.message.message_type || "info";
return _.result(this.message, "message_type", "info");
},
},
});
Expand Down
Loading

0 comments on commit 3be5478

Please sign in to comment.