Skip to content

Commit

Permalink
wms_connector: fix computing warehouse_id
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienbeau committed Jan 28, 2024
1 parent 3e5b64d commit b895a7f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wms_connector/models/attachment_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def _compute_picking_imported_count(self):
for record in self:
record.picking_imported_count = len(record.picking_imported_ids)

@api.depends("task_id")
def _compute_warehouse(self):
for rec in self:
field = None
Expand All @@ -38,10 +39,12 @@ def _compute_warehouse(self):
elif rec.file_type == "wms_update_inventory":
field = "wms_import_update_inventory_task_id"

if field:
if field and rec.task_id:
rec.warehouse_id = self.env["stock.warehouse"].search(
[(field, "=", rec.task_id.id)]
)
else:
rec.warehouse_id = None

def _run(self):
for filetype in [el[0] for el in WMS_IMPORT_FILETYPES]:
Expand Down

0 comments on commit b895a7f

Please sign in to comment.