[fix] currency symbol for total amount in JE

This commit is contained in:
Saurabh 2016-10-03 17:14:31 +05:30
parent 7fb79d175f
commit f24d523fc9
4 changed files with 104 additions and 2 deletions

View File

@ -3,16 +3,19 @@
"allow_import": 1,
"allow_rename": 0,
"autoname": "naming_series:",
"beta": 0,
"creation": "2013-03-25 10:53:52",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "entry_type_and_date",
"fieldtype": "Section Break",
"hidden": 0,
@ -38,6 +41,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"fieldname": "title",
"fieldtype": "Data",
@ -64,6 +68,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Journal Entry",
"fieldname": "voucher_type",
"fieldtype": "Select",
@ -92,6 +97,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@ -119,6 +125,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -144,6 +151,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "posting_date",
"fieldtype": "Date",
"hidden": 0,
@ -170,6 +178,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
@ -197,6 +206,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "2_add_edit_gl_entries",
"fieldtype": "Section Break",
"hidden": 0,
@ -223,6 +233,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "accounts",
"fieldtype": "Table",
"hidden": 0,
@ -250,6 +261,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break99",
"fieldtype": "Section Break",
"hidden": 0,
@ -273,6 +285,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "",
"fieldname": "cheque_no",
"fieldtype": "Data",
@ -300,6 +313,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "cheque_date",
"fieldtype": "Date",
"hidden": 0,
@ -326,6 +340,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "user_remark",
"fieldtype": "Small Text",
"hidden": 0,
@ -352,6 +367,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break99",
"fieldtype": "Column Break",
"hidden": 0,
@ -375,6 +391,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "total_debit",
"fieldtype": "Currency",
"hidden": 0,
@ -402,6 +419,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "total_credit",
"fieldtype": "Currency",
"hidden": 0,
@ -429,6 +447,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "difference",
"fieldname": "difference",
"fieldtype": "Currency",
@ -457,6 +476,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "difference",
"fieldname": "get_balance",
"fieldtype": "Button",
@ -483,6 +503,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "multi_currency",
"fieldtype": "Check",
"hidden": 0,
@ -504,10 +525,38 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "total_amount_currency",
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount Currency",
"length": 0,
"no_copy": 1,
"options": "Currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "total_amount",
"fieldtype": "Currency",
"hidden": 1,
@ -518,7 +567,7 @@
"label": "Total Amount",
"length": 0,
"no_copy": 1,
"options": "Company:company:default_currency",
"options": "total_amount_currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -533,6 +582,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "total_amount_in_words",
"fieldtype": "Data",
"hidden": 1,
@ -557,6 +607,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"columns": 0,
"fieldname": "reference",
"fieldtype": "Section Break",
"hidden": 0,
@ -582,6 +633,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "clearance_date",
"fieldtype": "Date",
"hidden": 0,
@ -608,6 +660,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "",
"fieldname": "remark",
"fieldtype": "Small Text",
@ -635,6 +688,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break98",
"fieldtype": "Column Break",
"hidden": 0,
@ -658,6 +712,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "bill_no",
"fieldtype": "Data",
"hidden": 0,
@ -684,6 +739,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "bill_date",
"fieldtype": "Date",
"hidden": 0,
@ -710,6 +766,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "due_date",
"fieldtype": "Date",
"hidden": 0,
@ -736,6 +793,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"columns": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off",
"fieldtype": "Section Break",
@ -762,6 +820,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Accounts Receivable",
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_based_on",
@ -789,6 +848,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "get_outstanding_invoices",
"fieldtype": "Button",
@ -815,6 +875,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_30",
"fieldtype": "Column Break",
"hidden": 0,
@ -839,6 +900,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_amount",
"fieldtype": "Currency",
@ -865,6 +927,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"columns": 0,
"fieldname": "printing_settings",
"fieldtype": "Section Break",
"hidden": 0,
@ -890,6 +953,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "pay_to_recd_from",
"fieldtype": "Data",
"hidden": 0,
@ -914,6 +978,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_35",
"fieldtype": "Column Break",
"hidden": 0,
@ -938,6 +1003,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "letter_head",
"fieldtype": "Link",
"hidden": 0,
@ -963,6 +1029,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"hidden": 0,
@ -990,6 +1057,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"columns": 0,
"fieldname": "addtional_info",
"fieldtype": "Section Break",
"hidden": 0,
@ -1016,6 +1084,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -1041,6 +1110,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "No",
"description": "",
"fieldname": "is_opening",
@ -1070,6 +1140,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:inList([\"Credit Note\", \"Debit Note\"], doc.voucher_type)",
"fieldname": "stock_entry",
"fieldtype": "Link",
@ -1097,6 +1168,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@ -1125,6 +1197,7 @@
"hide_toolbar": 0,
"icon": "icon-file-text",
"idx": 176,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
@ -1132,7 +1205,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-04-06 05:33:21.851581",
"modified": "2016-10-03 10:13:49.458343",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry",
@ -1148,6 +1221,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@ -1168,6 +1242,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@ -1188,6 +1263,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@ -1199,6 +1275,7 @@
"write": 0
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 1,
"search_fields": "voucher_type,posting_date, due_date, cheque_no",

View File

@ -381,6 +381,7 @@ class JournalEntry(AccountsController):
def set_total_amount(self, amt, currency):
self.total_amount = amt
self.total_amount_currency = currency
from frappe.utils import money_in_words
self.total_amount_in_words = money_in_words(amt, currency)

View File

@ -331,3 +331,4 @@ erpnext.patches.v7_0.update_mode_of_payment_type
execute:frappe.reload_doctype("Salary Slip")
execute:frappe.db.sql("update `tabSalary Slip` set posting_date=creation")
erpnext.patches.v7_1.update_portal_roles
erpnext.patches.v7_1.set_total_amount_currency_in_je

View File

@ -0,0 +1,23 @@
import frappe
from erpnext import get_default_currency
def execute():
frappe.reload_doc("accounts", "doctype", "journal_entry")
frappe.db.sql(""" update `tabJournal Entry` set total_amount_currency = %s
where ifnull(multi_currency, 0) = 0
and (pay_to_recd_from is not null or pay_to_recd_from != "") """, get_default_currency())
for je in frappe.db.sql(""" select name from `tabJournal Entry` where multi_currency = 1
and (pay_to_recd_from is not null or pay_to_recd_from != "")""", as_dict=1):
doc = frappe.get_doc("Journal Entry", je.name)
for d in doc.get('accounts'):
if d.party_type and d.party:
total_amount_currency = d.account_currency
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
total_amount_currency = d.account_currency
frappe.db.set_value("Journal Entry", je.name, "total_amount_currency",
total_amount_currency, update_modified=False)