From 7bfa40fdd31b0b4c898d55bdcf6cfcf0d666d108 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 28 Mar 2013 18:48:04 +0530 Subject: [PATCH 1/3] sales return validate before save/submit --- stock/doctype/stock_entry/stock_entry.js | 39 +++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js index 9b89d7859b..c54f619735 100644 --- a/stock/doctype/stock_entry/stock_entry.js +++ b/stock/doctype/stock_entry/stock_entry.js @@ -205,25 +205,27 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ }, make_return_jv: function() { - this.frm.call({ - method: "make_return_jv", - args: { - stock_entry: this.frm.doc.name - }, - callback: function(r) { - if(!r.exc) { - var jv_name = wn.model.make_new_doc_and_get_name('Journal Voucher'); - var jv = locals["Journal Voucher"][jv_name]; - $.extend(jv, r.message[0]); - $.each(r.message.slice(1), function(i, jvd) { - var child = wn.model.add_child(jv, "Journal Voucher Detail", "entries"); - $.extend(child, jvd); - }); - loaddoc("Journal Voucher", jv_name); + if(this.get_doctype_docname()) { + this.frm.call({ + method: "make_return_jv", + args: { + stock_entry: this.frm.doc.name + }, + callback: function(r) { + if(!r.exc) { + var jv_name = wn.model.make_new_doc_and_get_name('Journal Voucher'); + var jv = locals["Journal Voucher"][jv_name]; + $.extend(jv, r.message[0]); + $.each(r.message.slice(1), function(i, jvd) { + var child = wn.model.add_child(jv, "Journal Voucher Detail", "entries"); + $.extend(child, jvd); + }); + loaddoc("Journal Voucher", jv_name); + } + } - - } - }); + }); + } }, }); @@ -358,6 +360,7 @@ 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; } cur_frm.cscript.validate_items = function(doc) { From 10a209d405bdc6e5e9b193919b8a5013dd48dbc3 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 29 Mar 2013 12:26:47 +0530 Subject: [PATCH 2/3] [gross profit] [request] added Avg. Buying Rate column --- accounts/report/gross_profit/gross_profit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/accounts/report/gross_profit/gross_profit.py b/accounts/report/gross_profit/gross_profit.py index 9300548550..9ccd320e6d 100644 --- a/accounts/report/gross_profit/gross_profit.py +++ b/accounts/report/gross_profit/gross_profit.py @@ -14,7 +14,8 @@ def execute(filters=None): columns = ["Delivery Note/Sales Invoice::120", "Link::30", "Posting Date:Date", "Posting Time", "Item Code:Link/Item", "Item Name", "Description", "Warehouse:Link/Warehouse", - "Qty:Float", "Selling Rate:Currency", "Selling Amount:Currency", "Buying Amount:Currency", + "Qty:Float", "Selling Rate:Currency", "Avg. Buying Rate:Currency", + "Selling Amount:Currency", "Buying Amount:Currency", "Gross Profit:Currency", "Gross Profit %:Percent", "Project:Link/Project"] data = [] @@ -35,7 +36,8 @@ def execute(filters=None): icon = """""" \ % ("/".join(["#Form", row.parenttype, row.name]),) data.append([row.name, icon, row.posting_date, row.posting_time, row.item_code, row.item_name, - row.description, row.warehouse, row.qty, row.basic_rate, row.amount, buying_amount, + row.description, row.warehouse, row.qty, row.basic_rate, + row.qty and (buying_amount / row.qty) or 0, row.amount, buying_amount, gross_profit, gross_profit_percent, row.project]) return columns, data From fe7a53bca326a020fef1b61db2387869f1f5cc70 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sat, 30 Mar 2013 11:56:13 +0530 Subject: [PATCH 3/3] [data-import] [fix] changed template to remove -- separators that get removed for some reason --- website/doctype/blogger/blogger.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/website/doctype/blogger/blogger.txt b/website/doctype/blogger/blogger.txt index 7f741c523c..f56df1f2b3 100644 --- a/website/doctype/blogger/blogger.txt +++ b/website/doctype/blogger/blogger.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-08 11:36:52", + "creation": "2013-03-25 16:00:51", "docstatus": 0, - "modified": "2013-03-11 14:00:37", + "modified": "2013-03-29 10:37:37", "modified_by": "Administrator", "owner": "Administrator" }, @@ -50,6 +50,7 @@ "doctype": "DocField", "fieldname": "full_name", "fieldtype": "Data", + "in_list_view": 1, "label": "Full Name", "reqd": 1 }, @@ -77,6 +78,7 @@ "doctype": "DocField", "fieldname": "posts", "fieldtype": "Int", + "in_list_view": 1, "label": "Posts", "read_only": 1 },