Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index eb3d0a7..334af63 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
import frappe
from erpnext.hooks import regional_overrides
-__version__ = '9.2.10'
+__version__ = '9.2.11'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index ebd45c4..d3f6d38 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -209,10 +209,10 @@
tax_master_doctype = self.meta.get_field("taxes_and_charges").options
- if not self.get("taxes"):
+ if self.is_new() and not self.get("taxes"):
if not self.get("taxes_and_charges"):
# get the default tax master
- self.set("taxes_and_charges", frappe.db.get_value(tax_master_doctype, {"is_default": 1}))
+ self.taxes_and_charges = frappe.db.get_value(tax_master_doctype, {"is_default": 1})
self.append_taxes_from_master(tax_master_doctype)
@@ -608,7 +608,10 @@
@frappe.whitelist()
def get_default_taxes_and_charges(master_doctype):
default_tax = frappe.db.get_value(master_doctype, {"is_default": 1})
- return get_taxes_and_charges(master_doctype, default_tax)
+ return {
+ 'taxes_and_charges': default_tax,
+ 'taxes': get_taxes_and_charges(master_doctype, default_tax)
+ }
@frappe.whitelist()
def get_taxes_and_charges(master_doctype, master_name):
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index 970fd57..e9a7baa 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -48,16 +48,16 @@
# check if customer is already created agains the self.contact_email
customer = frappe.db.sql("""select
distinct `tabDynamic Link`.link_name as customer
- from
+ from
`tabContact`,
`tabDynamic Link`
where `tabContact`.email_id='{0}'
- and
+ and
`tabContact`.name=`tabDynamic Link`.parent
and
- ifnull(`tabDynamic Link`.link_name, '')<>''
- and
- `tabDynamic Link`.link_doctype='Customer'
+ ifnull(`tabDynamic Link`.link_name, '')<>''
+ and
+ `tabDynamic Link`.link_doctype='Customer'
""".format(self.contact_email), as_dict=True)
if customer and customer[0].customer:
self.customer = customer[0].customer
@@ -118,9 +118,9 @@
def has_ordered_quotation(self):
return frappe.db.sql("""
- select q.name
+ select q.name
from `tabQuotation` q, `tabQuotation Item` qi
- where q.name = qi.parent and q.docstatus=1 and qi.prevdoc_docname =%s
+ where q.name = qi.parent and q.docstatus=1 and qi.prevdoc_docname =%s
and q.status = 'Ordered'""", self.name)
def has_lost_quotation(self):
@@ -233,8 +233,8 @@
# get default taxes
taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template")
- if taxes:
- quotation.extend("taxes", taxes)
+ if taxes.get('taxes'):
+ quotation.update(taxes)
quotation.run_method("set_missing_values")
quotation.run_method("calculate_taxes_and_totals")
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 41fdc6e..b07d090 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -231,8 +231,16 @@
},
callback: function(r) {
if(!r.exc) {
- me.frm.set_value("taxes", r.message);
- me.calculate_taxes_and_totals();
+ frappe.run_serially([
+ () => {
+ // directly set in doc, so as not to call triggers
+ me.frm.doc.taxes_and_charges = r.message.taxes_and_charges;
+
+ // set taxes table
+ me.frm.set_value("taxes", r.message.taxes);
+ },
+ () => me.calculate_taxes_and_totals()
+ ]);
}
}
});
@@ -935,19 +943,27 @@
return;
}
+ if (me.in_apply_price_list == true) return;
+
+ me.in_apply_price_list = true;
return this.frm.call({
method: "erpnext.stock.get_item_details.apply_price_list",
args: { args: args },
callback: function(r) {
if (!r.exc) {
- me.in_apply_price_list = true;
- me.frm.set_value("price_list_currency", r.message.parent.price_list_currency);
- me.frm.set_value("plc_conversion_rate", r.message.parent.plc_conversion_rate);
- me.in_apply_price_list = false;
+ frappe.run_serially([
+ () => me.frm.set_value("price_list_currency", r.message.parent.price_list_currency),
+ () => me.frm.set_value("plc_conversion_rate", r.message.parent.plc_conversion_rate),
+ () => {
+ if(args.items.length) {
+ me._set_values_for_item_list(r.message.children);
+ }
+ },
+ () => { me.in_apply_price_list = false; }
+ ]);
- if(args.items.length) {
- me._set_values_for_item_list(r.message.children);
- }
+ } else {
+ me.in_apply_price_list = false;
}
}
});
@@ -1112,11 +1128,11 @@
filters: {'item': item.item_code}
}
} else {
- filters = {
+ let filters = {
'item_code': item.item_code,
'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(),
}
- if(item.warehouse) filters["warehouse"] = item.warehouse
+ if (item.warehouse) filters["warehouse"] = item.warehouse
return {
query : "erpnext.controllers.queries.get_batch_no",