Commit 33a45a1e by Owo Sugiana

Bug fixed saat struktur Invoice ID bukan default

1 parent 34f1dbed
......@@ -52,7 +52,7 @@ class BaseInquiry:
def __init__(self, invoice_id, conf=dict()):
self.invoice = None
real_inv_id = self.get_invoice_id(invoice_id)
if len(real_inv_id) != INVOICE_ID_LENGTH:
if len(real_inv_id) != self.get_invoice_id_length():
return
self.invoice_id = FixLength(self.invoice_id_structure)
self.invoice_id.set_raw(real_inv_id)
......@@ -64,9 +64,17 @@ class BaseInquiry:
q = DBSession.query(Invoice).filter_by(
tahun=self.invoice_id['Tahun'], sptno=self.invoice_id['SptNo'])
self.invoice = q.first()
if not self.invoice:
return
if not self.is_available():
self.invoice = None
def get_invoice_id_length(self):
length = 0
for name, size, typ in self.invoice_id_structure:
length += size
return length
def get_invoice_id(self, raw):
return raw
......@@ -560,6 +568,8 @@ class AvailableInvoice:
invoice_id = self.get_invoice_id(row)
Inquiry = self.get_inquiry_class()
inq = Inquiry(invoice_id.get_raw(), self.conf)
if not inq.invoice:
return
if not inq.total:
return
total = thousand(inq.total)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!