diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 77842d0b5c7..f283506b243 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1166,6 +1166,8 @@ class SalesInvoice(SellingController): self.set_missing_values(for_validate = True) def validate_inter_company_party(doctype, party, company, inter_company_invoice_reference): + if not party: + return if doctype == "Sales Invoice": partytype, ref_partytype, internal = "Customer", "Supplier", "is_internal_customer" ref_doc = "Purchase Invoice" diff --git a/erpnext/hr/doctype/loan/loan.js b/erpnext/hr/doctype/loan/loan.js index b4013242b50..3024f28207a 100644 --- a/erpnext/hr/doctype/loan/loan.js +++ b/erpnext/hr/doctype/loan/loan.js @@ -146,7 +146,7 @@ frappe.ui.form.on('Loan', { 'payment_date': payment.payment_date, 'principal_amount': payment.principal_amount, 'interest_amount': payment.interest_amount, - 'total_payment': payment.total_payment + 'total_payment': payment.total_payment }); dialog.fields_dict.payments.grid.refresh(); $(dialog.wrapper.find(".grid-buttons")).hide(); @@ -172,18 +172,20 @@ frappe.ui.form.on('Loan', { }, mode_of_payment: function (frm) { - frappe.call({ - method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account", - args: { - "mode_of_payment": frm.doc.mode_of_payment, - "company": frm.doc.company - }, - callback: function (r, rt) { - if (r.message) { - frm.set_value("payment_account", r.message.account); + if (frm.doc.mode_of_payment && frm.doc.company) { + frappe.call({ + method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account", + args: { + "mode_of_payment": frm.doc.mode_of_payment, + "company": frm.doc.company + }, + callback: function (r, rt) { + if (r.message) { + frm.set_value("payment_account", r.message.account); + } } - } - }); + }); + } }, loan_application: function (frm) { diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index b2e7e2f347d..aab125fa923 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -64,7 +64,7 @@ class Project(Document): 'name': ("not in", self.deleted_task_list) }) - return frappe.get_all("Task", "*", filters, order_by="exp_start_date asc") + return frappe.get_all("Task", "*", filters, order_by="exp_start_date asc, status asc") def validate(self): self.validate_project_name()