Changeset 405a50b in rattail


Ignore:
Timestamp:
03/07/19 20:00:47 (6 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
33296a4
Parents:
1242a5e
Message:

Expand UPC-E to UPC-A when doing product receiving lookup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/batch/purchase.py

    r1242a5e r405a50b  
    3434from rattail.db import model, api
    3535from rattail.gpc import GPC
     36from rattail.barcodes import upce_to_upca
    3637from rattail.batch import BatchHandler
    3738from rattail.time import localtime, make_utc
     
    705706                    return product
    706707
     708                # one last trick is to expand UPC-E to UPC-A and then reattempt
     709                # the lookup, *with* check digit (since it would be known)
     710                if len(entry) in (6, 8):
     711                    checked = GPC(upce_to_upca(entry), calc_check_digit='upc')
     712                    product = api.get_product_by_upc(session, checked)
     713                    if product:
     714                        return product
     715
    707716        elif product_key == 'item_id':
    708717
Note: See TracChangeset for help on using the changeset viewer.