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()
def on_confirm(self): invoice = SaleInvoice(self.model, self._printer.layout) print_sale_invoice(invoice, self._printer)