diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index b9b8fc2968..34d9de7064 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -514,7 +514,7 @@ class JournalEntry(AccountsController): def update_expense_claim(self): for d in self.accounts: - if d.reference_type=="Expense Claim" and d.party: + if d.reference_type=="Expense Claim" and d.reference_name: doc = frappe.get_doc("Expense Claim", d.reference_name) update_reimbursed_amount(doc) diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index 496120888d..95877cf032 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -18,14 +18,20 @@ erpnext.hr.ExpenseClaimController = frappe.ui.form.Controller.extend({ }); }, - expense_type: function(frm, cdt, cdn) { + expense_type: function(doc, cdt, cdn) { var d = locals[cdt][cdn]; + if(!doc.company) { + d.expense_type = ""; + frappe.msgprint(__("Please set the Company")); + this.frm.refresh_fields() + return; + } return frappe.call({ method: "erpnext.hr.doctype.expense_claim.expense_claim.get_expense_claim_account", args: { "expense_claim_type": d.expense_type, - "company": frm.company + "company": doc.company }, callback: function(r) { if (r.message) { diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 111cd65dc2..d68a1d82a5 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -389,3 +389,4 @@ erpnext.patches.v8_0.rename_is_sample_item_to_allow_zero_valuation_rate erpnext.patches.v8_0.set_null_to_serial_nos_for_disabled_sales_invoices erpnext.patches.v8_0.enable_booking_asset_depreciation_automatically erpnext.patches.v8_0.set_project_copied_from +erpnext.patches.v8_0.update_status_as_paid_for_completed_expense_claim diff --git a/erpnext/patches/v8_0/update_status_as_paid_for_completed_expense_claim.py b/erpnext/patches/v8_0/update_status_as_paid_for_completed_expense_claim.py new file mode 100644 index 0000000000..644b8cd035 --- /dev/null +++ b/erpnext/patches/v8_0/update_status_as_paid_for_completed_expense_claim.py @@ -0,0 +1,17 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + """ set status as Paid in Expense Claim if total_sactioned_amount + and total_amount_reimbursed is equal """ + + frappe.db.sql(""" + update + `tabExpense Claim` + set status = 'Paid' + where + total_sanctioned_amount = total_amount_reimbursed + """) \ No newline at end of file