Skip to content
Closed
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: 1 addition & 0 deletions shopfloor_reception/data/shopfloor_scenario_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<field name="key">reception</field>
<field name="options_edit">
{
"allow_dont_use_packs_in_reception": false,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you do like in #783 for checkout scenario and rely on the configuration of the picking type instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For the history, have a look at #665 (comment)

"auto_post_line": true,
"allow_return": true,
"scan_location_or_pack_first": true,
Expand Down
22 changes: 22 additions & 0 deletions shopfloor_reception/models/shopfloor_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
class ShopfloorMenu(models.Model):
_inherit = "shopfloor.menu"

dont_use_packs_in_reception = fields.Boolean(
compute="_compute_dont_use_packs_in_reception",
store=True,
readonly=False,
)
dont_use_packs_in_reception_is_possible = fields.Boolean(
compute="_compute_dont_use_packs_in_reception_is_possible",
)
filter_today_scheduled_pickings_is_possible = fields.Boolean(
compute="_compute_filter_today_scheduled_pickings_is_possible"
)
Expand All @@ -19,6 +27,20 @@ class ShopfloorMenu(models.Model):
help=FILTER_TODAY_SCHEDULED_PICKINGS_HELP,
)

@api.depends("scenario_id")
def _compute_dont_use_packs_in_reception_is_possible(self):
for menu in self:
menu.dont_use_packs_in_reception_is_possible = bool(
menu.scenario_id.has_option("allow_dont_use_packs_in_reception")
)

@api.depends("dont_use_packs_in_reception_is_possible")
def _compute_dont_use_packs_in_reception(self):
for menu in self:
menu.dont_use_packs_in_reception = (
menu.dont_use_packs_in_reception_is_possible
)

@api.depends("scenario_id")
def _compute_filter_today_scheduled_pickings_is_possible(self):
for menu in self:
Expand Down
19 changes: 14 additions & 5 deletions shopfloor_reception/services/reception.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,13 +817,17 @@ def _before_state__set_quantity(self, picking, line, message=None):
def _response_for_set_quantity(
self, picking, line, message=None, asking_confirmation=None
):
data = {
"selected_move_line": self._data_for_move_lines(line),
"picking": self.data.picking(picking),
"confirmation_required": asking_confirmation,
}
dont_use_packs = self.work.menu.dont_use_packs_in_reception
if dont_use_packs:
data.update({"dont_use_packs": True})
response = self._response(
next_state="set_quantity",
data={
"selected_move_line": self._data_for_move_lines(line),
"picking": self.data.picking(picking),
"confirmation_required": asking_confirmation,
},
data=data,
message=message,
)
return self._align_display_product_uom_qty(line, response)
Expand Down Expand Up @@ -1720,6 +1724,11 @@ def _schema_set_quantity(self):
"nullable": True,
"required": False,
},
"dont_use_packs": {
"type": "boolean",
"nullable": True,
"required": False,
},
}

@property
Expand Down
27 changes: 27 additions & 0 deletions shopfloor_reception/tests/test_set_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,33 @@ def test_scan_product(self):
)
self.assertEqual(selected_move_line.qty_done, 4.0)

def test_scan_product_dont_use_packs(self):
self.service.work.menu.sudo().dont_use_packs_in_reception = True
picking = self._create_picking()
selected_move_line = picking.move_line_ids.filtered(
lambda l: l.product_id == self.product_a
)
selected_move_line.shopfloor_user_id = self.env.uid
response = self.service.dispatch(
"set_quantity",
params={
"picking_id": picking.id,
"selected_line_id": selected_move_line.id,
"barcode": self.product_a.barcode,
},
)
data = self.data.picking(picking)
self.assert_response(
response,
next_state="set_quantity",
data={
"picking": data,
"selected_move_line": self.data.move_lines(selected_move_line),
"confirmation_required": None,
"dont_use_packs": True,
},
)

