From 26c3240b67d45f029b5730721932aef70f34e65a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 23 Aug 2013 12:21:52 +0530 Subject: [PATCH 1/3] [fix] [patch] [minor] make notes --- patches/may_2013/p06_make_notes.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/patches/may_2013/p06_make_notes.py b/patches/may_2013/p06_make_notes.py index b60642c53ec..29bfe25da40 100644 --- a/patches/may_2013/p06_make_notes.py +++ b/patches/may_2013/p06_make_notes.py @@ -13,17 +13,27 @@ def execute(): name = question.question[:180] if webnotes.conn.exists("Note", name): webnotes.delete_doc("Note", name) - note = webnotes.bean({ + + similar_questions = webnotes.conn.sql_list("""select name from `tabQuestion` + where question like %s""", "%s%%" % name) + answers = [markdown2.markdown(c) for c in webnotes.conn.sql_list(""" + select answer from tabAnswer where question in (%s)""" % \ + ", ".join(["%s"]*len(similar_questions)), similar_questions)] + + webnotes.bean({ "doctype":"Note", "title": name, - "content": "
".join([markdown2.markdown(c) for c in webnotes.conn.sql_list(""" - select answer from tabAnswer where question=%s""", question.name)]), + "content": "
".join(answers), "owner": question.owner, "creation": question.creation, "public": 1 }).insert() + except NameError: pass + except Exception, e: + if e.args[0] != 1062: + raise e webnotes.delete_doc("DocType", "Question") webnotes.delete_doc("DocType", "Answer") From 1e4fb689fc12d442274b739f4f9f8f8b70deaccf Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 23 Aug 2013 12:56:33 +0530 Subject: [PATCH 2/3] [fix] [minor] trigger grid_fieldname_remove function on removing grid row --- public/js/transaction.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/public/js/transaction.js b/public/js/transaction.js index 118594c8160..9bc9f3379e3 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -6,9 +6,9 @@ wn.require("app/js/controllers/stock_controller.js"); erpnext.TransactionController = erpnext.stock.StockController.extend({ onload: function() { + var me = this; if(this.frm.doc.__islocal) { - var me = this, - today = get_today(), + var today = get_today(), currency = wn.defaults.get_default("currency"); $.each({ @@ -30,6 +30,10 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ me.frm.script_manager.trigger("company"); } + + if(this.other_fname) { + this[this.fname + "_remove"] = this[this.other_fname + "_remove"] = this.calculate_taxes_and_totals; + } }, onload_post_render: function() { @@ -311,9 +315,14 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ function(item_code, tax_data) { if(!item_tax[item_code]) item_tax[item_code] = {}; if($.isArray(tax_data)) { - var tax_rate = tax_data[0] == null ? "" : (flt(tax_data[0], tax_rate_precision) + "%"), - tax_amount = format_currency(flt(tax_data[1], tax_amount_precision), company_currency, - tax_amount_precision); + var tax_rate = ""; + if(tax_data[0] != null) { + tax_rate = (tax.charge_type === "Actual") ? + format_currency(flt(tax_data[0], tax_amount_precision), company_currency, tax_amount_precision) : + (flt(tax_data[0], tax_rate_precision) + "%"); + } + var tax_amount = format_currency(flt(tax_data[1], tax_amount_precision), company_currency, + tax_amount_precision); item_tax[item_code][tax.name] = [tax_rate, tax_amount]; } else { From a91c95f0febc5fefd0c5dd6e478ce0e2c3ac4b5e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 23 Aug 2013 13:00:47 +0530 Subject: [PATCH 3/3] [fix] [minor] recalculate on removing row --- public/js/transaction.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/js/transaction.js b/public/js/transaction.js index 9bc9f3379e3..1d06a9f487d 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -32,7 +32,11 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ } if(this.other_fname) { - this[this.fname + "_remove"] = this[this.other_fname + "_remove"] = this.calculate_taxes_and_totals; + this[this.other_fname + "_remove"] = this.calculate_taxes_and_totals; + } + + if(this.fname) { + this[this.fname + "_remove"] = this.calculate_taxes_and_totals; } },