Permalink
Browse files

Fixed several pdf output problems: enabled delivery order output. Fix…

…ed xsl problems in the sample xsl files. with the new fop version blank lines were not detected.
  • Loading branch information...
1 parent 5e87f32 commit 053c2b563f13583ea7bd4f52eced43e7eec1bbba @scaphilo committed Oct 8, 2011
View
@@ -363,6 +363,7 @@ def createInvoice(self):
invoice.description = self.description
invoice.discount = self.discount
invoice.customer = self.customer
+ invoice.staff = self.staff
invoice.status = 'C'
invoice.derivatedFromQuote = self
invoice.currency = self.currency
@@ -531,14 +532,18 @@ def createPDF(self, deliveryorder):
projectroot = etree.SubElement(rootelement, "projectroot")
projectroot.text = settings.PROJECT_ROOT
xml.write(settings.PDF_OUTPUT_ROOT+"invoice_"+str(self.id)+".xml")
- log = open(settings.PDF_OUTPUT_ROOT+"log.txt", "w")
- log.write('bash -c "fop -c '+userExtension[0].defaultTemplateSet.fopConfigurationFile.path+' -xml '+settings.PDF_OUTPUT_ROOT+'invoice_'+str(self.id)+'.xml -xsl ' + userExtension[0].defaultTemplateSet.invoiceXSLFile.xslfile.path+' -pdf '+settings.PDF_OUTPUT_ROOT+'invoice_'+str(self.id)+'.pdf"')
- log.close()
if (deliveryorder == False):
+ log = open(settings.PDF_OUTPUT_ROOT+"log.txt", "w")
+ log.write('bash -c "fop -c '+userExtension[0].defaultTemplateSet.fopConfigurationFile.path+' -xml '+settings.PDF_OUTPUT_ROOT+'invoice_'+str(self.id)+'.xml -xsl ' + userExtension[0].defaultTemplateSet.invoiceXSLFile.xslfile.path+' -pdf '+settings.PDF_OUTPUT_ROOT+'invoice_'+str(self.id)+'.pdf"')
+ log.close()
system('bash -c "fop -c '+userExtension[0].defaultTemplateSet.fopConfigurationFile.path+' -xml '+settings.PDF_OUTPUT_ROOT+'invoice_'+str(self.id)+'.xml -xsl ' + userExtension[0].defaultTemplateSet.invoiceXSLFile.xslfile.path+' -pdf '+settings.PDF_OUTPUT_ROOT+'invoice_'+str(self.id)+'.pdf"')
+ return settings.PDF_OUTPUT_ROOT+"invoice_"+str(self.id)+".pdf"
else:
+ log = open(settings.PDF_OUTPUT_ROOT+"log.txt", "w")
+ log.write('bash -c "fop -c '+userExtension[0].defaultTemplateSet.fopConfigurationFile.path+' -xml '+settings.PDF_OUTPUT_ROOT+'invoice_'+str(self.id)+'.xml -xsl ' + userExtension[0].defaultTemplateSet.deilveryorderXSLFile.xslfile.path+' -pdf '+settings.PDF_OUTPUT_ROOT+'deliveryorder_'+str(self.id)+'.pdf"')
+ log.close()
system('bash -c "fop -c '+userExtension[0].defaultTemplateSet.fopConfigurationFile.path+' -xml '+settings.PDF_OUTPUT_ROOT+'invoice_'+str(self.id)+'.xml -xsl ' + userExtension[0].defaultTemplateSet.deilveryorderXSLFile.xslfile.path+' -pdf '+settings.PDF_OUTPUT_ROOT+'deliveryorder_'+str(self.id)+'.pdf"')
- return settings.PDF_OUTPUT_ROOT+"invoice_"+str(self.id)+".pdf"
+ return settings.PDF_OUTPUT_ROOT+"deliveryorder_"+str(self.id)+".pdf"
# TODO: def registerPayment(self, amount, registerpaymentinaccounting):
def __unicode__(self):
@@ -53,7 +53,7 @@
font-weight="bold">Erstelldatum:</fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">Kundennummer:</fo:block>
@@ -62,7 +62,7 @@
text-align="left">Auftragsnummer:</fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">MwSt.-Nummer:</fo:block>
@@ -74,7 +74,7 @@
text-align="left">Zahlbar bis:</fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">Ansprechpartner:</fo:block>
@@ -93,7 +93,7 @@
<xsl:value-of select="substring(object[@model='crm.salescontract']/field[@name='dateofcreation'], 9, 2)"/><xsl:text>.</xsl:text><xsl:value-of select="substring(object[@model='crm.salescontract']/field[@name='dateofcreation'], 6, 2)"/><xsl:text>.</xsl:text><xsl:value-of select="substring(object[@model='crm.salescontract']/field[@name='dateofcreation'], 1, 4)"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">KU-<xsl:value-of select="object[@model='crm.contact']/@pk"/></fo:block>
@@ -102,19 +102,28 @@
text-align="left">AU-<xsl:value-of select="object[@model='crm.salescontract']/field[@name='contract']"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">keine</fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:value-of select="object[@model='djangoUserExtention.templateset']/field[@name='bankingaccountref']"/></fo:block>
+ text-align="left">
+ <xsl:choose>
+ <xsl:when test="object[@model='djangoUserExtention.templateset']/field[@name='bankingaccountref']">
+ <xsl:value-of select="object[@model='djangoUserExtention.templateset']/field[@name='bankingaccountref']"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:leader leader-pattern="space"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left"><xsl:value-of select="substring(object[@model='crm.invoice']/field[@name='payableuntil'], 9, 2)"/><xsl:text>.</xsl:text><xsl:value-of select="substring(object[@model='crm.invoice']/field[@name='payableuntil'], 6, 2)"/><xsl:text>.</xsl:text><xsl:value-of select="substring(object[@model='crm.invoice']/field[@name='payableuntil'], 1, 4)"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left"><xsl:value-of select="object[@model='auth.user']/field[@name='first_name']"/><xsl:text> </xsl:text> <xsl:value-of select="object[@model='auth.user']/field[@name='last_name']"/></fo:block>
View
@@ -52,7 +52,7 @@
font-weight="bold">Erstelldatum:</fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">Kundennummer:</fo:block>
@@ -61,7 +61,7 @@
text-align="left">Auftragsnummer:</fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">MwSt.-Nummer:</fo:block>
@@ -73,7 +73,7 @@
text-align="left">Gültig bis:</fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">Ansprechpartner:</fo:block>
@@ -92,7 +92,7 @@
<xsl:value-of select="substring(object[@model='crm.salescontract']/field[@name='dateofcreation'], 9, 2)"/><xsl:text>.</xsl:text><xsl:value-of select="substring(object[@model='crm.salescontract']/field[@name='dateofcreation'], 6, 2)"/><xsl:text>.</xsl:text><xsl:value-of select="substring(object[@model='crm.salescontract']/field[@name='dateofcreation'], 1, 4)"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">KU-<xsl:value-of select="object[@model='crm.contact']/@pk"/></fo:block>
@@ -101,19 +101,28 @@
text-align="left">AU-<xsl:value-of select="object[@model='crm.salescontract']/field[@name='contract']"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left">keine</fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:value-of select="object[@model='djangoUserExtention.templateset']/field[@name='bankingaccountref']"/></fo:block>
+ text-align="left">
+ <xsl:choose>
+ <xsl:when test="object[@model='djangoUserExtention.templateset']/field[@name='bankingaccountref']">
+ <xsl:value-of select="object[@model='djangoUserExtention.templateset']/field[@name='bankingaccountref']"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:leader leader-pattern="space"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left"><xsl:value-of select="substring(object[@model='crm.quote']/field[@name='validuntil'], 9, 2)"/><xsl:text>.</xsl:text><xsl:value-of select="substring(object[@model='crm.quote']/field[@name='validuntil'], 6, 2)"/><xsl:text>.</xsl:text><xsl:value-of select="substring(object[@model='crm.quote']/field[@name='validuntil'], 1, 4)"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
- text-align="left"><xsl:text> </xsl:text> </fo:block>
+ text-align="left"><fo:leader leader-pattern="space"/></fo:block>
<fo:block font-size="7pt"
font-family="BitstreamVeraSans"
text-align="left"><xsl:value-of select="object[@model='auth.user']/field[@name='first_name']"/><xsl:text> </xsl:text> <xsl:value-of select="object[@model='auth.user']/field[@name='last_name']"/></fo:block>
Oops, something went wrong.

0 comments on commit 053c2b5

Please sign in to comment.