fix: removed before from accounts_controlle.pyr and fetch the gl from frontend

This commit is contained in:
Anurag Mishra 2019-04-05 14:33:05 +05:30
parent b62cfffdea
commit ed82e8ba3b
5 changed files with 16 additions and 18 deletions

View File

@ -7,6 +7,7 @@
</style>
<div class="page-break">
{% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %}
{%- if not doc.get("print_heading") and not doc.get("select_print_heading")
and doc.set("select_print_heading", _("Payment Entry")) -%}{%- endif -%}
{{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
@ -33,7 +34,7 @@
<tr>
<td class="top-bottom" colspan="5"><strong>Debit</strong></td>
</tr>
{% for entries in doc.gl_entries %}
{% for entries in gl %}
{% if entries.credit == 0.0 %}
<tr>
<td class="right top-bottom">{{ entries.account }}</td>
@ -48,12 +49,12 @@
{% endfor %}
<tr>
<td class="right" colspan="3" ><strong>Total (debit) </strong></td>
<td class="left" >{{ doc.gl_entries | sum(attribute='debit') }}</td>
<td class="left" >{{ gl | sum(attribute='debit') }}</td>
</tr>
<tr>
<td class="top-bottom" colspan="5"><strong>Credit</strong></td>
</tr>
{% for entries in doc.gl_entries %}
{% for entries in gl %}
{% if entries.debit == 0.0 %}
<tr>
<td class="right top-bottom">{{ entries.account }}</td>
@ -68,7 +69,7 @@
{% endfor %}
<tr>
<td class="right" colspan="3"><strong>Total (credit) </strong></td>
<td class="left" >{{ doc.gl_entries | sum(attribute='credit') }}</td>
<td class="left" >{{ gl | sum(attribute='credit') }}</td>
</tr>
</table>
<div>

View File

@ -5,6 +5,7 @@
.table-bordered td.left{border-left: none !important;}
</style>
<div class="page-break">
{% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %}
{%- if not doc.get("print_heading") and not doc.get("select_print_heading")
and doc.set("select_print_heading", _("Journal Entry")) -%}{%- endif -%}
{{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
@ -31,7 +32,7 @@
<tr>
<td class="top-bottom" colspan="5"><strong>Debit</strong></td>
</tr>
{% for entries in doc.gl_entries %}
{% for entries in gl %}
{% if entries.credit == 0.0 %}
<tr>
<td class="right top-bottom">{{ entries.account }}</td>
@ -43,12 +44,12 @@
{% endfor %}
<tr>
<td class="right" colspan="3" ><strong>Total (debit) </strong></td>
<td class="left" >{{ doc.gl_entries | sum(attribute='debit') }}</td>
<td class="left" >{{ gl | sum(attribute='debit') }}</td>
</tr>
<tr>
<td class="top-bottom" colspan="5"><strong>Credit</strong></td>
</tr>
{% for entries in doc.gl_entries %}
{% for entries in gl %}
{% if entries.debit == 0.0 %}
<tr>
<td class="right top-bottom">{{ entries.account }}</td>
@ -60,10 +61,10 @@
{% endfor %}
<tr>
<td class="right" colspan="3"><strong>Total (credit) </strong></td>
<td class="left" >{{ doc.gl_entries | sum(attribute='credit') }}</td>
<td class="left" >{{ gl | sum(attribute='credit') }}</td>
</tr>
<tr>
<td class="top-bottom" colspan="5"><b>Narration: </b>{{ doc.gl_entries[0].remarks }}</td>
<td class="top-bottom" colspan="5"><b>Narration: </b>{{ gl[0].remarks }}</td>
</tr>
</table>
<div>

View File

@ -1,5 +1,6 @@
{%- from "templates/print_formats/standard_macros.html" import add_header -%}
<div class="page-break">
{% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %}
{%- if not doc.get("print_heading") and not doc.get("select_print_heading")
and doc.set("select_print_heading", _("Purchase Invoice")) -%}{%- endif -%}
{{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
@ -62,7 +63,7 @@
{% for tax in doc.taxes %}
{% if tax.tax_amount_after_discount_amount!= 0 %}
<tr><td><strong>{{ tax.account_head }}: </strong></td><td>{{ tax.tax_amount_after_discount_amount }}</td></tr>
{% endif %}
{% endfor %}
{% if doc.taxes_and_charges_added!= 0 %}
<tr><td><strong> Taxes and Charges Added: </strong></td><td>{{ doc.taxes_and_charges_added }}</td></tr>
@ -85,7 +86,7 @@
<th>Debit Amount</th>
<th>Credit Amount</th>
</tr>
{% for entries in doc.gl_entries %}
{% for entries in gl %}
<tr>
<td>{{ loop.index }}</td>
<td>{{ entries.account }}</td>

View File

@ -1,5 +1,6 @@
{%- from "templates/print_formats/standard_macros.html" import add_header -%}
<div class="page-break">
{% set gl = frappe.get_list(doctype="GL Entry", fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %}
{%- if not doc.get("print_heading") and not doc.get("select_print_heading")
and doc.set("select_print_heading", _("Sales Invoice")) -%}{%- endif -%}
{{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
@ -75,7 +76,7 @@
<th>Debit Amount</th>
<th>Credit Amount</th>
</tr>
{% for entries in doc.gl_entries %}
{% for entries in gl %}
<tr>
<td>{{ loop.index }}</td>
<td>{{ entries.account }}</td>

View File

@ -119,12 +119,6 @@ class AccountsController(TransactionBase):
self.validate_non_invoice_documents_schedule()
def before_print(self):
if self.doctype in ['Journal Entry', 'Payment Entry', 'Sales Invoice', 'Purchase Invoice']:
self.gl_entries = frappe.get_list("GL Entry", filters={
"voucher_type": self.doctype,
"voucher_no": self.name
}, fields=["account", "party_type", "party", "debit", "credit", "remarks"])
if self.doctype in ['Purchase Order', 'Sales Order', 'Sales Invoice', 'Purchase Invoice',
'Supplier Quotation', 'Purchase Receipt', 'Delivery Note', 'Quotation']:
if self.get("group_same_items"):