Make handler responsible for locating product for inventory batch
This commit is contained in:
parent
0e7835e2d9
commit
71a9010579
|
@ -33,7 +33,7 @@ import logging
|
|||
import six
|
||||
|
||||
from rattail import pod
|
||||
from rattail.db import model, api
|
||||
from rattail.db import model
|
||||
from rattail.db.util import make_full_description
|
||||
from rattail.time import localtime
|
||||
from rattail.gpc import GPC
|
||||
|
@ -375,25 +375,13 @@ class InventoryBatchView(BatchMasterView):
|
|||
def find_row_for_product(self, batch, product):
|
||||
return self.handler.find_row_for_product(self.Session(), batch, product)
|
||||
|
||||
# TODO: deprecate / remove (?)
|
||||
def find_product(self, entry):
|
||||
upc = re.sub(r'\D', '', entry.strip())
|
||||
if upc:
|
||||
lookup_by_code = self.rattail_config.getbool(
|
||||
'tailbone', 'inventory.lookup_by_code', default=False)
|
||||
|
||||
# first try to locate existing batch row by UPC match
|
||||
provided = GPC(upc, calc_check_digit=False)
|
||||
checked = GPC(upc, calc_check_digit='upc')
|
||||
product = api.get_product_by_upc(self.Session(), provided)
|
||||
if product:
|
||||
return product
|
||||
product = api.get_product_by_upc(self.Session(), checked)
|
||||
if product:
|
||||
return product
|
||||
|
||||
# maybe try to locate product by alternate code
|
||||
if self.rattail_config.getbool('tailbone', 'inventory.lookup_by_code', default=False):
|
||||
product = api.get_product_by_code(self.Session(), entry)
|
||||
if product:
|
||||
return product
|
||||
return self.handler.locate_product_for_entry(
|
||||
self.Session(), entry, lookup_by_code=lookup_by_code)
|
||||
|
||||
def product_info(self, product):
|
||||
data = {}
|
||||
|
|
Loading…
Reference in a new issue