Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index b245f56..0dcb23f 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
import frappe
from erpnext.hooks import regional_overrides
-__version__ = '9.2.2'
+__version__ = '9.2.3'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index 17ac1f7..52d8a2d 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -648,13 +648,13 @@
set_difference_amount: function(frm) {
var unallocated_amount = 0;
+ var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
+ function(d) { return flt(d.amount) }));
+
if(frm.doc.party) {
var party_amount = frm.doc.payment_type=="Receive" ?
frm.doc.paid_amount : frm.doc.received_amount;
- var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
- function(d) { return flt(d.amount) }));
-
if(frm.doc.total_allocated_amount < party_amount) {
if(frm.doc.payment_type == "Receive") {
unallocated_amount = party_amount - (frm.doc.total_allocated_amount - total_deductions);
diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.js b/erpnext/hr/doctype/employee_loan/employee_loan.js
index 33d3a85..1f38105 100644
--- a/erpnext/hr/doctype/employee_loan/employee_loan.js
+++ b/erpnext/hr/doctype/employee_loan/employee_loan.js
@@ -87,22 +87,24 @@
},
employee_loan_application: function (frm) {
- return frappe.call({
- method: "erpnext.hr.doctype.employee_loan.employee_loan.get_employee_loan_application",
- args: {
- "employee_loan_application": frm.doc.employee_loan_application
- },
- callback: function (r) {
- if (!r.exc && r.message) {
- frm.set_value("loan_type", r.message.loan_type);
- frm.set_value("loan_amount", r.message.loan_amount);
- frm.set_value("repayment_method", r.message.repayment_method);
- frm.set_value("monthly_repayment_amount", r.message.repayment_amount);
- frm.set_value("repayment_periods", r.message.repayment_periods);
- frm.set_value("rate_of_interest", r.message.rate_of_interest);
- }
- }
- })
+ if(frm.doc.employee_loan_application){
+ return frappe.call({
+ method: "erpnext.hr.doctype.employee_loan.employee_loan.get_employee_loan_application",
+ args: {
+ "employee_loan_application": frm.doc.employee_loan_application
+ },
+ callback: function (r) {
+ if (!r.exc && r.message) {
+ frm.set_value("loan_type", r.message.loan_type);
+ frm.set_value("loan_amount", r.message.loan_amount);
+ frm.set_value("repayment_method", r.message.repayment_method);
+ frm.set_value("monthly_repayment_amount", r.message.repayment_amount);
+ frm.set_value("repayment_periods", r.message.repayment_periods);
+ frm.set_value("rate_of_interest", r.message.rate_of_interest);
+ }
+ }
+ });
+ }
},
repayment_method: function (frm) {
diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py
index 686fe8d..8efbed8 100644
--- a/erpnext/hub_node/__init__.py
+++ b/erpnext/hub_node/__init__.py
@@ -34,7 +34,9 @@
return response
@frappe.whitelist()
-def get_item_details(hub_sync_id):
+def get_item_details(hub_sync_id=None):
+ if not hub_sync_id:
+ return
connection = get_connection()
return connection.get_doc('Hub Item', hub_sync_id)
diff --git a/erpnext/hub_node/page/hub/hub.js b/erpnext/hub_node/page/hub/hub.js
index 143f554..297a4d1 100644
--- a/erpnext/hub_node/page/hub/hub.js
+++ b/erpnext/hub_node/page/hub/hub.js
@@ -382,6 +382,7 @@
},
method: "erpnext.hub_node.get_item_details",
callback: (r) => {
+ if (!r || !r.message) return;
let item = r.message;
this.item_cache[item_code] = item;
this.render_item_page(item);
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index fa21a3d..747a3c0 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -477,9 +477,11 @@
target.qty = flt(source.qty) - flt(source.delivered_qty)
item = frappe.db.get_value("Item", target.item_code, ["item_group", "selling_cost_center"], as_dict=1)
- target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \
- or item.selling_cost_center \
- or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
+
+ if item:
+ target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \
+ or item.selling_cost_center \
+ or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
target_doc = get_mapped_doc("Sales Order", source_name, {
"Sales Order": {
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 4b4f15b..bf8eaba 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -57,7 +57,7 @@
if not self.description:
self.description = self.item_name
- if self.is_sales_item and not self.is_item_from_hub:
+ if self.is_sales_item and not self.get('is_item_from_hub'):
self.publish_in_hub = 1
def after_insert(self):
diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py
index ab73b34..6a18f11 100644
--- a/erpnext/support/doctype/issue/issue.py
+++ b/erpnext/support/doctype/issue/issue.py
@@ -32,7 +32,7 @@
if email_id:
if not self.lead:
self.lead = frappe.db.get_value("Lead", {"email_id": email_id})
- if not self.contact:
+ if not self.contact and not self.customer:
self.contact = frappe.db.get_value("Contact", {"email_id": email_id})
if self.contact: