begin to fix bill view
This commit is contained in:
parent
11de455d23
commit
662e706eab
2 changed files with 6 additions and 12 deletions
|
@ -47,7 +47,9 @@ class BillAdmin(admin.ModelAdmin):
|
|||
raise self._get_404_exception(object_id)
|
||||
|
||||
output_file = NamedTemporaryFile()
|
||||
bill_html = render_to_string("bill.html.j2", {'bill': bill})
|
||||
bill_html = render_to_string("bill.html.j2", {'bill': bill,
|
||||
'bill_records': bill.bill_records.all()
|
||||
})
|
||||
|
||||
bytestring_to_pdf(bill_html.encode('utf-8'), output_file)
|
||||
response = FileResponse(output_file, content_type="application/pdf")
|
||||
|
|
|
@ -717,19 +717,11 @@ oAsAAAAAAACGQNAFAAAAAAAAQyDoAgAAAAAAgCEQdAEAAAAAAMAQCLoAAAAAAABgCP83AL6WQ1Y7
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for record in bill.records %}
|
||||
{% for record in bill_records %}
|
||||
<tr class="table-list">
|
||||
<td>{{ record.description }}</td>
|
||||
<td>
|
||||
{{ record.recurring_price }} * {{ record.recurring_count }}
|
||||
{{ record.recurring_period }}
|
||||
{% if record.one_time_price != 0 %}
|
||||
+ one time {{ record.one_time_price }}
|
||||
{% endif %}
|
||||
<td>A</td>
|
||||
<td>{{ record.quantity }}
|
||||
</td>
|
||||
<td>{{ record.amount }}</td>
|
||||
<td>{{ record.vat_amount }} ({{ record.vat_rate }})</td>
|
||||
<td class="tr">{{ record.total }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in a new issue