Changeset 57d1427 in rattail


Ignore:
Timestamp:
03/01/19 12:06:27 (7 weeks ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
0b88942
Parents:
a60b4f3
Message:

Account for split cases in claimed/pending tallies for truck dump children

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/batch/purchase.py

    ra60b4f3 r57d1427  
    14501450                child_row.units_ordered_pending = (child_row.units_ordered or 0) - child_row.units_ordered_claimed
    14511451
     1452                # maybe account for split cases
     1453                if child_row.units_ordered_pending < 0:
     1454                    split_cases = -child_row.units_ordered_pending // child_row.case_quantity + 1
     1455                    if split_cases > child_row.cases_ordered_pending:
     1456                        raise ValueError("too many cases have been split?")
     1457                    child_row.cases_ordered_pending -= split_cases
     1458                    child_row.units_ordered_pending += split_cases * child_row.case_quantity
     1459
    14521460                all_child_rows.append(child_row)
    14531461
Note: See TracChangeset for help on using the changeset viewer.