From e2fe8de637d0f17e1715dc256ac3b6cc46b2bf76 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 28 Mar 2013 15:30:41 +0530 Subject: [PATCH 1/3] patch: update against expense_account in purchase invoice --- .../march_2013/p10_update_against_expense_account.py | 11 +++++++++++ patches/patch_list.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 patches/march_2013/p10_update_against_expense_account.py diff --git a/patches/march_2013/p10_update_against_expense_account.py b/patches/march_2013/p10_update_against_expense_account.py new file mode 100644 index 0000000000..d1bad5cfed --- /dev/null +++ b/patches/march_2013/p10_update_against_expense_account.py @@ -0,0 +1,11 @@ +def execute(): + import webnotes + from webnotes import get_obj + pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice` + where docstatus = 1 and ifnull(against_expense_account, '') = ''""") + + for pi in pi_list: + pi_obj = get_obj("Purchase Invoice", pi[0], with_children=1) + pi_obj.set_against_expense_account() + webnotes.conn.set_value("Purchase Invoice", pi[0], + "against_expense_account", pi_obj.doc.against_expense_account) \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 0c5427b52b..5eff17075c 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -219,4 +219,5 @@ patch_list = [ "execute:webnotes.bean('Style Settings').save() #2013-03-25", "execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)", "patches.march_2013.p09_unset_user_type_partner", + "patches.march_2013.p10_update_against_expense_account", ] \ No newline at end of file From d270559fa974e3fc93ac49d5a4d581ae9bd46154 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sat, 30 Mar 2013 17:48:37 +0530 Subject: [PATCH 2/3] minor fixes in stock entry --- stock/doctype/stock_entry/stock_entry.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js index c54f619735..3e21207eaa 100644 --- a/stock/doctype/stock_entry/stock_entry.js +++ b/stock/doctype/stock_entry/stock_entry.js @@ -360,7 +360,8 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) { cur_frm.cscript.validate = function(doc, cdt, cdn) { cur_frm.cscript.validate_items(doc); - validated = cur_frm.cscript.get_doctype_docname() ? true : false; + if($.inArray(cur_frm.doc.purpose, ["Purchase Return", "Sales Return"])!==-1) + validated = cur_frm.cscript.get_doctype_docname() ? true : false; } cur_frm.cscript.validate_items = function(doc) { From 1013e779577e25b0bd855123b630e76ab99d4b6a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Apr 2013 12:18:36 +0530 Subject: [PATCH 3/3] fixes in checking print_hide property in standard print format --- .../sales_taxes_and_charges_master.js | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js index b1cbbdcbfc..1e72010f26 100644 --- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js +++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js @@ -53,16 +53,14 @@ cur_frm.pformat.other_charges= function(doc){ var new_val = flt(val)/flt(doc.conversion_rate); return new_val; } + + function print_hide(fieldname) { + var doc_field = wn.meta.get_docfield(doc.doctype, fieldname, doc.name); + return doc_field.print_hide; + } + out =''; if (!doc.print_without_amount) { - print_hide_dict = {}; - for(var i in locals['DocField']) { - var doc_field = locals['DocField'][i]; - if(doc_field.fieldname) { - print_hide_dict[doc_field.fieldname] = doc_field.print_hide; - } - } - var cl = getchildren('Sales Taxes and Charges',doc.name,'other_charges'); // outer table @@ -71,7 +69,7 @@ cur_frm.pformat.other_charges= function(doc){ // main table out +=''; - if(!print_hide_dict['net_total']) { + if(!print_hide('net_total')) { out +=make_row('Net Total',convert_rate(doc.net_total),1); } @@ -84,15 +82,15 @@ cur_frm.pformat.other_charges= function(doc){ } // grand total - if(!print_hide_dict['grand_total_export']) { + if(!print_hide('grand_total_export')) { out += make_row('Grand Total',doc.grand_total_export,1); } - if(!print_hide_dict['rounded_total_export']) { + if(!print_hide('rounded_total_export')) { out += make_row('Rounded Total',doc.rounded_total_export,1); } - if(doc.in_words_export && !print_hide_dict['in_words_export']){ + if(doc.in_words_export && !print_hide('in_words_export')){ out +='
'; out += ''; out += ''
In Words