Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
Archivo: sales.py Proyecto: stoq/stoq
    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()
Ejemplo n.º 4
0
    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()