def iscustomer(company): book = GncFile.book query = Query() query.search_for('gncCustomer') query.set_book(book) for result in query.run(): customer = Customer(instance=result) if customer.GetName() == company: query.destroy() return customer query.destroy() return None
def GetCustomerByName(self, name): q = Query() q.search_for('gncCustomer') q.set_book(self._book) c = None for result in q.run(): tmp = Customer(instance=result) if tmp.GetName().lower() in name.lower(): c = tmp break q.destroy() return c
address.SetAddr1("201 Nowhere street") new_employee = Employee(book, "2", CAD, "Reliable employee") new_vendor = Vendor(book, "3", CAD, "Dependable vendor") new_job = Job(book, "4", new_vendor, "Good clean, fun") # 7% tax tax_table = TaxTable(book, "good tax", TaxTableEntry(a5, True, GncNumeric(700000, 100000))) invoice_customer = Invoice(book, "5", CAD, new_customer) customer_extract = invoice_customer.GetOwner() assert (isinstance(customer_extract, Customer)) assert (customer_extract.GetName() == new_customer.GetName()) invoice_employee = Invoice(book, "6", CAD, new_employee) employee_extract = invoice_employee.GetOwner() assert (isinstance(employee_extract, Employee)) assert (employee_extract.GetName() == new_employee.GetName()) invoice_vendor = Invoice(book, "7", CAD, new_vendor) vendor_extract = invoice_vendor.GetOwner() assert (isinstance(vendor_extract, Vendor)) assert (vendor_extract.GetName() == new_vendor.GetName()) invoice_job = Invoice(book, "8", CAD, new_job) job_extract = invoice_job.GetOwner() assert (isinstance(job_extract, Job)) assert (job_extract.GetName() == new_job.GetName())