Changeset 3746c1b in rattail


Ignore:
Timestamp:
03/27/19 19:57:09 (6 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
7447357
Parents:
50768ed
Message:

Allow "loose" product matching between truck dump parent and child

i.e. for sake of claiming rows between the two

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/batch/purchase.py

    r50768ed r3746c1b  
    15261526        parent_batch = parent_row.batch
    15271527
    1528         if not parent_row.product:
    1529             raise NotImplementedError("not sure how to find best match for unknown product")
    1530 
    15311528        if not (cases or units):
    15321529            raise ValueError("must provide amount for cases and/or units")
     
    15451542        all_child_rows = []
    15461543        for child_batch in parent_batch.truck_dump_children:
    1547             child_rows = [child_row for child_row in child_batch.active_rows()
    1548                           if child_row.product_uuid == parent_row.product.uuid]
     1544
     1545            # match on exact product if possible, otherwise must match on upc etc.
     1546            if parent_row.product:
     1547                child_rows = [child_row for child_row in child_batch.active_rows()
     1548                              if child_row.product_uuid == parent_row.product.uuid]
     1549            else:
     1550                # note that we only want to match child rows which have *no* product ref
     1551                # TODO: should consult config to determine which product key to match on
     1552                child_rows = [child_row for child_row in child_batch.active_rows()
     1553                              if not child.product_uuid and child_row.upc == parent_row.upc]
     1554
    15491555            for child_row in child_rows:
    15501556
Note: See TracChangeset for help on using the changeset viewer.