Truncate item descriptions when pushing to dtransactions
if needed
This commit is contained in:
parent
f61ae7a7e0
commit
fd5d3142ed
|
@ -48,6 +48,7 @@ class POSBatchHandler(base.POSBatchHandler):
|
||||||
|
|
||||||
self.corepos_handler = self.app.get_corepos_handler()
|
self.corepos_handler = self.app.get_corepos_handler()
|
||||||
self.coretrans = self.corepos_handler.get_model_office_trans()
|
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)
|
self.maxlen_description = self.app.maxlen(self.coretrans.TransactionDetail.description)
|
||||||
|
|
||||||
# convert batch rows to `dtransactions` records
|
# convert batch rows to `dtransactions` records
|
||||||
|
@ -122,8 +123,15 @@ class POSBatchHandler(base.POSBatchHandler):
|
||||||
|
|
||||||
def make_d_badscan(self, row):
|
def make_d_badscan(self, row):
|
||||||
d = self.make_d_basic(row=row)
|
d = self.make_d_basic(row=row)
|
||||||
d.upc = row.item_entry
|
|
||||||
d.description = 'BADSCAN'
|
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
|
return d
|
||||||
|
|
||||||
def make_d_customer(self, row):
|
def make_d_customer(self, row):
|
||||||
|
|
Loading…
Reference in a new issue