Skip to content

Commit

Permalink
fixup! fixup! shopfloor_reception: adapt to changes in delivery_carri…
Browse files Browse the repository at this point in the history
…er_return_barcode_pattern
  • Loading branch information
TDu committed Jan 25, 2024
1 parent 9f2ec8b commit 5cd46d9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions shopfloor/actions/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ def generic_packaging_from_scan(self, barcode):
[("barcode", "=", barcode), ("product_id", "=", False)], limit=1
)

def _get_origin_from_barcode(self, barcode):
def _get_origin_from_barcode(self, barcode, **kwargs):
"""Returns a list of valid origins for a given barcode."""
# Hookable method
return [barcode]

def origin_move_from_scan(self, barcode, extra_domain=None):
origins = self._get_origin_from_barcode(barcode)
def origin_move_from_scan(self, barcode, extra_domain=None, **kwargs):
origins = self._get_origin_from_barcode(barcode, **kwargs)
model = self.env["stock.move"]
outgoing_move_domain = [
# We could have the same origin for multiple transfers
Expand Down
4 changes: 2 additions & 2 deletions shopfloor_reception/actions/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class SearchAction(Component):

_inherit = "shopfloor.search.action"

def _get_origin_from_barcode(self, barcode):
if self.work.menu.scenario_id.key == "reception":
def _get_origin_from_barcode(self, barcode, **kwargs):
if kwargs.get("reception_return"):
carriers = self.env["delivery.carrier"].search([])
res = carriers._get_origin_from_barcode(barcode)
if res:
Expand Down
4 changes: 2 additions & 2 deletions shopfloor_reception/services/reception.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def _scan_line__by_product__return(self, picking, product):
("picking_id.picking_type_code", "=", "outgoing"),
]
origin_moves = search.origin_move_from_scan(
picking.origin, extra_domain=origin_move_domain
picking.origin, extra_domain=origin_move_domain, reception_return=True
)
origin_moves_for_product = origin_moves.filtered(
lambda m: m.product_id == product
Expand Down Expand Up @@ -440,7 +440,7 @@ def _scan_line__by_packaging__return(self, picking, packaging):
("picking_id.picking_type_code", "=", "outgoing"),
]
origin_moves = search.origin_move_from_scan(
picking.origin, extra_domain=origin_move_domain
picking.origin, extra_domain=origin_move_domain, reception_return=True
)
origin_moves_for_packaging = origin_moves.filtered(
lambda m: packaging in m.product_id.packaging_ids
Expand Down

0 comments on commit 5cd46d9

Please sign in to comment.