From 4f856f1250c2a30bdb2bf2b45c1eb37ae34885ff Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Mar 2013 15:44:38 +0530 Subject: [PATCH 1/6] fixes in buying_amount_calculation --- stock/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stock/utils.py b/stock/utils.py index 20d08ea3eb..bf5e2f9dcd 100644 --- a/stock/utils.py +++ b/stock/utils.py @@ -171,7 +171,7 @@ def get_buying_amount(item_code, warehouse, qty, voucher_type, voucher_no, vouch buying_amount = 0.0 for bom_item in item_sales_bom[item_code]: buying_amount += _get_buying_amount(voucher_type, voucher_no, "[** No Item Row **]", - item_code, warehouse, bom_item.qty * qty, stock_ledger_entries) + bom_item.item_code, warehouse, bom_item.qty * qty, stock_ledger_entries) return buying_amount else: # doesn't have sales bom @@ -188,13 +188,13 @@ def _get_buying_amount(voucher_type, voucher_no, item_row, item_code, warehouse, abs(flt(sle.qty)) == qty): buying_amount = flt(stock_ledger_entries[i+1].stock_value) - \ flt(sle.stock_value) - return buying_amount - return 0.0 def get_sales_bom(): item_sales_bom = {} + # for r in webnotes.conn.sql("""select parent_item, item_code, qty, warehouse, voucher_detail_no + # from `tabDelivery Note Packing Item` where docstatus = 1""", as_dict=1): for r in webnotes.conn.sql("""select parent, item_code, qty from `tabSales BOM Item`""", as_dict=1): item_sales_bom.setdefault(r.parent, []).append(r) From e5c395f8b68d3471b3411f8841d3fd401a8f50d6 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 12 Mar 2013 18:20:06 +0530 Subject: [PATCH 2/6] fix in style settings color validation --- website/doctype/style_settings/style_settings.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/website/doctype/style_settings/style_settings.py b/website/doctype/style_settings/style_settings.py index bf46afb97d..91ca0a579e 100644 --- a/website/doctype/style_settings/style_settings.py +++ b/website/doctype/style_settings/style_settings.py @@ -53,13 +53,15 @@ class DocType: del self.doc.fields[f] def validate_colors(self): - if self.doc.page_background==self.doc.page_text: - webnotes.msgprint(_("Page text and background is same color. Please change."), - raise_exception=1) + if (self.doc.page_background or self.doc.page_text) and \ + self.doc.page_background==self.doc.page_text: + webnotes.msgprint(_("Page text and background is same color. Please change."), + raise_exception=1) - if self.doc.top_bar_background==self.doc.top_bar_foreground: - webnotes.msgprint(_("Top Bar text and background is same color. Please change."), - raise_exception=1) + if (self.doc.top_bar_background or self.doc.top_bar_foreground) and \ + self.doc.top_bar_background==self.doc.top_bar_foreground: + webnotes.msgprint(_("Top Bar text and background is same color. Please change."), + raise_exception=1) def prepare(self): From 725173aca584dc04c534ef751b50effe4cda4b42 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Mar 2013 18:21:24 +0530 Subject: [PATCH 3/6] fixed monthly attendance report --- .../monthly_attendance_details/monthly_attendance_details.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.sql b/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.sql index 7487fb4010..762a94f7fb 100644 --- a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.sql +++ b/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.sql @@ -1 +1 @@ -SELECT DISTINCT `tabAttendance`.employee, `tabAttendance`.employee_name FROM `tabAttendance` WHERE `tabAttendance`.fiscal_year like '%(fiscal_year)s%%' AND `tabAttendance`.`company` like '%(company)s%%' AND `tabAttendance`.`employee` like '%(employee)s%%' \ No newline at end of file +SELECT DISTINCT `tabAttendance`.employee, `tabEmployee`.employee_name FROM `tabAttendance`, `tabEmployee` WHERE `tabEmployee`.name = `tabAttendance`.employee and `tabAttendance`.fiscal_year like '%(fiscal_year)s%%' AND `tabAttendance`.company like '%(company)s%%' AND `tabAttendance`.employee like '%(employee)s%%' \ No newline at end of file From 4fad8743565e88c8c223b71922e1d0913147da52 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Mar 2013 18:27:25 +0530 Subject: [PATCH 4/6] reload monthly attendance details report --- patches/patch_list.py | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/patch_list.py b/patches/patch_list.py index 7409c0e986..935fe299d3 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -213,4 +213,5 @@ patch_list = [ "patches.march_2013.p02_get_global_default", "execute:webnotes.bean('Style Settings', 'Style Settings').save()", "patches.march_2013.p03_rename_blog_to_blog_post", + "execute:webnotes.reload_doc('hr', 'search_criteria', 'monthly_attendance_details')", ] \ No newline at end of file From 6e62940f70828634ba2904a5b8cf695ee2d86c2f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 12 Mar 2013 18:28:07 +0530 Subject: [PATCH 5/6] do not reload blog post before rename --- patches/patch_list.py | 1 - 1 file changed, 1 deletion(-) diff --git a/patches/patch_list.py b/patches/patch_list.py index 7409c0e986..2b5a1213dc 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -189,7 +189,6 @@ patch_list = [ "execute:webnotes.delete_doc('DocType', 'Service Order Detail')", "execute:webnotes.delete_doc('DocType', 'Service Quotation Detail')", "patches.february_2013.p06_material_request_mappers", - "patches.february_2013.p07_clear_web_cache", "execute:webnotes.delete_doc('Page', 'Query Report')", "execute:webnotes.delete_doc('Search Criteria', 'employeewise_balance_leave_report')", "execute:webnotes.delete_doc('Search Criteria', 'employee_leave_balance_report')", From 2e6806ee6a0b6022fadb51529133e30d7a29ec92 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 12 Mar 2013 20:04:30 +0530 Subject: [PATCH 6/6] fixes in blog comments --- patches/february_2013/p07_clear_web_cache.py | 6 ------ website/helpers/blog.py | 2 +- website/templates/js/blog_page.js | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 patches/february_2013/p07_clear_web_cache.py diff --git a/patches/february_2013/p07_clear_web_cache.py b/patches/february_2013/p07_clear_web_cache.py deleted file mode 100644 index 26329249d0..0000000000 --- a/patches/february_2013/p07_clear_web_cache.py +++ /dev/null @@ -1,6 +0,0 @@ -import webnotes - -def execute(): - webnotes.reload_doc("website", "doctype", "blog_post") - from website.utils import clear_cache - clear_cache() diff --git a/website/helpers/blog.py b/website/helpers/blog.py index 5ee3451956..1f25ac0145 100644 --- a/website/helpers/blog.py +++ b/website/helpers/blog.py @@ -83,7 +83,7 @@ def add_comment(args=None): # notify commentors commentors = [d[0] for d in webnotes.conn.sql("""select comment_by from tabComment where - comment_doctype='Blog' and comment_docname=%s and + comment_doctype='Blog Post' and comment_docname=%s and ifnull(unsubscribed, 0)=0""", args.get('comment_docname'))] blog = webnotes.conn.sql("""select * from `tabBlog Post` where name=%s""", diff --git a/website/templates/js/blog_page.js b/website/templates/js/blog_page.js index d5e99709bc..efdd6bca8a 100644 --- a/website/templates/js/blog_page.js +++ b/website/templates/js/blog_page.js @@ -36,7 +36,7 @@ $(document).ready(function() { comment_by: $("[name='comment_by']").val(), comment: $("[name='comment']").val(), cmd: "website.helpers.blog.add_comment", - comment_doctype: "Blog", + comment_doctype: "Blog Post", comment_docname: "{{ name }}", page_name: "{{ page_name }}", _type: "POST"