[fix] total amount in journal entry
This commit is contained in:
parent
131bec67bc
commit
b82bdd6f1f
@ -339,15 +339,17 @@ class JournalEntry(AccountsController):
|
|||||||
self.remark = ("\n").join(r) #User Remarks is not mandatory
|
self.remark = ("\n").join(r) #User Remarks is not mandatory
|
||||||
|
|
||||||
def set_print_format_fields(self):
|
def set_print_format_fields(self):
|
||||||
|
total_amount = 0.0
|
||||||
for d in self.get('accounts'):
|
for d in self.get('accounts'):
|
||||||
if d.party_type and d.party:
|
if d.party_type and d.party:
|
||||||
if not self.pay_to_recd_from:
|
if not self.pay_to_recd_from:
|
||||||
self.pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
|
self.pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
|
||||||
"customer_name" if d.party_type=="Customer" else "supplier_name")
|
"customer_name" if d.party_type=="Customer" else "supplier_name")
|
||||||
|
|
||||||
self.set_total_amount(d.debit or d.credit)
|
|
||||||
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
|
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
|
||||||
self.set_total_amount(d.debit or d.credit)
|
total_amount += (d.debit or d.credit)
|
||||||
|
|
||||||
|
self.set_total_amount(total_amount)
|
||||||
|
|
||||||
def set_total_amount(self, amt):
|
def set_total_amount(self, amt):
|
||||||
self.total_amount = amt
|
self.total_amount = amt
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
{%- from "templates/print_formats/standard_macros.html" import add_header -%}
|
||||||
|
<div class="page-break">
|
||||||
|
{%- if not doc.get("print_heading") and not doc.get("select_print_heading")
|
||||||
|
and doc.set("select_print_heading", _("Payment Receipt Note")) -%}{%- endif -%}
|
||||||
|
{{ add_header(0, 1, doc, letter_head, no_letterhead) }}
|
||||||
|
|
||||||
|
{%- for label, value in (
|
||||||
|
(_("Received On"), frappe.utils.formatdate(doc.voucher_date)),
|
||||||
|
(_("Received From"), doc.pay_to_recd_from),
|
||||||
|
(_("Amount"), "<strong>" + doc.get_formatted("total_amount") + "</strong><br>" + (doc.total_amount_in_words or "") + "<br>"),
|
||||||
|
(_("Remarks"), doc.remark)
|
||||||
|
) -%}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-3"><label class="text-right">{{ label }}</label></div>
|
||||||
|
<div class="col-xs-9">{{ value }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{%- endfor -%}
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<br>
|
||||||
|
<p class="strong">
|
||||||
|
{{ _("For") }} {{ doc.company }},<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
{{ _("Authorized Signatory") }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
@ -1,15 +1,17 @@
|
|||||||
{
|
{
|
||||||
"creation": "2012-05-01 12:46:31",
|
"creation": "2012-05-01 12:46:31",
|
||||||
"doc_type": "Journal Entry",
|
"custom_format": 0,
|
||||||
"docstatus": 0,
|
"disabled": 0,
|
||||||
"doctype": "Print Format",
|
"doc_type": "Journal Entry",
|
||||||
"html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Payment Receipt Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Received On\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Received From\"), doc.pay_to_recd_from),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n <div class=\"row\">\n <div class=\"col-xs-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n",
|
"docstatus": 0,
|
||||||
"idx": 1,
|
"doctype": "Print Format",
|
||||||
"modified": "2015-01-16 11:03:22.893209",
|
"html": "",
|
||||||
"modified_by": "Administrator",
|
"idx": 1,
|
||||||
"module": "Accounts",
|
"modified": "2015-11-25 07:06:00.668141",
|
||||||
"name": "Payment Receipt Voucher",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator",
|
"name": "Payment Receipt Voucher",
|
||||||
"print_format_type": "Server",
|
"owner": "Administrator",
|
||||||
|
"print_format_builder": 0,
|
||||||
|
"print_format_type": "Server",
|
||||||
"standard": "Yes"
|
"standard": "Yes"
|
||||||
}
|
}
|
@ -235,3 +235,4 @@ execute:frappe.delete_doc_if_exists("DocType", "Stock UOM Replace Utility")
|
|||||||
erpnext.patches.v6_8.make_webform_standard #2015-11-23
|
erpnext.patches.v6_8.make_webform_standard #2015-11-23
|
||||||
erpnext.patches.v6_8.move_drop_ship_to_po_items
|
erpnext.patches.v6_8.move_drop_ship_to_po_items
|
||||||
erpnext.patches.v6_10.fix_ordered_received_billed
|
erpnext.patches.v6_10.fix_ordered_received_billed
|
||||||
|
erpnext.patches.v6_10.fix_jv_total_amount
|
||||||
|
13
erpnext/patches/v6_10/fix_jv_total_amount.py
Normal file
13
erpnext/patches/v6_10/fix_jv_total_amount.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
# patch all for-print field (total amount) in Journal Entry in 2015
|
||||||
|
def execute():
|
||||||
|
for je in frappe.get_all("Journal Entry", filters={"creation": (">", "2015-01-01")}):
|
||||||
|
je = frappe.get_doc("Journal Entry", je.name)
|
||||||
|
original = je.total_amount
|
||||||
|
|
||||||
|
je.set_print_format_fields()
|
||||||
|
|
||||||
|
if je.total_amount != original:
|
||||||
|
je.db_set("total_amount", je.total_amount, update_modified=False)
|
||||||
|
je.db_set("total_amount_in_words", je.total_amount_in_words, update_modified=False)
|
Loading…
Reference in New Issue
Block a user