Changeset 0b88942 in rattail


Ignore:
Timestamp:
03/02/19 18:08:52 (5 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
ed6ef1e
Parents:
57d1427
Message:

Update receiving batch logic to leverage new truck_dump_status

missed some things in recent commit(s)...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/batch/purchase.py

    r57d1427 r0b88942  
    674674            batch.status_code = batch.STATUS_UNKNOWN_PRODUCT
    675675
    676         # truck dump parent batch status should reflect how much is (un)claimed
    677         elif batch.is_truck_dump_parent():
    678 
    679             # empty batch is considered "ok"
    680             if not rows:
    681                 batch.status_code = batch.STATUS_OK
    682 
    683             # batch is "claimed" only if all rows are "settled" so to speak
    684             elif all([row.status_code in (row.STATUS_TRUCKDUMP_CLAIMED,
    685                                           row.STATUS_OK)
    686                       for row in rows]):
    687                 batch.status_code = batch.STATUS_TRUCKDUMP_CLAIMED
    688 
    689             # otherwise just call it "unclaimed"
    690             else:
    691                 batch.status_code = batch.STATUS_TRUCKDUMP_UNCLAIMED
    692 
    693676        # for now anything else is considered ok
    694677        else:
    695678            batch.status_code = batch.STATUS_OK
     679
     680        # truck dump parent batch gets status to reflect how much is (un)claimed
     681        if batch.is_truck_dump_parent():
     682
     683            # batch is "claimed" only if all rows are "settled" so to speak
     684            if all([row.truck_dump_status == row.STATUS_TRUCKDUMP_CLAIMED
     685                    for row in rows]):
     686                batch.truck_dump_status = batch.STATUS_TRUCKDUMP_CLAIMED
     687
     688            # otherwise just call it "unclaimed"
     689            else:
     690                batch.truck_dump_status = batch.STATUS_TRUCKDUMP_UNCLAIMED
    696691
    697692    def locate_product_for_entry(self, session, entry, lookup_by_code=True):
     
    938933                else:
    939934                    row.status_code = row.STATUS_INCOMPLETE
     935
     936                # truck dump parent rows are also given status for that, which
     937                # reflects claimed vs. pending, i.e. child reconciliation
     938                if batch.is_truck_dump_parent():
     939                    row.truck_dump_status = row.STATUS_TRUCKDUMP_CLAIMED
    940940
    941941            else: # we do have some confirmed items
     
    17561756        if batch.mode == self.enum.PURCHASE_BATCH_MODE_RECEIVING:
    17571757
    1758             if batch.is_truck_dump_parent() and batch.status_code != batch.STATUS_TRUCKDUMP_CLAIMED:
     1758            if batch.is_truck_dump_parent() and batch.truck_dump_status != batch.STATUS_TRUCKDUMP_CLAIMED:
    17591759                return ("Can't execute a Truck Dump (parent) batch until "
    17601760                        "it has been fully claimed by children")
Note: See TracChangeset for help on using the changeset viewer.