diff --git a/rattail_corepos/batch/pos.py b/rattail_corepos/batch/pos.py index 5b5380f..040399c 100644 --- a/rattail_corepos/batch/pos.py +++ b/rattail_corepos/batch/pos.py @@ -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):