From 4b9a3ed8a0600e3fd7db4588db400311744db019 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 9 Apr 2013 10:27:06 +0530 Subject: [PATCH 01/35] [knowledge base] added all permissions --- utilities/page/questions/questions.txt | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/utilities/page/questions/questions.txt b/utilities/page/questions/questions.txt index 64aaa514d3d..804e2a6ce97 100644 --- a/utilities/page/questions/questions.txt +++ b/utilities/page/questions/questions.txt @@ -1,20 +1,31 @@ [ { - "owner": "Administrator", + "creation": "2012-06-14 18:44:56", "docstatus": 0, - "creation": "2011-05-04 11:09:49", + "modified": "2013-04-09 10:25:31", "modified_by": "Administrator", - "modified": "2011-03-29 13:53:57" + "owner": "Administrator" }, { - "name": "__common__", + "doctype": "Page", "module": "Utilities", - "standard": "Yes", + "name": "__common__", "page_name": "Questions", - "doctype": "Page" + "standard": "Yes" }, { - "name": "questions", - "doctype": "Page" + "doctype": "Page Role", + "name": "__common__", + "parent": "questions", + "parentfield": "roles", + "parenttype": "Page", + "role": "All" + }, + { + "doctype": "Page", + "name": "questions" + }, + { + "doctype": "Page Role" } ] \ No newline at end of file From 0c1611219ed7f325bb997caf1d0510d1507af0a6 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 13:54:13 +0530 Subject: [PATCH 02/35] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- hr/doctype/employee/employee.py | 26 ++++++++++--------- patches/april_2013/p05_update_file_data.py | 4 ++- patches/april_2013/p06_update_file_size.py | 11 ++++++++ patches/patch_list.py | 2 ++ setup/page/setup/setup.js | 6 +++++ .../stock_reconciliation.txt | 7 +++-- 6 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 patches/april_2013/p06_update_file_size.py diff --git a/hr/doctype/employee/employee.py b/hr/doctype/employee/employee.py index 16ecb6d2ed2..4100e2ee81c 100644 --- a/hr/doctype/employee/employee.py +++ b/hr/doctype/employee/employee.py @@ -100,18 +100,20 @@ class DocType: if self.doc.gender: profile_wrapper.doc.gender = self.doc.gender - if self.doc.image and self.doc.file_list: - # add to file list and user_image - for file_args in self.doc.file_list.split("\n"): - fname, fid = file_args.split(",") - if self.doc.image == fname: - new_file_args = fname + "," + fid - file_list = cstr(profile_wrapper.doc.file_list).split("\n") - if new_file_args not in file_list: - file_list += [new_file_args] - profile_wrapper.doc.file_list = "\n".join(file_list) - profile_wrapper.doc.user_image = fname - break + if self.doc.image: + if not profile_wrapper.doc.user_image == self.doc.image: + profile_wrapper.doc.user_image = self.doc.image + try: + webnotes.doc({ + "doctype": "File Data", + "file_name": self.doc.image, + "attached_to_doctype": "Profile", + "attached_to_name": self.doc.user_id + }).insert() + except webnotes.DuplicateEntryError, e: + # already exists + pass + break profile_wrapper.save() diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index 1f288c1aac6..a9a3cf96293 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -2,11 +2,13 @@ import webnotes, webnotes.utils, os from webnotes.modules.export_file import export_to_files def execute(): + webnotes.reload_doc("core", "doctype", "file_data") + webontes.reset_perms("File Data") + singles = webnotes.conn.sql_list("""select name from tabDocType where ifnull(issingle,0)=1""") for doctype in webnotes.conn.sql_list("""select parent from tabDocField where fieldname='file_list' and fieldtype='Text'"""): - print doctype if doctype in singles: doc = webnotes.doc(doctype, doctype) update_for_doc(doctype, doc) diff --git a/patches/april_2013/p06_update_file_size.py b/patches/april_2013/p06_update_file_size.py new file mode 100644 index 00000000000..e61c060d52a --- /dev/null +++ b/patches/april_2013/p06_update_file_size.py @@ -0,0 +1,11 @@ +import webnotes, os, webnotes.utils + +def execute(): + files_path = webnotes.utils.get_path("public", "files") + for f in webnotes.conn.sql("""select name, file_name from + `tabFile Data`""", as_dict=True): + filepath = os.path.join(files_path, f.file_name) + if os.path.exists(filepath): + webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size) + + \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index b827c5b482c..d5b62e37fcc 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -241,4 +241,6 @@ patch_list = [ "patches.april_2013.p04_reverse_modules_list", "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')", "patches.april_2013.p04_update_role_in_pages", + "patches.april_2013.p05_update_file_data", + "patches.april_2013.p06_update_file_size", ] \ No newline at end of file diff --git a/setup/page/setup/setup.js b/setup/page/setup/setup.js index 4ab7578850a..b47f6f28d11 100644 --- a/setup/page/setup/setup.js +++ b/setup/page/setup/setup.js @@ -82,6 +82,12 @@ wn.module_page["Setup"] = [ label: wn._("Rename Tool"), "description":wn._("Rename multiple items in one go") }, + { + "route":"List/File Data", + doctype: "File Data", + label: wn._("File Manager"), + "description":wn._("List, delete uploaded files.") + }, ] }, { diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/stock/doctype/stock_reconciliation/stock_reconciliation.txt index 760620bb734..9b5b2a128a2 100644 --- a/stock/doctype/stock_reconciliation/stock_reconciliation.txt +++ b/stock/doctype/stock_reconciliation/stock_reconciliation.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-26 06:51:17", + "creation": "2013-03-28 10:35:31", "docstatus": 0, - "modified": "2013-03-26 08:32:03", + "modified": "2013-04-10 13:44:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -52,6 +52,7 @@ "fieldname": "posting_date", "fieldtype": "Date", "in_filter": 0, + "in_list_view": 1, "label": "Posting Date", "oldfieldname": "reconciliation_date", "oldfieldtype": "Date", @@ -63,6 +64,7 @@ "fieldname": "posting_time", "fieldtype": "Time", "in_filter": 0, + "in_list_view": 1, "label": "Posting Time", "oldfieldname": "reconciliation_time", "oldfieldtype": "Time", @@ -148,6 +150,7 @@ "fieldname": "stock_value_difference", "fieldtype": "Currency", "hidden": 1, + "in_list_view": 1, "label": "Stock Value Difference", "print_hide": 1 }, From 44323693f4abd96e8ef4445ffcd1ea9d4825c512 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 13:54:44 +0530 Subject: [PATCH 03/35] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- home/page/latest_updates/latest_updates.js | 1 + 1 file changed, 1 insertion(+) diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index c0bad9405bb..6f8a05b81c6 100644 --- a/home/page/latest_updates/latest_updates.js +++ b/home/page/latest_updates/latest_updates.js @@ -1,4 +1,5 @@ erpnext.updates = [ + ["10th April", ["Redesigned File Uploads and added File Manager in Setup"]], ["27th March", ["Rename multiple items together. Go to Setup > Rename Tool"]], ["26th March", ["Added project to Stock Ledger and Balance", "Added Default Cash Account in Company."]], From 04a1916bbdb6e96fc4e13502fa9ded43dc860b2a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 13:57:08 +0530 Subject: [PATCH 04/35] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p05_update_file_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index a9a3cf96293..dc3b9a882c0 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -36,7 +36,7 @@ def update_for_doc(doctype, doc): exists = True if not (filename.startswith("http://") or filename.startswith("https://")): - if not os.path.exists(os.path.join(webnotes.utils.get_base_path(), "public", "files", filename)): + if not os.path.exists(webnotes.utils.get_path("public", "files", filename): exists = False if exists: From 753ae05ba90d212bddd0e46446d856d906bb1b82 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 14:14:48 +0530 Subject: [PATCH 05/35] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p05_update_file_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index dc3b9a882c0..a1d2f63b626 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -36,7 +36,7 @@ def update_for_doc(doctype, doc): exists = True if not (filename.startswith("http://") or filename.startswith("https://")): - if not os.path.exists(webnotes.utils.get_path("public", "files", filename): + if not os.path.exists(webnotes.utils.get_path("public", "files", filename)): exists = False if exists: From 9e93037119cd179efd452d3050ac8595798ad426 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 14:17:45 +0530 Subject: [PATCH 06/35] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p05_update_file_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index a1d2f63b626..8fd38ede882 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -3,7 +3,7 @@ from webnotes.modules.export_file import export_to_files def execute(): webnotes.reload_doc("core", "doctype", "file_data") - webontes.reset_perms("File Data") + webnotes.reset_perms("File Data") singles = webnotes.conn.sql_list("""select name from tabDocType where ifnull(issingle,0)=1""") From cc887a83208f7ca6f4a4b3640484ea56b8376179 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 14:20:56 +0530 Subject: [PATCH 07/35] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p05_update_file_data.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index 8fd38ede882..9fed8a495b4 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -32,7 +32,11 @@ def update_for_doc(doctype, doc): if not filedata: continue - filename, fileid = filedata.split(",") + filedata = filedata.split(",") + if len(filedata)==2: + filename, fileid = filedata[0], filedata[1] + else: + continue exists = True if not (filename.startswith("http://") or filename.startswith("https://")): From 7c179bd00c35024ceed699009f6584726962617b Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 14:22:06 +0530 Subject: [PATCH 08/35] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p06_update_file_size.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/patches/april_2013/p06_update_file_size.py b/patches/april_2013/p06_update_file_size.py index e61c060d52a..8709c7b6420 100644 --- a/patches/april_2013/p06_update_file_size.py +++ b/patches/april_2013/p06_update_file_size.py @@ -4,8 +4,9 @@ def execute(): files_path = webnotes.utils.get_path("public", "files") for f in webnotes.conn.sql("""select name, file_name from `tabFile Data`""", as_dict=True): - filepath = os.path.join(files_path, f.file_name) - if os.path.exists(filepath): - webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size) + if f.file_name: + filepath = os.path.join(files_path, f.file_name) + if os.path.exists(filepath): + webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size) \ No newline at end of file From 1b35b1aa62522a80edd3f2db2294b27a22149e7a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 16:16:59 +0530 Subject: [PATCH 09/35] [file] [patch fix] --- patches/april_2013/p05_update_file_data.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index 9fed8a495b4..a5540cc3cd6 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -11,8 +11,9 @@ def execute(): fieldname='file_list' and fieldtype='Text'"""): if doctype in singles: doc = webnotes.doc(doctype, doctype) - update_for_doc(doctype, doc) - webnotes.conn.set_value(doctype, None, "file_list", None) + if doc.file_list: + update_for_doc(doctype, doc) + webnotes.conn.set_value(doctype, None, "file_list", None) else: try: for doc in webnotes.conn.sql("""select name, file_list from `tab%s` where From 5ed6676193b4d9781e84584cc82f0a48945e06c4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 15 Apr 2013 10:49:17 +0530 Subject: [PATCH 10/35] [editor] [stylefix] --- website/doctype/website_settings/website_settings.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/doctype/website_settings/website_settings.txt b/website/doctype/website_settings/website_settings.txt index 442663aae4b..4b66e098a42 100644 --- a/website/doctype/website_settings/website_settings.txt +++ b/website/doctype/website_settings/website_settings.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-25 16:01:34", "docstatus": 0, - "modified": "2013-03-13 16:25:22", + "modified": "2013-04-12 10:30:18", "modified_by": "Administrator", "owner": "Administrator" }, @@ -50,7 +50,7 @@ "fieldtype": "Link", "label": "Home Page", "options": "Web Page", - "reqd": 1 + "reqd": 0 }, { "description": "The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.", From a1924eda90379c769453581c0944de96900e6677 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 17 Apr 2013 18:40:40 +0530 Subject: [PATCH 11/35] [employee] [fix] removed erroneous break statement --- hr/doctype/employee/employee.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hr/doctype/employee/employee.py b/hr/doctype/employee/employee.py index bef3274c223..87fe9a45e9d 100644 --- a/hr/doctype/employee/employee.py +++ b/hr/doctype/employee/employee.py @@ -114,7 +114,6 @@ class DocType: except webnotes.DuplicateEntryError, e: # already exists pass - break profile_wrapper.save() From cdc9e2cd6fe3a5639fc18ad7bcb8ae143c08426e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 25 Apr 2013 11:06:17 +0530 Subject: [PATCH 12/35] [patch] [file data] reset permissions --- patches/patch_list.py | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/patch_list.py b/patches/patch_list.py index abee4f0cbc6..a6dd0a217b3 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -246,4 +246,5 @@ patch_list = [ "execute:webnotes.delete_doc('DocType Mapper', 'Delivery Note-Packing Slip')", "execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')", "patches.april_2013.p06_default_cost_center", + "execute:webnotes.reset_perms('File Data')", ] \ No newline at end of file From 04c1f94b4e53a19bde20efe687aac6eab3b7959a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Apr 2013 16:27:51 +0530 Subject: [PATCH 13/35] [DN][usability] copy cost center in each row --- controllers/buying_controller.py | 2 +- stock/doctype/delivery_note/delivery_note.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index 85d8b9d9ea4..94e3d56ddc2 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -47,7 +47,7 @@ class BuyingController(StockController): items = [d.item_code for d in self.doclist.get({"parentfield": self.fname})] if self.stock_items and len(items) > len(self.stock_items): nonstock_items = list(set(items) - set(self.stock_items)) - webnotes.msgprint(_("Stock and non-stock items can not be entered at the same ") + + webnotes.msgprint(_("Stock and non-stock items can not be entered in the same ") + self.doc.doctype + _(""". You should make separate documents for them. Stock Items: """) + ", ".join(self.stock_items) + _(""" Non-stock Items: """) + ", ".join(nonstock_items), raise_exception=1) diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js index 8d09cbd6761..0a31dfe80e4 100644 --- a/stock/doctype/delivery_note/delivery_note.js +++ b/stock/doctype/delivery_note/delivery_note.js @@ -326,6 +326,17 @@ if (sys_defaults.auto_inventory_accounting) { } // cost center + cur_frm.cscript.cost_center = function(doc, cdt, cdn){ + var d = locals[cdt][cdn]; + if(d.cost_center) { + var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype); + for(var i = 0; i < cl.length; i++){ + if(!cl[i].cost_center) cl[i].cost_center = d.cost_center; + } + } + refresh_field(cur_frm.cscript.fname); + } + cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) { return { query: "accounts.utils.get_cost_center_list", From 612424776535c588163bc0146a93160f366ed285 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Apr 2013 16:29:06 +0530 Subject: [PATCH 14/35] [bom] set fetched values at server side --- manufacturing/doctype/bom/bom.js | 37 +++++++++----------- manufacturing/doctype/bom/bom.py | 58 ++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 47 deletions(-) diff --git a/manufacturing/doctype/bom/bom.js b/manufacturing/doctype/bom/bom.js index 4e8fbc95d16..f0c15fa2a9d 100644 --- a/manufacturing/doctype/bom/bom.js +++ b/manufacturing/doctype/bom/bom.js @@ -59,27 +59,22 @@ cur_frm.fields_dict["bom_operations"].grid.on_row_delete = function(cdt, cdn){ set_operation_no(doc); } -cur_frm.cscript.item = function(doc, dt, dn) { - if (doc.item) { - get_server_fields('get_item_details', doc.item, '', doc, dt, dn, 1); - } -} +cur_frm.add_fetch("item", "description", "description"); +cur_frm.add_fetch("item", "stock_uom", "uom"); cur_frm.cscript.workstation = function(doc,dt,dn) { var d = locals[dt][dn]; - if (d.workstation) { - var callback = function(r, rt) { - calculate_op_cost(doc, dt, dn); - calculate_total(doc); - } - get_server_fields('get_workstation_details', d.workstation, - 'bom_operations', doc, dt, dn, 1, callback); - } + wn.model.with_doc("Workstation", d.workstation, function(i, v) { + d.hour_rate = v.hour_rate; + refresh_field("hour_rate"); + calculate_op_cost(doc); + calculate_total(doc); + }); } cur_frm.cscript.hour_rate = function(doc, dt, dn) { - calculate_op_cost(doc, dt, dn); + calculate_op_cost(doc); calculate_total(doc); } @@ -114,7 +109,7 @@ var get_bom_material_detail= function(doc, cdt, cdn) { $.extend(d, r.message); refresh_field("bom_materials"); doc = locals[doc.doctype][doc.name]; - calculate_rm_cost(doc, cdt, cdn); + calculate_rm_cost(doc); calculate_total(doc); }, freeze: true @@ -124,7 +119,7 @@ var get_bom_material_detail= function(doc, cdt, cdn) { cur_frm.cscript.qty = function(doc, cdt, cdn) { - calculate_rm_cost(doc, cdt, cdn); + calculate_rm_cost(doc); calculate_total(doc); } @@ -134,12 +129,12 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) { msgprint("You can not change rate if BOM mentioned agianst any item"); get_bom_material_detail(doc, cdt, cdn); } else { - calculate_rm_cost(doc, cdt, cdn); + calculate_rm_cost(doc); calculate_total(doc); } } -var calculate_op_cost = function(doc, dt, dn) { +var calculate_op_cost = function(doc) { var op = getchildren('BOM Operation', doc.name, 'bom_operations'); total_op_cost = 0; for(var i=0;i Date: Fri, 26 Apr 2013 17:25:44 +0530 Subject: [PATCH 15/35] validation for stock and nonstock items in purchase cycle --- controllers/buying_controller.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index 94e3d56ddc2..e167dc57b77 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -45,12 +45,13 @@ class BuyingController(StockController): def validate_stock_or_nonstock_items(self): items = [d.item_code for d in self.doclist.get({"parentfield": self.fname})] - if self.stock_items and len(items) > len(self.stock_items): + if self.stock_items: nonstock_items = list(set(items) - set(self.stock_items)) - webnotes.msgprint(_("Stock and non-stock items can not be entered in the same ") + - self.doc.doctype + _(""". You should make separate documents for them. - Stock Items: """) + ", ".join(self.stock_items) + _(""" - Non-stock Items: """) + ", ".join(nonstock_items), raise_exception=1) + if nonstock_items: + webnotes.msgprint(_("Stock and non-stock items can not be entered in the same ") + + self.doc.doctype + _(""". You should make separate documents for them. + Stock Items: """) + ", ".join(self.stock_items) + _(""" + Non-stock Items: """) + ", ".join(nonstock_items), raise_exception=1) elif items and not self.stock_items: tax_for_valuation = [d.account_head for d in From 6198c28fd352f597194c2cea460b9830b417f11f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Apr 2013 17:29:05 +0530 Subject: [PATCH 16/35] validation for stock and nonstock items in purchase cycle --- manufacturing/doctype/bom/bom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manufacturing/doctype/bom/bom.py b/manufacturing/doctype/bom/bom.py index 1408a3ad5cf..5f42f4da5d7 100644 --- a/manufacturing/doctype/bom/bom.py +++ b/manufacturing/doctype/bom/bom.py @@ -89,7 +89,7 @@ class DocType: "qty": item.qty }) for r in ret: - if not item.fields[r]: + if not item.fields.get(r): item.fields[r] = ret[r] def get_bom_material_detail(self, args=None): @@ -117,7 +117,7 @@ class DocType: def get_rm_rate(self, arg): """ Get raw material rate as per selected method, if bom exists takes bom cost """ - + rate = 0 if arg['bom_no']: rate = self.get_bom_unitcost(arg['bom_no']) elif arg and (arg['is_purchase_item'] == 'Yes' or arg['is_sub_contracted_item'] == 'Yes'): From 319e0f43da2d8f6168408067c3aabaddd69a1f68 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 08:53:12 +0530 Subject: [PATCH 17/35] [latest updates] added default cost center and update manager --- home/page/latest_updates/latest_updates.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index 949849d8f18..a4d99f69e4f 100644 --- a/home/page/latest_updates/latest_updates.js +++ b/home/page/latest_updates/latest_updates.js @@ -1,5 +1,7 @@ erpnext.updates = [ + ["18th April", ["Cost Center: Set a default Cost Center for a Company"]], ["12th April", ["Employee: List of Leave Approvers who can approve the Employee's Leave Applications"]], + ["3rd April", ["Update Manager: Open source users can update their ERPNext instance from Setup > Update Manager"]], ["27th March", ["Rename multiple items together. Go to Setup > Rename Tool"]], ["26th March", ["Added project to Stock Ledger and Balance", "Added Default Cash Account in Company."]], From 4cbeda1ec7ced13f5227948641467f2c66db148d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 10:48:45 +0530 Subject: [PATCH 18/35] [patch] [fix] commented out export_to_files call in p05_update_file_data patch --- patches/april_2013/p05_update_file_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index a5540cc3cd6..986e5b9b536 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -26,7 +26,7 @@ def execute(): webnotes.conn.sql("""delete from tabDocField where fieldname='file_list' and parent=%s""", doctype) - export_to_files([["DocType", doctype]]) + # export_to_files([["DocType", doctype]]) def update_for_doc(doctype, doc): for filedata in doc.file_list.split("\n"): From e81b0e2d669d766e685d6859400172a211da0d23 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 29 Apr 2013 11:45:22 +0530 Subject: [PATCH 19/35] [stock ageing][fixes] for serialized items --- stock/page/stock_ageing/stock_ageing.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stock/page/stock_ageing/stock_ageing.js b/stock/page/stock_ageing/stock_ageing.js index edad9a76a18..456f5f13670 100644 --- a/stock/page/stock_ageing/stock_ageing.js +++ b/stock/page/stock_ageing/stock_ageing.js @@ -95,6 +95,8 @@ erpnext.StockAgeing = erpnext.StockGridReport.extend({ this.data = [].concat(this._data); + this.serialized_buying_rates = this.get_serialized_buying_rates(); + $.each(this.data, function(i, d) { me.reset_item_values(d); }); From 99883420e78c6f6e54df7dc205e5eaf866449e56 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 29 Apr 2013 12:15:35 +0530 Subject: [PATCH 20/35] [general ledger][fixes] for against_account value --- accounts/page/general_ledger/general_ledger.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/accounts/page/general_ledger/general_ledger.js b/accounts/page/general_ledger/general_ledger.js index 21be3a05dd7..a462b70e93e 100644 --- a/accounts/page/general_ledger/general_ledger.js +++ b/accounts/page/general_ledger/general_ledger.js @@ -186,7 +186,6 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({ var totals = this.make_summary_row("Totals", this.account); var grouped_ledgers = {}; - $.each(data, function(i, item) { if((me.is_default("company") ? true : me.apply_filter(item, "company")) && (me.account ? me.is_child_account(me.account, item.account) @@ -217,8 +216,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({ grouped_ledgers[item.account].totals.debit += item.debit; grouped_ledgers[item.account].totals.credit += item.credit; } - - if(me.account) { + if(item.account) { item.against_account = me.voucher_accounts[item.voucher_type + ":" + item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", "); } From ce3296fc87298466c32b6de471d9b1f78aa31ccc Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 12:28:19 +0530 Subject: [PATCH 21/35] [rename tool] [fix] condition to validate that content exists in a row of the uploaded file --- utilities/doctype/rename_tool/rename_tool.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utilities/doctype/rename_tool/rename_tool.py b/utilities/doctype/rename_tool/rename_tool.py index 2e368ced709..5accf3c6b77 100644 --- a/utilities/doctype/rename_tool/rename_tool.py +++ b/utilities/doctype/rename_tool/rename_tool.py @@ -34,7 +34,8 @@ def upload(select_doctype=None, rows=None): rename_log = [] for row in rows: - if len(row) > 2: + # if row has some content + if len(row) > 1 and row[0] and row[1]: try: if rename_doc(select_doctype, row[0], row[1]): rename_log.append(_("Successful: ") + row[0] + " -> " + row[1]) @@ -45,5 +46,5 @@ def upload(select_doctype=None, rows=None): rename_log.append("" + \ _("Failed: ") + row[0] + " -> " + row[1] + "") rename_log.append("" + repr(e) + "") - + return rename_log \ No newline at end of file From 457cd7d1f446b7a823eef77c4df5c53c1e90d8c6 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 13:01:44 +0530 Subject: [PATCH 22/35] [gl entry] [validation] company match validation should be done only for is_cancelled = No --- accounts/doctype/gl_entry/gl_entry.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/accounts/doctype/gl_entry/gl_entry.py b/accounts/doctype/gl_entry/gl_entry.py index 64d84b04594..429cc104a7b 100644 --- a/accounts/doctype/gl_entry/gl_entry.py +++ b/accounts/doctype/gl_entry/gl_entry.py @@ -108,8 +108,8 @@ class DocType: and not 'Accounts Manager' in webnotes.user.get_roles(): msgprint(_("Account") + ": " + self.doc.account + _(" has been freezed. \ Only Accounts Manager can do transaction against this account"), raise_exception=1) - - if ret and ret[0]["company"] != self.doc.company: + + if self.doc.is_cancelled in ("No", None) and ret and ret[0]["company"] != self.doc.company: msgprint(_("Account") + ": " + self.doc.account + _(" does not belong to the company") \ + ": " + self.doc.company, raise_exception=1) @@ -124,9 +124,10 @@ class DocType: return self.cost_center_company[self.doc.cost_center] - if self.doc.cost_center and _get_cost_center_company() != self.doc.company: - msgprint(_("Cost Center") + ": " + self.doc.cost_center \ - + _(" does not belong to the company") + ": " + self.doc.company, raise_exception=True) + if self.doc.is_cancelled in ("No", None) and \ + self.doc.cost_center and _get_cost_center_company() != self.doc.company: + msgprint(_("Cost Center") + ": " + self.doc.cost_center \ + + _(" does not belong to the company") + ": " + self.doc.company, raise_exception=True) def check_freezing_date(self, adv_adj): """ From e5a36a287f8069025d13b7b2547f580965d69525 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 14:12:27 +0530 Subject: [PATCH 23/35] [patch] [file data] patch for custom fields with name file_list --- patches/april_2013/p05_update_file_data.py | 40 +++++++++++++--------- patches/patch_list.py | 1 + 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index 986e5b9b536..1ff48fa60e8 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -5,28 +5,36 @@ def execute(): webnotes.reload_doc("core", "doctype", "file_data") webnotes.reset_perms("File Data") - singles = webnotes.conn.sql_list("""select name from tabDocType - where ifnull(issingle,0)=1""") + singles = get_single_doctypes() + for doctype in webnotes.conn.sql_list("""select parent from tabDocField where fieldname='file_list' and fieldtype='Text'"""): - if doctype in singles: - doc = webnotes.doc(doctype, doctype) - if doc.file_list: - update_for_doc(doctype, doc) - webnotes.conn.set_value(doctype, None, "file_list", None) - else: - try: - for doc in webnotes.conn.sql("""select name, file_list from `tab%s` where - ifnull(file_list, '')!=''""" % doctype, as_dict=True): - update_for_doc(doctype, doc) - webnotes.conn.commit() - webnotes.conn.sql("""alter table `tab%s` drop column file_list""" % doctype) - except Exception, e: - if e.args[0]!=1054: raise e + update_file_list(doctype, singles) webnotes.conn.sql("""delete from tabDocField where fieldname='file_list' and parent=%s""", doctype) + # export_to_files([["DocType", doctype]]) + +def get_single_doctypes(): + return webnotes.conn.sql_list("""select name from tabDocType + where ifnull(issingle,0)=1""") + +def update_file_list(doctype, singles): + if doctype in singles: + doc = webnotes.doc(doctype, doctype) + if doc.file_list: + update_for_doc(doctype, doc) + webnotes.conn.set_value(doctype, None, "file_list", None) + else: + try: + for doc in webnotes.conn.sql("""select name, file_list from `tab%s` where + ifnull(file_list, '')!=''""" % doctype, as_dict=True): + update_for_doc(doctype, doc) + webnotes.conn.commit() + webnotes.conn.sql("""alter table `tab%s` drop column file_list""" % doctype) + except Exception, e: + if e.args[0]!=1054: raise e def update_for_doc(doctype, doc): for filedata in doc.file_list.split("\n"): diff --git a/patches/patch_list.py b/patches/patch_list.py index a6dd0a217b3..096fec80abf 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -247,4 +247,5 @@ patch_list = [ "execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')", "patches.april_2013.p06_default_cost_center", "execute:webnotes.reset_perms('File Data')", + "patches.april_2013.p07_update_file_data_custom_field", ] \ No newline at end of file From 123f59dc89cf3858678ba8a71bfd72e9a3b9438b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 14:21:42 +0530 Subject: [PATCH 24/35] [patches] [file data] fixes in file data patch --- patches/april_2013/p05_update_file_data.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index 1ff48fa60e8..d3877417e2b 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -53,10 +53,17 @@ def update_for_doc(doctype, doc): exists = False if exists: - webnotes.conn.sql("""update `tabFile Data` - set attached_to_doctype=%s, attached_to_name=%s - where name=%s""", (doctype, doc.name, fileid)) - + if webnotes.conn.exists("File Data", fileid): + fd = webnotes.bean("File Data", fileid) + if not (fd.doc.attached_to_doctype and fd.doc.attached_to_name): + fd.doc.attached_to_doctype = doctype + fd.doc.attached_to_name = doc.name + fd.save() + else: + fd = webnotes.bean("File Data", copy=fd.doclist) + fd.doc.attached_to_doctype = doctype + fd.doc.attached_to_name = doc.name + fd.insert() else: webnotes.conn.sql("""delete from `tabFile Data` where name=%s""", - fileid) \ No newline at end of file + fileid) \ No newline at end of file From 7bd7c8769ef6eb472b9b0dde5653859ccaa7150d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 14:21:58 +0530 Subject: [PATCH 25/35] [patch] [file data] files in update file data patch --- .../april_2013/p07_update_file_data_custom_field.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 patches/april_2013/p07_update_file_data_custom_field.py diff --git a/patches/april_2013/p07_update_file_data_custom_field.py b/patches/april_2013/p07_update_file_data_custom_field.py new file mode 100644 index 00000000000..909df0554d8 --- /dev/null +++ b/patches/april_2013/p07_update_file_data_custom_field.py @@ -0,0 +1,11 @@ +import webnotes +def execute(): + from patches.april_2013.p05_update_file_data import update_file_list, get_single_doctypes + singles = get_single_doctypes() + for doctype in webnotes.conn.sql("""select parent from `tabCustom Field` where + fieldname='file_list' and fieldtype='Text'"""): + update_file_list(doctype, singles) + + webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list' + and parent=%s""", doctype) + \ No newline at end of file From 345c8fbfa29dd51e7f0a637ec50818dd7b975b16 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 29 Apr 2013 14:35:11 +0530 Subject: [PATCH 26/35] [patch] rebuild sales browser --- patches/april_2013/rebuild_sales_browser.py | 4 ++++ patches/patch_list.py | 1 + 2 files changed, 5 insertions(+) create mode 100644 patches/april_2013/rebuild_sales_browser.py diff --git a/patches/april_2013/rebuild_sales_browser.py b/patches/april_2013/rebuild_sales_browser.py new file mode 100644 index 00000000000..917ae684674 --- /dev/null +++ b/patches/april_2013/rebuild_sales_browser.py @@ -0,0 +1,4 @@ +import webnotes +def execute(): + from patches.january_2013 import rebuild_tree + rebuild_tree.execute() \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index a6dd0a217b3..1b874d63ff9 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -247,4 +247,5 @@ patch_list = [ "execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')", "patches.april_2013.p06_default_cost_center", "execute:webnotes.reset_perms('File Data')", + "patches.april_2013.rebuild_sales_browser", ] \ No newline at end of file From 7ee7eae3ae8848eb597bcab6557dc278fbb6784b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 29 Apr 2013 15:10:39 +0530 Subject: [PATCH 27/35] [item][validation] some validation only after saving --- stock/doctype/item/item.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index 4767742e3ef..fce6f32543f 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -55,12 +55,13 @@ class DocType(DocListController): ch.conversion_factor = 1 def check_stock_uom_with_bin(self): - bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s", - self.doc.item_code) - if self.doc.stock_uom and bin and cstr(bin[0][0]) \ - and cstr(bin[0][0]) != cstr(self.doc.stock_uom): - msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."), - raise_exception=1) + if not self.doc.__islocal: + bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s", + self.doc.name) + if self.doc.stock_uom and bin and cstr(bin[0][0]) \ + and cstr(bin[0][0]) != cstr(self.doc.stock_uom): + msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."), + raise_exception=1) def validate_conversion_factor(self): check_list = [] @@ -154,13 +155,14 @@ class DocType(DocListController): def validate_barcode(self): if self.doc.barcode: - duplicate = webnotes.conn.sql("select name from tabItem where barcode = %s and name != %s", (self.doc.barcode, self.doc.name)) + duplicate = webnotes.conn.sql("""select name from tabItem where barcode = %s + and name != %s""", (self.doc.barcode, self.doc.name)) if duplicate: msgprint("Barcode: %s already used in item: %s" % (self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1) def check_non_asset_warehouse(self): - if self.doc.is_asset_item == "Yes": + if not self.doc.__islocal and self.doc.is_asset_item == "Yes": existing_qty = webnotes.conn.sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name) for e in existing_qty: msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." % From eda17eb20a7808f24faae12b612e40f101059557 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 15:21:30 +0530 Subject: [PATCH 28/35] [patch] [fiel data] new patch p07_update_file_data_2 --- patches/april_2013/p05_update_file_data.py | 20 ++++++++++++------- patches/april_2013/p07_update_file_data_2.py | 15 ++++++++++++++ .../p07_update_file_data_custom_field.py | 11 ---------- patches/patch_list.py | 2 +- 4 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 patches/april_2013/p07_update_file_data_2.py delete mode 100644 patches/april_2013/p07_update_file_data_custom_field.py diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index d3877417e2b..a5d2f7a07a2 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -8,7 +8,7 @@ def execute(): singles = get_single_doctypes() for doctype in webnotes.conn.sql_list("""select parent from tabDocField where - fieldname='file_list' and fieldtype='Text'"""): + fieldname='file_list'"""): update_file_list(doctype, singles) webnotes.conn.sql("""delete from tabDocField where fieldname='file_list' @@ -32,9 +32,11 @@ def update_file_list(doctype, singles): ifnull(file_list, '')!=''""" % doctype, as_dict=True): update_for_doc(doctype, doc) webnotes.conn.commit() - webnotes.conn.sql("""alter table `tab%s` drop column file_list""" % doctype) + webnotes.conn.sql("""alter table `tab%s` drop column `file_list`""" % doctype) except Exception, e: - if e.args[0]!=1054: raise e + print webnotes.getTraceback() + if (e.args and e.args[0]!=1054) or not e.args: + raise e def update_for_doc(doctype, doc): for filedata in doc.file_list.split("\n"): @@ -60,10 +62,14 @@ def update_for_doc(doctype, doc): fd.doc.attached_to_name = doc.name fd.save() else: - fd = webnotes.bean("File Data", copy=fd.doclist) - fd.doc.attached_to_doctype = doctype - fd.doc.attached_to_name = doc.name - fd.insert() + try: + fd = webnotes.bean("File Data", copy=fd.doclist) + fd.doc.attached_to_doctype = doctype + fd.doc.attached_to_name = doc.name + fd.doc.name = None + fd.insert() + except webnotes.DuplicateEntryError: + pass else: webnotes.conn.sql("""delete from `tabFile Data` where name=%s""", fileid) \ No newline at end of file diff --git a/patches/april_2013/p07_update_file_data_2.py b/patches/april_2013/p07_update_file_data_2.py new file mode 100644 index 00000000000..7b89a9de778 --- /dev/null +++ b/patches/april_2013/p07_update_file_data_2.py @@ -0,0 +1,15 @@ +import webnotes +def execute(): + from patches.april_2013.p05_update_file_data import update_file_list, get_single_doctypes + + singles = get_single_doctypes() + for doctype in webnotes.conn.sql_list("""select table_name from `information_schema`.`columns` + where table_schema=%s and column_name='file_list'""", webnotes.conn.cur_db_name): + doctype = doctype[3:] + update_file_list(doctype, singles) + + webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list' + and parent=%s""", doctype) + webnotes.conn.sql("""delete from `tabDocField` where fieldname='file_list' + and parent=%s""", doctype) + \ No newline at end of file diff --git a/patches/april_2013/p07_update_file_data_custom_field.py b/patches/april_2013/p07_update_file_data_custom_field.py deleted file mode 100644 index 909df0554d8..00000000000 --- a/patches/april_2013/p07_update_file_data_custom_field.py +++ /dev/null @@ -1,11 +0,0 @@ -import webnotes -def execute(): - from patches.april_2013.p05_update_file_data import update_file_list, get_single_doctypes - singles = get_single_doctypes() - for doctype in webnotes.conn.sql("""select parent from `tabCustom Field` where - fieldname='file_list' and fieldtype='Text'"""): - update_file_list(doctype, singles) - - webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list' - and parent=%s""", doctype) - \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 096fec80abf..70aeb4a6ff7 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -247,5 +247,5 @@ patch_list = [ "execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')", "patches.april_2013.p06_default_cost_center", "execute:webnotes.reset_perms('File Data')", - "patches.april_2013.p07_update_file_data_custom_field", + "patches.april_2013.p07_update_file_data_2", ] \ No newline at end of file From 28eae6e9ff1d002e8232a60bcfc9c451a11fa745 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 15:25:52 +0530 Subject: [PATCH 29/35] [patch] [file data] fix --- patches/april_2013/p07_update_file_data_2.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/patches/april_2013/p07_update_file_data_2.py b/patches/april_2013/p07_update_file_data_2.py index 7b89a9de778..2405e80d658 100644 --- a/patches/april_2013/p07_update_file_data_2.py +++ b/patches/april_2013/p07_update_file_data_2.py @@ -6,6 +6,9 @@ def execute(): for doctype in webnotes.conn.sql_list("""select table_name from `information_schema`.`columns` where table_schema=%s and column_name='file_list'""", webnotes.conn.cur_db_name): doctype = doctype[3:] + + if not webnotes.conn.exists("DocType", doctype): continue + update_file_list(doctype, singles) webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list' From fe5fb33cc2e8c7f9a59e1f9d6d859b16623c93ec Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 15:27:57 +0530 Subject: [PATCH 30/35] [patch] [file data] fix --- patches/april_2013/p05_update_file_data.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index a5d2f7a07a2..787991251e1 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -56,20 +56,20 @@ def update_for_doc(doctype, doc): if exists: if webnotes.conn.exists("File Data", fileid): - fd = webnotes.bean("File Data", fileid) - if not (fd.doc.attached_to_doctype and fd.doc.attached_to_name): - fd.doc.attached_to_doctype = doctype - fd.doc.attached_to_name = doc.name - fd.save() - else: - try: + try: + fd = webnotes.bean("File Data", fileid) + if not (fd.doc.attached_to_doctype and fd.doc.attached_to_name): + fd.doc.attached_to_doctype = doctype + fd.doc.attached_to_name = doc.name + fd.save() + else: fd = webnotes.bean("File Data", copy=fd.doclist) fd.doc.attached_to_doctype = doctype fd.doc.attached_to_name = doc.name fd.doc.name = None fd.insert() - except webnotes.DuplicateEntryError: - pass + except webnotes.DuplicateEntryError: + pass else: webnotes.conn.sql("""delete from `tabFile Data` where name=%s""", fileid) \ No newline at end of file From fe9c1eb5df29b744016844c67f9ceb682034cdc1 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 16:36:59 +0530 Subject: [PATCH 31/35] [support ticket] clear assign to on closing ticket --- support/doctype/support_ticket/support_ticket.js | 14 +++++--------- support/doctype/support_ticket/support_ticket.py | 4 ++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index 3da81d9efbe..4ee4c1d9684 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -29,17 +29,13 @@ $.extend(cur_frm.cscript, { erpnext.hide_naming_series(); cur_frm.cscript.make_listing(doc); if(!doc.__islocal) { - if(in_list(user_roles,'System Manager')) { - if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']); - if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']); - }else if(doc.allocated_to) { - cur_frm.set_df_property('status','read_only', 1); - if(user==doc.allocated_to && doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']); + if(user_roles.indexOf("Support Manager")!==-1) { + if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']); + if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']); } - cur_frm.set_df_property('subject','read_only', 1); - cur_frm.set_df_property('description','hidden', 1); - cur_frm.set_df_property('raised_by','read_only', 1); + cur_frm.toggle_enable(["subject", "raised_by"], false); + cur_frm.toggle_display("description", false); } refresh_field('status'); }, diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py index 5625f1179cd..8a705f41c72 100644 --- a/support/doctype/support_ticket/support_ticket.py +++ b/support/doctype/support_ticket/support_ticket.py @@ -45,6 +45,10 @@ class DocType(TransactionBase): def validate(self): self.update_status() + if self.doc.status == "Closed": + from webnotes.widgets.form.assign_to import clear + clear(self.doc.doctype, self.doc.name) + def on_communication_sent(self, comm): webnotes.conn.set(self.doc, 'status', 'Waiting for Customer') if comm.lead and not self.doc.lead: From 98cfe688a85db05e22c9b5efe0d78029d8bc9cb1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Apr 2013 17:22:43 +0530 Subject: [PATCH 32/35] [script report] purchase register in new style --- accounts/page/accounts_home/accounts_home.js | 5 + accounts/report/purchase_register/__init__.py | 0 .../purchase_register/purchase_register.js | 43 +++++ .../purchase_register/purchase_register.py | 147 ++++++++++++++++++ .../purchase_register/purchase_register.txt | 21 +++ .../report/sales_register/sales_register.js | 1 + .../report/sales_register/sales_register.py | 4 +- .../bank_clearance_report.txt | 39 ++--- 8 files changed, 240 insertions(+), 20 deletions(-) create mode 100644 accounts/report/purchase_register/__init__.py create mode 100644 accounts/report/purchase_register/purchase_register.js create mode 100644 accounts/report/purchase_register/purchase_register.py create mode 100644 accounts/report/purchase_register/purchase_register.txt diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js index 2703d27f698..6a9f91a7194 100644 --- a/accounts/page/accounts_home/accounts_home.js +++ b/accounts/page/accounts_home/accounts_home.js @@ -154,6 +154,11 @@ wn.module_page["Accounts"] = [ route: "query-report/Sales Register", doctype: "Sales Invoice" }, + { + "label":wn._("Purchase Register"), + route: "query-report/Purchase Register", + doctype: "Purchase Invoice" + }, ] }, { diff --git a/accounts/report/purchase_register/__init__.py b/accounts/report/purchase_register/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/accounts/report/purchase_register/purchase_register.js b/accounts/report/purchase_register/purchase_register.js new file mode 100644 index 00000000000..f943e84db1d --- /dev/null +++ b/accounts/report/purchase_register/purchase_register.js @@ -0,0 +1,43 @@ +wn.query_reports["Purchase Register"] = { + "add_total_row": true, + "filters": [ + { + "fieldname":"from_date", + "label": "From Date", + "fieldtype": "Date", + "default": wn.defaults.get_user_default("year_start_date"), + "width": "80" + }, + { + "fieldname":"to_date", + "label": "To Date", + "fieldtype": "Date", + "default": get_today() + }, + { + "fieldname":"account", + "label": "Account", + "fieldtype": "Link", + "options": "Account", + "get_query": function() { + var company = wn.query_report.filters_by_name.company.get_value(); + return { + "query": "accounts.utils.get_account_list", + "filters": { + "is_pl_account": "No", + "debit_or_credit": "Credit", + "company": company, + "master_type": "Supplier" + } + } + } + }, + { + "fieldname":"company", + "label": "Company", + "fieldtype": "Link", + "options": "Company", + "default": sys_defaults.company + } + ] +} \ No newline at end of file diff --git a/accounts/report/purchase_register/purchase_register.py b/accounts/report/purchase_register/purchase_register.py new file mode 100644 index 00000000000..01dc93700b2 --- /dev/null +++ b/accounts/report/purchase_register/purchase_register.py @@ -0,0 +1,147 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from __future__ import unicode_literals +import webnotes +from webnotes.utils import flt + +def execute(filters=None): + if not filters: filters = {} + columns, expense_accounts, tax_accounts = get_columns() + + invoice_list = get_invoices(filters) + invoice_expense_map = get_invoice_expense_map(invoice_list) + invoice_tax_map = get_invoice_tax_map(invoice_list) + invoice_po_pr_map = get_invoice_po_pr_map(invoice_list) + account_map = get_account_details(invoice_list) + + data = [] + for inv in invoice_list: + # invoice details + purchase_order = ", ".join(invoice_po_pr_map.get(inv.name, {}).get("purchase_order", [])) + purchase_receipt = ", ".join(invoice_po_pr_map.get(inv.name, {}).get("purchase_receipt", [])) + row = [inv.name, inv.posting_date, inv.supplier, inv.credit_to, + account_map.get(inv.credit_to), inv.project_name, inv.bill_no, inv.bill_date, + inv.remarks, purchase_order, purchase_receipt] + + # map expense values + for expense_acc in expense_accounts: + row.append(invoice_expense_map.get(inv.name, {}).get(expense_acc)) + + # net total + row.append(inv.net_total) + + # tax account + for tax_acc in tax_accounts: + row.append(invoice_tax_map.get(inv.name, {}).get(tax_acc)) + + # total tax, grand total + row += [inv.total_tax, inv.grand_total] + data.append(row) + + return columns, data + + +def get_columns(): + """return columns based on filters""" + columns = [ + "Invoice:Link/Purchase Invoice:120", "Posting Date:Date:80", "Supplier:Link/Supplier:120", + "Supplier Account:Link/Account:120", "Account Group:LInk/Account:120", + "Project:Link/Project:80", "Bill No::120", "Bill Date:Date:80", "Remarks::150", + "Purchase Order:Link/Purchase Order:100", "Purchase Receipt:Link/Purchase Receipt:100" + ] + + expense_accounts = webnotes.conn.sql_list("""select distinct expense_head + from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(expense_head, '') != '' + order by expense_head""") + tax_accounts = webnotes.conn.sql_list("""select distinct account_head + from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice' + and docstatus = 1 and ifnull(account_head, '') != '' order by account_head""") + + columns = columns + [(account + ":Currency:120") for account in expense_accounts] + \ + ["Net Total:Currency:120"] + [(account + ":Currency:120") for account in tax_accounts] + \ + ["Total Tax:Currency:120"] + ["Grand Total:Currency:120"] + + return columns, expense_accounts, tax_accounts + +def get_conditions(filters): + conditions = "" + + if filters.get("company"): conditions += " and company=%(company)s" + if filters.get("account"): conditions += " and account = %(account)s" + + if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s" + if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s" + + return conditions + +def get_invoices(filters): + conditions = get_conditions(filters) + return webnotes.conn.sql("""select name, posting_date, credit_to, project_name, supplier, + bill_no, bill_date, remarks, net_total, total_tax, grand_total + from `tabPurchase Invoice` where docstatus = 1 %s + order by posting_date desc, name desc""" % conditions, filters, as_dict=1) + +def get_invoice_expense_map(invoice_list): + expense_details = webnotes.conn.sql("""select parent, expense_head, sum(amount) as amount + from `tabPurchase Invoice Item` where parent in (%s) group by parent, expense_head""" % + ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1) + + invoice_expense_map = {} + for d in expense_details: + invoice_expense_map.setdefault(d.parent, webnotes._dict()).setdefault(d.expense_head, []) + invoice_expense_map[d.parent][d.expense_head] = flt(d.amount) + + return invoice_expense_map + +def get_invoice_tax_map(invoice_list): + tax_details = webnotes.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount + from `tabPurchase Taxes and Charges` where parent in (%s) group by parent, account_head""" % + ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1) + + invoice_tax_map = {} + for d in tax_details: + invoice_tax_map.setdefault(d.parent, webnotes._dict()).setdefault(d.account_head, []) + invoice_tax_map[d.parent][d.account_head] = flt(d.tax_amount) + + return invoice_tax_map + +def get_invoice_po_pr_map(invoice_list): + pi_items = webnotes.conn.sql("""select parent, purchase_order, purchase_receipt + from `tabPurchase Invoice Item` where parent in (%s) + and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')""" % + ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1) + + invoice_po_pr_map = {} + for d in pi_items: + if d.purchase_order: + invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault( + "purchase_order", []).append(d.purchase_order) + if d.purchase_receipt: + invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault( + "purchase_receipt", []).append(d.purchase_receipt) + + return invoice_po_pr_map + +def get_account_details(invoice_list): + account_map = {} + accounts = list(set([inv.credit_to for inv in invoice_list])) + for acc in webnotes.conn.sql("""select name, parent_account from tabAccount + where name in (%s)""" % ", ".join(["%s"]*len(accounts)), tuple(accounts), as_dict=1): + account_map.setdefault(acc.name, "") + account_map[acc.name] = acc.parent_account + + return account_map \ No newline at end of file diff --git a/accounts/report/purchase_register/purchase_register.txt b/accounts/report/purchase_register/purchase_register.txt new file mode 100644 index 00000000000..799971ef0a3 --- /dev/null +++ b/accounts/report/purchase_register/purchase_register.txt @@ -0,0 +1,21 @@ +[ + { + "creation": "2013-04-29 16:13:11", + "docstatus": 0, + "modified": "2013-04-29 16:13:11", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "ref_doctype": "Purchase Invoice", + "report_name": "Purchase Register", + "report_type": "Script Report" + }, + { + "doctype": "Report", + "name": "Purchase Register" + } +] \ No newline at end of file diff --git a/accounts/report/sales_register/sales_register.js b/accounts/report/sales_register/sales_register.js index 82246198c95..cf4543a7137 100644 --- a/accounts/report/sales_register/sales_register.js +++ b/accounts/report/sales_register/sales_register.js @@ -1,4 +1,5 @@ wn.query_reports["Sales Register"] = { + "add_total_row": true, "filters": [ { "fieldname":"from_date", diff --git a/accounts/report/sales_register/sales_register.py b/accounts/report/sales_register/sales_register.py index 07772cb4e2c..a0020c45a06 100644 --- a/accounts/report/sales_register/sales_register.py +++ b/accounts/report/sales_register/sales_register.py @@ -94,8 +94,8 @@ def get_conditions(filters): def get_invoices(filters): conditions = get_conditions(filters) - return webnotes.conn.sql("""select name, posting_date, territory, debit_to, territory, - project_name, customer, remarks, net_total, other_charges_total, grand_total + return webnotes.conn.sql("""select name, posting_date, debit_to, project_name, customer, + remarks, net_total, other_charges_total, grand_total from `tabSales Invoice` where docstatus = 1 %s order by posting_date desc, name desc""" % conditions, filters, as_dict=1) diff --git a/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt b/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt index 00384386f52..8aa94bf50a0 100644 --- a/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt +++ b/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt @@ -1,29 +1,32 @@ [ { - "owner": "Administrator", + "creation": "2012-05-14 18:05:41", "docstatus": 0, - "creation": "2012-04-03 12:49:50", + "modified": "2013-04-30 14:49:06", "modified_by": "Administrator", - "modified": "2012-04-03 12:49:50" + "owner": "Administrator" }, { - "description": "Bank Clearance report", - "parent_doc_type": "Journal Voucher", - "module": "Accounts", - "standard": "Yes", - "sort_order": "DESC", - "filters": "{'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Fiscal Year':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':''}", - "dis_filters": "fiscal_year", - "doc_type": "Journal Voucher Detail", - "name": "__common__", - "doctype": "Search Criteria", - "sort_by": "ID", - "page_len": 50, + "columns": "Journal Voucher\u0001ID,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Debit,Journal Voucher Detail\u0001Credit,Journal Voucher\u0001Clearance Date,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher\u0001Voucher Date,Journal Voucher\u0001Posting Date,Journal Voucher Detail\u0001Against Payable,Journal Voucher Detail\u0001Against Receivable", "criteria_name": "Bank Clearance report", - "columns": "Journal Voucher\u0001ID,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Debit,Journal Voucher Detail\u0001Credit,Journal Voucher\u0001Clearance Date,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher\u0001Voucher Date,Journal Voucher\u0001Posting Date,Journal Voucher Detail\u0001Against Payable,Journal Voucher Detail\u0001Against Receivable" + "custom_query": "", + "description": "Bank Clearance report", + "dis_filters": "fiscal_year", + "disabled": 0, + "doc_type": "Journal Voucher Detail", + "doctype": "Search Criteria", + "filters": "{'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Fiscal Year':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':''}", + "module": "Accounts", + "name": "__common__", + "page_len": 50, + "parent_doc_type": "Journal Voucher", + "report_script": null, + "sort_by": "ID", + "sort_order": "DESC", + "standard": "Yes" }, { - "name": "bank_clearance_report", - "doctype": "Search Criteria" + "doctype": "Search Criteria", + "name": "bank_clearance_report" } ] \ No newline at end of file From 84e2af2212bf3025a06ae9dbb5b565d36e62afd0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Apr 2013 18:08:43 +0530 Subject: [PATCH 33/35] [report] add total row --- .../report/accounts_payable/accounts_payable.py | 12 ++---------- .../report/accounts_payable/accounts_payable.txt | 3 ++- .../accounts_receivable/accounts_receivable.py | 13 ++----------- .../accounts_receivable/accounts_receivable.txt | 3 ++- .../report/purchase_register/purchase_register.js | 1 - .../report/purchase_register/purchase_register.txt | 3 ++- accounts/report/sales_register/sales_register.js | 1 - accounts/report/sales_register/sales_register.txt | 3 ++- 8 files changed, 12 insertions(+), 27 deletions(-) diff --git a/accounts/report/accounts_payable/accounts_payable.py b/accounts/report/accounts_payable/accounts_payable.py index 34c8ccd2be2..a10dc7e7e7d 100644 --- a/accounts/report/accounts_payable/accounts_payable.py +++ b/accounts/report/accounts_payable/accounts_payable.py @@ -19,7 +19,6 @@ def execute(filters=None): and nowdate() or filters.get("report_date") data = [] - total_invoiced_amount = total_paid = total_outstanding = 0 for gle in entries: if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \ or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date: @@ -36,7 +35,7 @@ def execute(filters=None): paid_amount = get_paid_amount(gle, filters.get("report_date") or nowdate(), entries_after_report_date) outstanding_amount = invoiced_amount - paid_amount - + if abs(flt(outstanding_amount)) > 0.01: row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no, gle.remarks, account_supplier_type_map.get(gle.account), due_date, bill_no, @@ -47,16 +46,9 @@ def execute(filters=None): ageing_based_on_date = due_date else: ageing_based_on_date = gle.posting_date + row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount) - - # Add to total - total_invoiced_amount += flt(invoiced_amount) - total_paid += flt(paid_amount) - total_outstanding += flt(outstanding_amount) data.append(row) - if data: - data.append(["", "", "", "", "", "", "", "Total", "", total_invoiced_amount, total_paid, - total_outstanding, "", "", "", ""]) return columns, data diff --git a/accounts/report/accounts_payable/accounts_payable.txt b/accounts/report/accounts_payable/accounts_payable.txt index 8920a0bf2ee..6de97f64e6e 100644 --- a/accounts/report/accounts_payable/accounts_payable.txt +++ b/accounts/report/accounts_payable/accounts_payable.txt @@ -2,11 +2,12 @@ { "creation": "2013-04-22 16:16:03", "docstatus": 0, - "modified": "2013-04-23 14:54:27", + "modified": "2013-04-30 17:55:54", "modified_by": "Administrator", "owner": "Administrator" }, { + "add_total_row": 1, "doctype": "Report", "is_standard": "Yes", "name": "__common__", diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index d385b36b902..a8c6d2311eb 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -18,7 +18,6 @@ def execute(filters=None): and nowdate() or filters.get("report_date") data = [] - total_invoiced_amount = total_payment = total_outstanding = 0 for gle in entries: if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \ or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date: @@ -41,17 +40,9 @@ def execute(filters=None): else: ageing_based_on_date = gle.posting_date row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount) - - # Add to total - total_invoiced_amount += flt(invoiced_amount) - total_payment += flt(payment_amount) - total_outstanding += flt(outstanding_amount) - + data.append(row) - if data: - data.append(["", "", "", "", "", "", "Total", total_invoiced_amount, total_payment, - total_outstanding, "", "", "", ""]) - + return columns, data def get_columns(): diff --git a/accounts/report/accounts_receivable/accounts_receivable.txt b/accounts/report/accounts_receivable/accounts_receivable.txt index 28f7e4f44dd..7eb344fc087 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.txt +++ b/accounts/report/accounts_receivable/accounts_receivable.txt @@ -2,11 +2,12 @@ { "creation": "2013-04-16 11:31:13", "docstatus": 0, - "modified": "2013-04-16 11:31:13", + "modified": "2013-04-30 17:54:47", "modified_by": "Administrator", "owner": "Administrator" }, { + "add_total_row": 1, "doctype": "Report", "is_standard": "Yes", "name": "__common__", diff --git a/accounts/report/purchase_register/purchase_register.js b/accounts/report/purchase_register/purchase_register.js index f943e84db1d..21e0547f4a5 100644 --- a/accounts/report/purchase_register/purchase_register.js +++ b/accounts/report/purchase_register/purchase_register.js @@ -1,5 +1,4 @@ wn.query_reports["Purchase Register"] = { - "add_total_row": true, "filters": [ { "fieldname":"from_date", diff --git a/accounts/report/purchase_register/purchase_register.txt b/accounts/report/purchase_register/purchase_register.txt index 799971ef0a3..847f5f3b6cb 100644 --- a/accounts/report/purchase_register/purchase_register.txt +++ b/accounts/report/purchase_register/purchase_register.txt @@ -2,11 +2,12 @@ { "creation": "2013-04-29 16:13:11", "docstatus": 0, - "modified": "2013-04-29 16:13:11", + "modified": "2013-04-30 17:51:19", "modified_by": "Administrator", "owner": "Administrator" }, { + "add_total_row": 1, "doctype": "Report", "is_standard": "Yes", "name": "__common__", diff --git a/accounts/report/sales_register/sales_register.js b/accounts/report/sales_register/sales_register.js index cf4543a7137..82246198c95 100644 --- a/accounts/report/sales_register/sales_register.js +++ b/accounts/report/sales_register/sales_register.js @@ -1,5 +1,4 @@ wn.query_reports["Sales Register"] = { - "add_total_row": true, "filters": [ { "fieldname":"from_date", diff --git a/accounts/report/sales_register/sales_register.txt b/accounts/report/sales_register/sales_register.txt index 5aef8145968..dbf41af0d0d 100644 --- a/accounts/report/sales_register/sales_register.txt +++ b/accounts/report/sales_register/sales_register.txt @@ -2,11 +2,12 @@ { "creation": "2013-04-23 18:15:29", "docstatus": 0, - "modified": "2013-04-23 18:15:29", + "modified": "2013-04-30 17:53:10", "modified_by": "Administrator", "owner": "Administrator" }, { + "add_total_row": 1, "doctype": "Report", "is_standard": "Yes", "name": "__common__", From 91e4c144705e1c2417e77100ac9678120c20dc97 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 1 May 2013 12:00:44 +0530 Subject: [PATCH 34/35] [fixes] [__islocal] use doc.fields.get('__islocal') instead of doc.__islocal --- accounts/doctype/cost_center/cost_center.py | 2 +- stock/doctype/item/item.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/cost_center/cost_center.py b/accounts/doctype/cost_center/cost_center.py index e57b6a37582..a7672452aad 100644 --- a/accounts/doctype/cost_center/cost_center.py +++ b/accounts/doctype/cost_center/cost_center.py @@ -81,7 +81,7 @@ class DocType(DocTypeNestedSet): """ Cost Center name must be unique """ - if (self.doc.__islocal or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)): + if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)): msgprint("Cost Center Name already exists, please rename", raise_exception=1) self.validate_mandatory() diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index fce6f32543f..6b6dfb37005 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -55,7 +55,7 @@ class DocType(DocListController): ch.conversion_factor = 1 def check_stock_uom_with_bin(self): - if not self.doc.__islocal: + if not self.doc.fields.get("__islocal"): bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s", self.doc.name) if self.doc.stock_uom and bin and cstr(bin[0][0]) \ From 4120ffefa1657255eae64d89b5cc276afe4ed200 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 1 May 2013 12:14:57 +0530 Subject: [PATCH 35/35] [project] [query] removed debug --- projects/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/utils.py b/projects/utils.py index a7a016ab3e0..7a45b08d9d3 100644 --- a/projects/utils.py +++ b/projects/utils.py @@ -5,4 +5,4 @@ import webnotes @webnotes.whitelist() def get_time_log_list(doctype, txt, searchfield, start, page_len, filters): - return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"], debug=True) \ No newline at end of file + return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"]) \ No newline at end of file