def test_invoice(self): inv = Invoice() inv.invoice_number = '59128' inv.customer = 'Saks Fifth Avenue' inv.store_number = '0689' inv.tracking_number = '1ZW885Y21349335867' inv.ship_date = datetime(2015, 12, 15) inv.discount_code = '05' inv.discount = 0 inv.sscc_number = '803276200000591289' inv.po_number = '6163130' inv.dept_number = '0162' inv.dc_number = '0185' inv.total_cost = 4575 inv.total_qty = 7 inv.address1 = 'ONE WALDENBOOKS DRIVE' inv.address2 = 'DC# 185 STORE# 689' inv.city_state_zip = 'LA VERGNE, TN 37086' p1 = Item() p1.style = 'CB1779- -Y-02-42.0' p1.upc = '8032762238027' p1.qty = 1 p1.cost = 795.0 inv.items.append(p1) #p2 = Product('OB1234- -Y-02-0') self.test_invoices.append(inv)
def get_store_info(invoice: Invoice, destination: str, settings: dict): """Checks the destination file for store info and assigns to the invoice. If the destination is not found, requests user input. Returns False if the user cancels operation""" with open(settings['File Paths']['Destination Log'], 'r') as dest_log: dest_reader = csv.reader(dest_log, delimiter=';') for row in dest_reader: if len(row) > 0 and row[0] == invoice.customer and row[ 1] == destination: invoice.store_number = row[2].zfill(4) invoice.dc_number = row[3].zfill(4) invoice.store_name = row[4] if invoice.store_number is None: invoice = store_not_found(invoice, destination, settings) return invoice