From 4cf46edabc4754d765aedbea3b56d70fcbdbe055 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Thu, 21 Jun 2018 15:18:13 +0530 Subject: [PATCH 1/2] expense_claim related fix in payment entry outstanding amount calculation fix, manual entry of expense trigger calculation of allocation added --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 5 +++++ erpnext/accounts/doctype/payment_entry/payment_entry.py | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index fc3eed36e9..c353e5eab7 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -832,6 +832,11 @@ frappe.ui.form.on('Payment Entry Reference', { $.each(r.message, function(field, value) { frappe.model.set_value(cdt, cdn, field, value); }) + + let allocated_amount = frm.doc.unallocated_amount > row.outstanding_amount ? + row.outstanding_amount : frm.doc.unallocated_amount; + + frappe.model.set_value(cdt, cdn, 'allocated_amount', allocated_amount); frm.refresh_fields(); } } diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 4e998596b0..9d5adda507 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -725,8 +725,11 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre exchange_rate = ref_doc.get("conversion_rate") or \ get_exchange_rate(party_account_currency, company_currency, ref_doc.posting_date) - if reference_doctype in ("Sales Invoice", "Purchase Invoice", "Expense Claim"): + if reference_doctype in ("Sales Invoice", "Purchase Invoice"): outstanding_amount = ref_doc.get("outstanding_amount") + elif reference_doctype == "Expense Claim": + outstanding_amount = flt(ref_doc.get("total_sanctioned_amount")) \ + - flt(ref_doc.get("total_amount+reimbursed")) - flt(ref_doc.get("total_advance_amount")) elif reference_doctype == "Employee Advance": outstanding_amount = ref_doc.advance_amount - flt(ref_doc.paid_amount) else: From 774f676a2599c835d35a31481c29e8f4d7130423 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Fri, 22 Jun 2018 05:10:27 +0000 Subject: [PATCH 2/2] bumped to version 10.1.40 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d6d575785d..49405228e4 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.39' +__version__ = '10.1.40' def get_default_company(user=None): '''Get default company for user'''