Truncate item descriptions when pushing to dtransactions if needed

This commit is contained in:
Lance Edgar 2023-10-01 19:41:39 -05:00
parent f61ae7a7e0
commit fd5d3142ed

View file

@ -48,6 +48,7 @@ class POSBatchHandler(base.POSBatchHandler):
self.corepos_handler = self.app.get_corepos_handler()
self.coretrans = self.corepos_handler.get_model_office_trans()
self.maxlen_upc = self.app.maxlen(self.coretrans.TransactionDetail.upc)
self.maxlen_description = self.app.maxlen(self.coretrans.TransactionDetail.description)
# convert batch rows to `dtransactions` records
@ -122,8 +123,15 @@ class POSBatchHandler(base.POSBatchHandler):
def make_d_badscan(self, row):
d = self.make_d_basic(row=row)
d.upc = row.item_entry
d.description = 'BADSCAN'
d.upc = row.item_entry
if d.upc and len(d.upc) > self.maxlen_upc:
log.debug("have to truncate this upc to %s chars (it has %s): %s",
self.maxlen_upc, len(d.upc), d.upc)
d.upc = d.upc[:self.maxlen_upc]
d.description += " (TRUNCATED)"
return d
def make_d_customer(self, row):