Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed profit loss statement export and fixed english default template…

… file
  • Loading branch information...
commit 224833c2b456c3838677736c2303ad8f7f162fd3 1 parent 940106e
@scaphilo authored
View
18 accounting/models.py
@@ -126,15 +126,17 @@ def createBalanceSheetPDF(self, raisedbyuser):
def createProfitLossStatementPDF(self, raisedbyuser):
userExtension = djangoUserExtension.models.UserExtension.objects.filter(user=raisedbyuser.id)
- out = open("/tmp/profitlossstatement_"+str(self.id)+".xml","w")
+ if (len(userExtension) == 0):
+ raise UserExtensionMissing(_("During BalanceSheet PDF Export"))
+ out = open(settings.PDF_OUTPUT_ROOT+"profitlossstatement_"+str(self.id)+".xml", "w")
doc = Document()
main = doc.createElement("koalixaccountingprofitlossstatement")
accountingPeriodName = doc.createElement("accountingPeriodName")
accountingPeriodName.appendChild(doc.createTextNode(self.__unicode__()))
main.appendChild(accountingPeriodName)
- organisiationname = doc.createElement("organisiationname")
- organisiationname.appendChild(doc.createTextNode(settings.MEDIA_ROOT+userExtension[0].defaultTemplateSet.organisiationname))
- main.appendChild(organisiationname)
+ organisationname = doc.createElement("organisiationname")
+ organisationname.appendChild(doc.createTextNode(settings.MEDIA_ROOT+userExtension[0].defaultTemplateSet.organisationname))
+ main.appendChild(organisationname)
accountingPeriodTo = doc.createElement("accountingPeriodTo")
accountingPeriodTo.appendChild(doc.createTextNode(self.end.year.__str__()))
main.appendChild(accountingPeriodTo)
@@ -172,11 +174,11 @@ def createProfitLossStatementPDF(self, raisedbyuser):
doc.appendChild(main)
out.write(doc.toxml("utf-8"))
out.close()
- log = open("/tmp/log.txt", "w")
- log.write('bash -c "fop -c '+settings.MEDIA_ROOT+userExtension[0].defaultTemplateSet.fopConfigurationFile.path+' -xml /tmp/profitlossstatement_'+str(self.id)+'.xml -xsl ' + settings.MEDIA_ROOT+userExtension[0].defaultTemplateSet.profitLossStatementXSLFile.xslfile.path+' -pdf /tmp/profitlossstatement_'+str(self.id)+'.pdf"')
+ 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+'profitlossstatement_'+str(self.id)+'.xml -xsl ' + userExtension[0].defaultTemplateSet.profitLossStatementXSLFile.xslfile.path+' -pdf '+settings.PDF_OUTPUT_ROOT+'profitlossstatement_'+str(self.id)+'.pdf"')
log.close()
- system('bash -c "fop -c '+settings.MEDIA_ROOT+userExtension[0].defaultTemplateSet.fopConfigurationFile.path+' -xml /tmp/profitlossstatement_'+str(self.id)+'.xml -xsl ' + settings.MEDIA_ROOT+userExtension[0].defaultTemplateSet.profitLossStatementXSLFile.xslfile.path+' -pdf /tmp/profitlossstatement_'+str(self.id)+'.pdf"')
- return "/tmp/profitlossstatement_"+str(self.id)+".pdf"
+ system ('bash -c "fop -c '+userExtension[0].defaultTemplateSet.fopConfigurationFile.path+' -xml '+settings.PDF_OUTPUT_ROOT+'profitlossstatement_'+str(self.id)+'.xml -xsl ' + userExtension[0].defaultTemplateSet.profitLossStatementXSLFile.xslfile.path+' -pdf '+settings.PDF_OUTPUT_ROOT+'profitlossstatement_'+str(self.id)+'.pdf"')
+ return settings.PDF_OUTPUT_ROOT+"profitlossstatement_"+str(self.id)+".pdf"
def __unicode__(self):
return self.title
View
2  accounting/views.py
@@ -17,7 +17,7 @@ def createBalanceSheetPDF(request, calculationunitid):
def createProfitLossStatementPDF(request, calculationunitid):
try:
- accountingPeriod = AccountingPeriod.objects.get(id=quoteid)
+ accountingPeriod = AccountingPeriod.objects.get(id=calculationunitid)
pdf = accountingPeriod.createProfitLossStatementPDF(request.user)
response = HttpResponse(FileWrapper(file(pdf)), mimetype='application/pdf')
response['Content-Length'] = path.getsize(pdf)
View
17 crm/admin.py
@@ -5,6 +5,7 @@
from datetime import date
from crm.models import *
from crm.views import *
+from accounting.models import Booking
from plugin import *
from django.utils.translation import ugettext as _
from django.contrib import admin
@@ -235,7 +236,17 @@ class PurchaseOrderInlinePosition(admin.TabularInline):
}),
)
allow_add = True
-
+
+class InlineBookings(admin.TabularInline):
+ model = Booking
+ extra = 1
+ classes = ('collapse-open',)
+ fieldsets = (
+ ('Basics', {
+ 'fields': ('fromAccount', 'toAccount', 'description', 'amount', 'bookingDate', 'staff', 'bookingReference',)
+ }),
+ )
+ allow_add = False
class OptionInvoice(admin.ModelAdmin):
list_display = ('id', 'description', 'contract', 'customer', 'payableuntil', 'status', 'currency', 'staff', 'lastCalculatedPrice', 'lastPricingDate', 'lastmodification', 'lastmodifiedby')
@@ -249,7 +260,7 @@ class OptionInvoice(admin.ModelAdmin):
}),
)
save_as = True
- inlines = [SalesContractInlinePosition, SalesContractPostalAddress, SalesContractPhoneAddress, SalesContractEmailAddress]
+ inlines = [SalesContractInlinePosition, SalesContractPostalAddress, SalesContractPhoneAddress, SalesContractEmailAddress, InlineBookings]
pluginProcessor = PluginProcessor()
inlines.extend(pluginProcessor.getPluginAdditions("invoiceInlines"))
@@ -303,7 +314,7 @@ def registerPaymentInAccounting(self, request, queryset):
actions = ['recalculatePrices', 'createDeliveryOrderPDF', 'createInvoicePDF', 'registerInvoiceInAccounting', 'unregisterInvoiceInAccounting', 'registerPaymentInAccounting']
pluginProcessor = PluginProcessor()
- inlines.extend(pluginProcessor.getPluginAdditions("invoiceActions"))
+ actions.extend(pluginProcessor.getPluginAdditions("invoiceActions"))
class OptionQuote(admin.ModelAdmin):
View
14 templatefiles/en/profitlossstatement.xsl
@@ -42,7 +42,7 @@
color="black"
text-align="left"
font-weight="bold">
- Erfolgsrechnung der koalix Riedener
+ Profit / Loss Statement of the <xsl:value-of select="organisationname"/>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after" >
@@ -67,7 +67,7 @@
<fo:block font-size="8pt"
font-family="BitstreamVeraSans"
font-weight="bold"
- text-align="end">Seite <fo:page-number/>/<fo:page-number-citation ref-id="last-page"/></fo:block>
+ text-align="end">Page <fo:page-number/>/<fo:page-number-citation ref-id="last-page"/></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
@@ -78,7 +78,7 @@
<fo:block font-size="9pt"
font-family="BitstreamVeraSans"
text-align="left"
- line-height="13pt" >Ertrag</fo:block>
+ line-height="13pt" >Earnings</fo:block>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="11cm"/>
@@ -86,17 +86,17 @@
<fo:table-header font-size="9pt" line-height="9pt" font-weight="bold" font-family="BitstreamVeraSans">
<fo:table-cell border-color="black" border-style="solid" border-width="0.5pt" padding="2.5pt">
<fo:block text-align="start" >
- Kontonummer
+ Account Number
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="0.5pt" padding="2.5pt">
<fo:block text-align="start" >
- Konto
+ Account
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="0.5pt" padding="2.5pt">
<fo:block text-align="end" >
- Wert
+ Value
</fo:block>
</fo:table-cell>
</fo:table-header>
@@ -133,7 +133,7 @@
font-family="BitstreamVeraSans"
text-align="left"
line-height="13pt"
- padding-top="0.7cm">Aufwand</fo:block>
+ padding-top="0.7cm">Spendings</fo:block>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="11cm"/>
Please sign in to comment.
Something went wrong with that request. Please try again.