From 12fd8a60477ca1dddb982f689a0a18f1d81ee1a4 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 21 Sep 2017 14:39:10 +0530 Subject: [PATCH 1/4] [fix] User not able to complete the production order because of decimal issue (#10868) --- .../manufacturing/doctype/production_order/production_order.js | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index 33acb41d4b..c3e6f20b64 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -346,6 +346,7 @@ erpnext.production_order = { 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) { From 3d5d858933f1b71b9591784b264a7e0ac1e5e4e2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 21 Sep 2017 16:15:30 +0530 Subject: [PATCH 2/4] set total in tax table if category not valuation and consider deductions (#10870) --- erpnext/public/js/controllers/taxes_and_totals.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index d042bb7220..d1eb534b3b 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -285,12 +285,14 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ }, 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)); } }, From e4be3f8dc9ffc041b7ef8ff05b7f37efc3ebd657 Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Thu, 21 Sep 2017 13:57:33 +0100 Subject: [PATCH 3/4] use generator when updating and notify user of long process (#10777) --- erpnext/setup/doctype/company/company.js | 3 ++- erpnext/setup/doctype/company/company.py | 25 ++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index 8c814e3de8..2822dd0fa0 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -111,8 +111,9 @@ cur_frm.cscript.change_abbr = function() { 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 b945ee4104..849e6f9886 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -282,6 +282,13 @@ class Company(Document): 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 @@ def replace_abbr(company, old, new): 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(" - ") From 7da3c46ef2a667ac526e093a7af99b570cc2a8e2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 25 Sep 2017 16:33:29 +0600 Subject: [PATCH 4/4] bumped to version 8.11.5 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 61381b2703..c434021fdf 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect 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'''