示例#1
0
	def print_dialog(self, window):
		from py3o.template import Template 
		purchase_order_file = "/tmp/" + self.document_odt
		t = Template(main.template_dir+"/document_template.odt", purchase_order_file , True)
		t.render(self.data)  #the self.data holds all the info of the purchase_order
		subprocess.call("odt2pdf " + purchase_order_file, shell = True)
		p = printing.Setup("/tmp/" + self.document_pdf, "document")
		p.print_dialog (window)
示例#2
0
 def print_directly(self, window):
     subprocess.call("odt2pdf " + self.invoice_file, shell=True)
     p = printing.Setup("/tmp/" + self.document_pdf, "invoice")
     result = p.print_directly(window)
     if result == Gtk.PrintOperationResult.APPLY:
         self.cursor.execute(
             "UPDATE invoices SET date_printed = "
             "CURRENT_DATE WHERE id = %s", (self.invoice_id, ))
	def print_pdf (self, window):
		subprocess.call(["odt2pdf", self.credit_memo_file])
		p = printing.Setup("/tmp/" + self.document_pdf, "credit_memo")
		result = p.print_dialog(window)
		if result == Gtk.PrintOperationResult.APPLY:
			self.cursor.execute("UPDATE credit_memos SET date_printed = "
								"CURRENT_DATE WHERE id = %s", 
								(self.credit_memo_id,))
		return result
示例#4
0
 def print_directly(self):
     from py3o.template import Template
     purchase_order_file = "/tmp/" + self.document_odt
     t = Template(main.template_dir + "/purchase_order_template.odt",
                  purchase_order_file, True)
     t.render(self.data)
     subprocess.call("odt2pdf " + purchase_order_file, shell=True)
     p = printing.Setup("/tmp/" + self.document_pdf, 'purchase_order')
     p.print_direct(window)
     self.store = []
示例#5
0
 def print_dialog(self, window):
     from py3o.template import Template
     purchase_order_file = "/tmp/" + self.document_odt
     t = Template(main.template_dir + "/purchase_order_template.odt",
                  purchase_order_file, True)
     t.render(
         self.data)  #the self.data holds all the info of the purchase_order
     #subprocess.call("libreoffice --nologo -p " + purchase_order_file, shell = True)
     subprocess.call("odt2pdf " + purchase_order_file, shell=True)
     p = printing.Setup("/tmp/" + self.document_pdf, 'purchase_order')
     result = p.print_dialog(window)
     if result == Gtk.PrintOperationResult.APPLY:
         self.cursor.execute(
             "UPDATE purchase_orders SET date_printed = "
             "CURRENT_DATE WHERE id = %s", (self.purchase_order_id, ))
示例#6
0
 def print_dialog(self, window):
     p = printing.Setup("/tmp/" + self.document_pdf, 'statement')
     result = p.print_dialog(window)
     if result == Gtk.PrintOperationResult.APPLY:
         self.cursor.execute(
             "UPDATE statements SET (print_date, printed) = "
             "(CURRENT_DATE, True) WHERE id = %s", (self.statement_id, ))
     document = "/tmp/" + self.document_pdf
     f = open(document, 'rb')
     dat = f.read()
     binary = psycopg2.Binary(dat)
     f.close()
     self.cursor.execute(
         "UPDATE statements SET (name, pdf) = (%s, %s) "
         "WHERE id = %s", (self.document_name, binary, self.statement_id))
     self.close_invoices_and_payments()