def test_scan_packaging(self):
picking = self._create_picking()
selected_move_line = picking.move_line_ids.filtered(
Expand Down
10 changes: 10 additions & 0 deletions shopfloor_reception/views/shopfloor_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
<field name="inherit_id" ref="shopfloor_base.shopfloor_menu_form_view" />
<field name="arch" type="xml">
<group name="options" position="inside">
<group
name="dont_use_packs_in_reception"
attrs="{'invisible': [('dont_use_packs_in_reception_is_possible', '=', False)]}"
>
<field
name="dont_use_packs_in_reception_is_possible"
invisible="1"
/>
<field name="dont_use_packs_in_reception" />
</group>
<group
name="filter_today_scheduled_pickings"
attrs="{'invisible': [('filter_today_scheduled_pickings_is_possible', '=', False)]}"
Expand Down
6 changes: 1 addition & 5 deletions shopfloor_reception_mobile/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==========================
Shopfloor reception mobile
==========================
Expand All @@ -17,7 +13,7 @@ Shopfloor reception mobile
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwms-lightgray.png?logo=github
Expand Down
24 changes: 9 additions & 15 deletions shopfloor_reception_mobile/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Shopfloor reception mobile</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="shopfloor-reception-mobile">
<h1 class="title">Shopfloor reception mobile</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="shopfloor-reception-mobile">
<h1>Shopfloor reception mobile</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:eadcaffae32d8dda952fe04de4f3a40041f7a2022d6ddef8a9e2015cad125da3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/wms/tree/16.0/shopfloor_reception_mobile"><img alt="OCA/wms" src="https://img.shields.io/badge/github-OCA%2Fwms-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-shopfloor_reception_mobile"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/wms&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/wms/tree/16.0/shopfloor_reception_mobile"><img alt="OCA/wms" src="https://img.shields.io/badge/github-OCA%2Fwms-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-shopfloor_reception_mobile"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/wms&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Frontend for the reception scenario in shopfloor.
Allows to receive products and create the proper packs for each logistic unit.</p>
<p><strong>Table of contents</strong></p>
Expand All @@ -390,31 +385,31 @@ <h1>Shopfloor reception mobile</h1>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/wms/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/wms/issues/new?body=module:%20shopfloor_reception_mobile%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-2">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-3">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>Camptocamp</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-4">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>Juan Miguel Sánchez Arce &lt;<a class="reference external" href="mailto:juan.sanchez&#64;camptocamp.com">juan.sanchez&#64;camptocamp.com</a>&gt;</li>
<li>Michael Tietz (MT Software) &lt;<a class="reference external" href="mailto:mtietz&#64;mt-software.de">mtietz&#64;mt-software.de</a>&gt;</li>
<li>Souheil Bejaoui &lt;<a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -429,6 +424,5 @@ <h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
15 changes: 12 additions & 3 deletions shopfloor_reception_mobile/static/src/scenario/reception.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,26 @@ const Reception = {
/>
</v-card>
<div class="button-list button-vertical-list full">
<v-row align="center">
<v-row v-if="use_packs" align="center">
<v-col class="text-center" cols="12">
<btn-action @click="state.on_add_to_existing_pack">Existing pack</btn-action>
</v-col>
</v-row>
<v-row align="center">
<v-row v-if="use_packs" align="center">
<v-col class="text-center" cols="12">
<btn-action @click="state.on_create_new_pack">New pack</btn-action>
</v-col>
</v-row>
<v-row align="center">
<v-row v-if="use_packs" align="center">
<v-col class="text-center" cols="12">
<btn-action @click="state.on_process_without_pack">Process without pack</btn-action>
</v-col>
</v-row>
<v-row v-if="!use_packs" align="center">
<v-col class="text-center" cols="12">
<btn-action @click="state.on_process_without_pack">Process</btn-action>
</v-col>
</v-row>
<div class="button-list button-vertical-list full">
<v-row align="center">
<v-col class="text-center" cols="12">
Expand Down Expand Up @@ -213,6 +218,10 @@ const Reception = {
</Screen>
`,
computed: {
use_packs: function () {
var dont_use_packs = _.result(this.state, "data.dont_use_packs", false);
return !dont_use_packs;
},
visible_pickings: function () {
return !_.isEmpty(this.filtered_pickings)
? this.filtered_pickings
Expand Down