Skip to content

Commit

Permalink
Merge pull request #3945 from mikhailprivalov/fix-load-price
Browse files Browse the repository at this point in the history
Загрузка прайса файлом - fix
  • Loading branch information
urchinpro authored Jun 19, 2024
2 parents 05a6cc3 + 1dc529a commit 9205236
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api/contracts/forms100.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ def form_01(request_data):
starts = True
else:
internal_code = cells[internal_code_idx].strip()
coast = cells[coast_idx].strip()
if internal_code == "None" or coast == "None" or coast == "0":
try:
coast = float(cells[coast_idx].strip())
except Exception:
continue
if internal_code == "None" or not coast:
continue
service = Researches.objects.filter(internal_code=internal_code).first()
if not service:
Expand All @@ -49,4 +52,6 @@ def form_01(request_data):
else:
new_coast = PriceCoast(price_name_id=price.pk, research_id=service.pk, coast=coast)
new_coast.save()
if not starts:
return {"ok": False, "result": [], "message": "Не найдены колонка 'Код по прайсу' "}
return {"ok": True, "result": [], "message": ""}

0 comments on commit 9205236

Please sign in to comment.