Skip to content

Commit

Permalink
location transfer: allow to scan source package on lines
Browse files Browse the repository at this point in the history
When move lines have no package level (e.g. we use the "Open Package"
button), they still have the package in "package_id".
Users should be able to scan this package to identify that they
want to take the products from there (they may have no label on
products).
  • Loading branch information
guewen committed Oct 30, 2020
1 parent 139a966 commit 456dc3c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions shopfloor/services/location_content_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,13 @@ def scan_line(self, location_id, move_line_id, barcode):
)

search = self.actions_for("search")

package = search.package_from_scan(barcode)
if package and move_line.package_id == package:
# In case we have a source package but no package level because if
# we have a package level, we would use "scan_package".
return self._response_for_scan_destination(location, move_line)

product = search.product_from_scan(barcode)
if product and product == move_line.product_id:
if product.tracking in ("lot", "serial"):
Expand Down
5 changes: 5 additions & 0 deletions shopfloor/tests/test_location_content_transfer_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ def _test_scan_line_ok(self, move_line, barcode):
)
self.assert_response_scan_destination(response, move_line)

def test_scan_line_package_ok(self):
move_line = self.picking2.move_line_ids[0]
package = move_line.package_id = self.env["stock.quant.package"].create({})
self._test_scan_line_ok(move_line, package.name)

def test_scan_line_product_ok(self):
move_line = self.picking2.move_line_ids[0]
# check we selected the good line
Expand Down

0 comments on commit 456dc3c

Please sign in to comment.