Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 61381b2..c434021 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
import frappe
from erpnext.hooks import regional_overrides
-__version__ = '8.11.4'
+__version__ = '8.11.5'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index 33acb41..c3e6f20 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -346,6 +346,7 @@
var max = flt(frm.doc.qty) - flt(frm.doc.produced_qty);
}
+ max = flt(max, precision("qty"));
frappe.prompt({fieldtype:"Float", label: __("Qty for {0}", [purpose]), fieldname:"qty",
description: __("Max: {0}", [max]), 'default': max },
function(data) {
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index d042bb7..d1eb534 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -285,12 +285,14 @@
},
set_cumulative_total: function(row_idx, tax) {
+ var tax_amount = (in_list(["Valuation and Total", "Total"], tax.category) ?
+ tax.tax_amount_after_discount_amount : 0);
+ if (tax.add_deduct_tax == "Deduct") { tax_amount = -1*tax_amount; }
+
if(row_idx==0) {
- tax.total = flt(this.frm.doc.net_total + tax.tax_amount_after_discount_amount,
- precision("total", tax));
+ tax.total = flt(this.frm.doc.net_total + tax_amount, precision("total", tax));
} else {
- tax.total = flt(this.frm.doc["taxes"][row_idx-1].total + tax.tax_amount_after_discount_amount,
- precision("total", tax));
+ tax.total = flt(this.frm.doc["taxes"][row_idx-1].total + tax_amount, precision("total", tax));
}
},
diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js
index 8c814e3..2822dd0 100644
--- a/erpnext/setup/doctype/company/company.js
+++ b/erpnext/setup/doctype/company/company.js
@@ -111,8 +111,9 @@
dialog.fields_dict.update.$input.click(function() {
var args = dialog.get_values();
if(!args) return;
+ frappe.show_alert(__("Update in progress. It might take a while."));
return frappe.call({
- method: "erpnext.setup.doctype.company.company.replace_abbr",
+ method: "erpnext.setup.doctype.company.company.enqueue_replace_abbr",
args: {
"company": cur_frm.doc.name,
"old": cur_frm.doc.abbr,
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index b945ee4..849e6f9 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -282,6 +282,13 @@
where doctype='Global Defaults' and field='default_company'
and value=%s""", self.name)
+
+@frappe.whitelist()
+def enqueue_replace_abbr(company, old, new):
+ kwargs = dict(company=company, old=old, new=new)
+ frappe.enqueue('erpnext.setup.doctype.company.company.replace_abbr', **kwargs)
+
+
@frappe.whitelist()
def replace_abbr(company, old, new):
new = new.strip()
@@ -292,16 +299,22 @@
frappe.db.set_value("Company", company, "abbr", new)
- def _rename_record(dt):
- for d in frappe.db.sql("select name from `tab%s` where company=%s" % (dt, '%s'), company):
- parts = d[0].rsplit(" - ", 1)
- if len(parts) == 1 or parts[1].lower() == old.lower():
- frappe.rename_doc(dt, d[0], parts[0] + " - " + new)
+ def _rename_record(doc):
+ parts = doc[0].rsplit(" - ", 1)
+ if len(parts) == 1 or parts[1].lower() == old.lower():
+ frappe.rename_doc(dt, doc[0], parts[0] + " - " + new)
+
+ def _rename_records(dt):
+ # rename is expensive so let's be economical with memory usage
+ doc = (d for d in frappe.db.sql("select name from `tab%s` where company=%s" % (dt, '%s'), company))
+ for d in doc:
+ _rename_record(d)
for dt in ["Warehouse", "Account", "Cost Center"]:
- _rename_record(dt)
+ _rename_records(dt)
frappe.db.commit()
+
def get_name_with_abbr(name, company):
company_abbr = frappe.db.get_value("Company", company, "abbr")
parts = name.split(" - ")