def test_get_by_station(self): station = self.create_station() self.failIf(InvoicePrinter.get_by_station(station, self.store)) InvoicePrinter( store=self.store, description=u"test invoice", layout=None, device_name=u"/dev/lp0", station=station ) printer = InvoicePrinter.get_by_station(station, self.store) self.failUnless(printer) self.assertEqual(printer.station, station)
def test_get_by_station(self): station = self.create_station() self.failIf(InvoicePrinter.get_by_station(station, self.store)) InvoicePrinter(store=self.store, description=u'test invoice', layout=None, device_name=u'/dev/lp0', station=station) printer = InvoicePrinter.get_by_station(station, self.store) self.failUnless(printer) self.assertEqual(printer.station, station)
def _print_invoice(self): sale_view = self.results.get_selected() assert sale_view sale = sale_view.sale station = api.get_current_station(self.store) printer = InvoicePrinter.get_by_station(station, self.store) if printer is None: info(_("There are no invoice printer configured for this station")) return assert printer.layout invoice = SaleInvoice(sale, printer.layout) if not invoice.has_invoice_number() or sale.invoice.invoice_number: print_sale_invoice(invoice, printer) else: store = api.new_store() retval = self.run_dialog(SaleInvoicePrinterDialog, store, store.fetch(sale), printer) store.confirm(retval) store.close()
def _print_invoice(self): sale_view = self.results.get_selected() assert sale_view sale = sale_view.sale station = api.get_current_station(self.store) printer = InvoicePrinter.get_by_station(station, self.store) if printer is None: info(_("There are no invoice printer configured for this station")) return assert printer.layout invoice = SaleInvoice(sale, printer.layout) if not invoice.has_invoice_number() or sale.invoice_number: print_sale_invoice(invoice, printer) else: store = api.new_store() retval = self.run_dialog(SaleInvoicePrinterDialog, store, store.fetch(sale), printer) store.confirm(retval) store.close()