From 89bd216a0c411588d273669d8b18731e30459221 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 26 Jun 2013 18:28:54 +0530 Subject: [PATCH 1/8] [Fix] SMS Center --- .../purchase_taxes_and_charges_master.js | 2 +- .../purchase_taxes_and_charges_master.py | 14 +++++++------- .../sales_invoice_item/sales_invoice_item.txt | 7 ++++--- .../supplier_quotation/supplier_quotation.js | 1 - selling/doctype/sms_center/sms_center.py | 7 ++++--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js index 53588e0629..f04f895baf 100644 --- a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js +++ b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js @@ -147,7 +147,7 @@ cur_frm.cscript.account_head = function(doc, cdt, cdn) { d.account_head = ''; } else if(d.account_head && d.charge_type) { - arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}"; + arg = "{'charge_type' : '" + d.charge_type + "', 'account_head' : '" + d.account_head + "'}"; get_server_fields('get_rate', arg, 'purchase_tax_details', doc, cdt, cdn, 1); } refresh_field('account_head',d.name,'purchase_tax_details'); diff --git a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py index 1250db5c28..995415e29a 100644 --- a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py +++ b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py @@ -26,11 +26,11 @@ sql = webnotes.conn.sql class DocType: - def __init__(self, doc, doclist=[]): - self.doc = doc - self.doclist = doclist + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist - # Get Tax Rate if account type is Tax - # =================================================================== - def get_rate(self, arg): - return get_obj('Purchase Common').get_rate(arg, self) \ No newline at end of file + # Get Tax Rate if account type is Tax + # =================================================================== + def get_rate(self, arg): + return get_obj('Purchase Common').get_rate(arg, self) \ No newline at end of file diff --git a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt index 89c86f8219..82ad3b1527 100644 --- a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt +++ b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-04-19 11:00:07", + "creation": "2013-06-04 11:02:19", "docstatus": 0, - "modified": "2013-05-22 12:06:15", + "modified": "2013-06-26 14:33:21", "modified_by": "Administrator", "owner": "Administrator" }, @@ -243,7 +243,8 @@ "oldfieldname": "serial_no", "oldfieldtype": "Small Text", "print_hide": 0, - "read_only": 0 + "read_only": 0, + "reqd": 0 }, { "doctype": "DocField", diff --git a/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js index 1e4f6cbfb7..bac6e9f4ef 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/buying/doctype/supplier_quotation/supplier_quotation.js @@ -87,7 +87,6 @@ cur_frm.cscript.supplier = function(doc, dt, dn) { get_server_fields('get_default_supplier_address', JSON.stringify({ supplier: doc.supplier }), '', doc, dt, dn, 1, function() { cur_frm.refresh(); }); - cur_frm.cscript.toggle_contact_section(doc); } } diff --git a/selling/doctype/sms_center/sms_center.py b/selling/doctype/sms_center/sms_center.py index 7d50e71232..8b404e6a4d 100644 --- a/selling/doctype/sms_center/sms_center.py +++ b/selling/doctype/sms_center/sms_center.py @@ -35,11 +35,12 @@ class DocType: def create_receiver_list(self): rec, where_clause = '', '' if self.doc.send_to == 'All Customer Contact': - where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(is_customer, 0) = 1" + where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(customer, '') != ''" if self.doc.send_to == 'All Supplier Contact': - where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(is_supplier, 0) = 1" + where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(supplier, '') != ''" if self.doc.send_to == 'All Sales Partner Contact': - where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_aprtner = '%s'" % self.doc.sales_partner or " and ifnull(is_sales_partner, 0) = 1" + where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_partner = '%s'" % self.doc.sales_partner or " and ifnull(sales_partner, '') != ''" + if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']: rec = sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause) elif self.doc.send_to == 'All Lead (Open)': From 4924a9f7648cb3515fdbe282a77926527a715e9b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 27 Jun 2013 11:01:14 +0530 Subject: [PATCH 2/8] [fix] payment reconciliation tool --- .../payment_to_invoice_matching_tool.js | 1 + 1 file changed, 1 insertion(+) diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js index 8b35bc1028..ac7d9d2d14 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js @@ -50,6 +50,7 @@ cur_frm.fields_dict.voucher_no.get_query = function(doc) { where against_voucher_type = '%(dt)s' \ and against_voucher = gle.voucher_no \ and voucher_no != gle.voucher_no \ + and account = gle.account \ and ifnull(is_cancelled, 'No') = 'No') != \ abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) \ ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50", From f47617c6e606e10eaa78b1168819c60f93a1d2bd Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 27 Jun 2013 11:01:36 +0530 Subject: [PATCH 3/8] [Fix] Purchase Register --- .../purchase_register/purchase_register.py | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/accounts/report/purchase_register/purchase_register.py b/accounts/report/purchase_register/purchase_register.py index d6233a41e0..6bc35218c9 100644 --- a/accounts/report/purchase_register/purchase_register.py +++ b/accounts/report/purchase_register/purchase_register.py @@ -40,9 +40,10 @@ def execute(filters=None): # invoice details purchase_order = list(set(invoice_po_pr_map.get(inv.name, {}).get("purchase_order", []))) purchase_receipt = list(set(invoice_po_pr_map.get(inv.name, {}).get("purchase_receipt", []))) + project_name = list(set(invoice_po_pr_map.get(inv.name, {}).get("project_name", []))) 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, + account_map.get(inv.credit_to), ", ".join(project_name), inv.bill_no, inv.bill_date, inv.remarks, ", ".join(purchase_order), ", ".join(purchase_receipt)] # map expense values @@ -105,11 +106,10 @@ def get_conditions(filters): def get_invoices(filters): conditions = get_conditions(filters) - return webnotes.conn.sql("""select pi.name, pi.posting_date, pi.credit_to, - pii.project_name, pi.supplier, pi.bill_no, pi.bill_date, pi.remarks, pi.net_total, - pi.total_tax, pi.grand_total, pi.outstanding_amount - from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pii - where pii.parent = pi.name and pi.docstatus = 1 %s + return webnotes.conn.sql("""select name, posting_date, credit_to, + supplier, bill_no, bill_date, remarks, net_total, + total_tax, grand_total, outstanding_amount + from `tabPurchase Invoice` where docstatus = 1 %s order by posting_date desc, name desc""" % conditions, filters, as_dict=1) @@ -138,8 +138,8 @@ def get_invoice_tax_map(invoice_list): 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) + pi_items = webnotes.conn.sql("""select parent, purchase_order, purchase_receipt, + project_name 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) @@ -151,6 +151,11 @@ def get_invoice_po_pr_map(invoice_list): if d.purchase_receipt: invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault( "purchase_receipt", []).append(d.purchase_receipt) + if d.project_name: + invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault( + "project_name", []).append(d.project_name) + + webnotes.errprint(invoice_po_pr_map) return invoice_po_pr_map From f1845cf7c977ef3dbf5c34dc7ee25675dc9810d9 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 27 Jun 2013 11:06:11 +0530 Subject: [PATCH 4/8] Removed errprint from purchase register --- accounts/report/purchase_register/purchase_register.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/accounts/report/purchase_register/purchase_register.py b/accounts/report/purchase_register/purchase_register.py index 6bc35218c9..655cf8ced0 100644 --- a/accounts/report/purchase_register/purchase_register.py +++ b/accounts/report/purchase_register/purchase_register.py @@ -154,8 +154,6 @@ def get_invoice_po_pr_map(invoice_list): if d.project_name: invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault( "project_name", []).append(d.project_name) - - webnotes.errprint(invoice_po_pr_map) return invoice_po_pr_map From c35dd968af8e21a7e60c2eaa192bd84be9276382 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 27 Jun 2013 12:21:34 +0530 Subject: [PATCH 5/8] [fix] invoice with zero values --- accounts/doctype/sales_invoice/sales_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index c17654a601..956867d7ab 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -149,7 +149,7 @@ class DocType(SellingController): ret = get_obj('Sales Common').get_item_details(item.fields, self) for fieldname, value in ret.items(): if self.meta.get_field(fieldname, parentfield="entries") and \ - not item.fields.get(fieldname): + item.fields.get(fieldname) is None: item.fields[fieldname] = value # fetch pos details, if they are not fetched From d6cc5cd08f9e65b706f7a56a94a099dc1b21b58f Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 28 Jun 2013 10:09:46 +0530 Subject: [PATCH 6/8] [Trends Teports] cleanup --- .../purchase_invoice_trends/purchase_invoice_trends.py | 3 +-- .../report/sales_invoice_trends/sales_invoice_trends.py | 3 +-- .../report/purchase_order_trends/purchase_order_trends.py | 3 +-- selling/report/quotation_trends/quotation_trends.py | 3 +-- selling/report/sales_order_trends/sales_order_trends.py | 3 +-- stock/report/delivery_note_trends/delivery_note_trends.py | 3 +-- .../purchase_receipt_trends/purchase_receipt_trends.py | 8 ++------ 7 files changed, 8 insertions(+), 18 deletions(-) diff --git a/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py b/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py index a558a6cecf..659cb85398 100644 --- a/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py +++ b/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py @@ -21,8 +21,7 @@ from controllers.trends import get_columns,get_data def execute(filters=None): if not filters: filters ={} data = [] - trans = "Purchase Invoice" - conditions = get_columns(filters, trans) + conditions = get_columns(filters, "Purchase Invoice") data = get_data(filters, conditions) return conditions["columns"], data \ No newline at end of file diff --git a/accounts/report/sales_invoice_trends/sales_invoice_trends.py b/accounts/report/sales_invoice_trends/sales_invoice_trends.py index a1068340ec..9a5eaf2f8d 100644 --- a/accounts/report/sales_invoice_trends/sales_invoice_trends.py +++ b/accounts/report/sales_invoice_trends/sales_invoice_trends.py @@ -21,8 +21,7 @@ from controllers.trends import get_columns,get_data def execute(filters=None): if not filters: filters ={} data = [] - trans = "Sales Invoice" - conditions = get_columns(filters, trans) + conditions = get_columns(filters, "Sales Invoice") data = get_data(filters, conditions) return conditions["columns"], data \ No newline at end of file diff --git a/buying/report/purchase_order_trends/purchase_order_trends.py b/buying/report/purchase_order_trends/purchase_order_trends.py index 9b294656c3..9dc986e456 100644 --- a/buying/report/purchase_order_trends/purchase_order_trends.py +++ b/buying/report/purchase_order_trends/purchase_order_trends.py @@ -21,8 +21,7 @@ from controllers.trends import get_columns,get_data def execute(filters=None): if not filters: filters ={} data = [] - trans = "Purchase Order" - conditions = get_columns(filters, trans) + conditions = get_columns(filters, "Purchase Order") data = get_data(filters, conditions) return conditions["columns"], data \ No newline at end of file diff --git a/selling/report/quotation_trends/quotation_trends.py b/selling/report/quotation_trends/quotation_trends.py index d08e0f87f1..29f9ef82c2 100644 --- a/selling/report/quotation_trends/quotation_trends.py +++ b/selling/report/quotation_trends/quotation_trends.py @@ -21,8 +21,7 @@ from controllers.trends import get_columns, get_data def execute(filters=None): if not filters: filters ={} data = [] - trans = "Quotation" - conditions = get_columns(filters, trans) + conditions = get_columns(filters, "Quotation") data = get_data(filters, conditions) return conditions["columns"], data \ No newline at end of file diff --git a/selling/report/sales_order_trends/sales_order_trends.py b/selling/report/sales_order_trends/sales_order_trends.py index 455fbd4e63..ac7c3ab97b 100644 --- a/selling/report/sales_order_trends/sales_order_trends.py +++ b/selling/report/sales_order_trends/sales_order_trends.py @@ -21,8 +21,7 @@ from controllers.trends import get_columns,get_data def execute(filters=None): if not filters: filters ={} data = [] - trans = "Sales Order" - conditions = get_columns(filters, trans) + conditions = get_columns(filters, "Sales Order") data = get_data(filters, conditions) return conditions["columns"], data \ No newline at end of file diff --git a/stock/report/delivery_note_trends/delivery_note_trends.py b/stock/report/delivery_note_trends/delivery_note_trends.py index 9878ecc867..e5b2cd094b 100644 --- a/stock/report/delivery_note_trends/delivery_note_trends.py +++ b/stock/report/delivery_note_trends/delivery_note_trends.py @@ -21,8 +21,7 @@ from controllers.trends import get_columns,get_data def execute(filters=None): if not filters: filters ={} data = [] - trans = "Delivery Note" - conditions = get_columns(filters, trans) + conditions = get_columns(filters, "Delivery Note") data = get_data(filters, conditions) return conditions["columns"], data \ No newline at end of file diff --git a/stock/report/purchase_receipt_trends/purchase_receipt_trends.py b/stock/report/purchase_receipt_trends/purchase_receipt_trends.py index 56c0023a2f..b41ce281f7 100644 --- a/stock/report/purchase_receipt_trends/purchase_receipt_trends.py +++ b/stock/report/purchase_receipt_trends/purchase_receipt_trends.py @@ -21,11 +21,7 @@ from controllers.trends import get_columns,get_data def execute(filters=None): if not filters: filters ={} data = [] - trans = "Purchase Receipt" - conditions = get_columns(filters, trans) - data = get_data(filters, tab, conditions) - - if not data : - webnotes.msgprint("Data not found for selected criterias") + conditions = get_columns(filters, "Purchase Receipt") + data = get_data(filters, conditions) return conditions["columns"], data \ No newline at end of file From b164edc16f6a85a16445fc0c36be61b9eada4d82 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 28 Jun 2013 13:03:39 +0530 Subject: [PATCH 7/8] [fix] cleanup data --- utilities/cleanup_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/cleanup_data.py b/utilities/cleanup_data.py index ed04a94bfa..c9de4a5e23 100644 --- a/utilities/cleanup_data.py +++ b/utilities/cleanup_data.py @@ -27,7 +27,7 @@ def delete_transactions(): 'Maintenance Schedule', 'Leave Application', 'Leave Allocation', 'Lead', 'Journal Voucher', 'Installation Note', 'Material Request', 'GL Entry', 'Expense Claim', 'Opportunity', 'Delivery Note', 'Customer Issue', 'Bin', 'Authorization Rule', 'Attendance', 'C-Form', - 'Appraisal', 'Installation Note', 'Communication'] + 'Appraisal', 'Installation Note', 'Communication', "Supplier Quotation"] for d in trans: for t in webnotes.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d): webnotes.conn.sql("delete from `tab%s`" % (t)) From ac24d0fa986431980510a2e0ba0487831788a576 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Jul 2013 14:03:08 +0530 Subject: [PATCH 8/8] [fixes] ignore single doctypes in chekcing linked documents --- patches/patch_list.py | 1 + utilities/cleanup_data.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/patches/patch_list.py b/patches/patch_list.py index efd4d51cce..4955c75e6c 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -242,4 +242,5 @@ patch_list = [ "execute:webnotes.delete_doc('DocType', 'System Console')", "patches.june_2013.p04_fix_event_for_lead_oppty_project", "patches.june_2013.p05_remove_search_criteria_reports", + "execute:webnotes.delete_doc('DocType', 'Update Delivery Date')", ] \ No newline at end of file diff --git a/utilities/cleanup_data.py b/utilities/cleanup_data.py index c9de4a5e23..df7f4be159 100644 --- a/utilities/cleanup_data.py +++ b/utilities/cleanup_data.py @@ -20,14 +20,16 @@ import webnotes def delete_transactions(): print "Deleting transactions..." - trans = ['Timesheet', 'Task', 'Support Ticket', 'Stock Reconciliation', 'Stock Ledger Entry', + trans = ['Task', 'Support Ticket', 'Stock Reconciliation', 'Stock Ledger Entry', 'Stock Entry', 'Sales Order', 'Salary Slip','Sales Invoice', 'Quotation', 'Quality Inspection', 'Purchase Receipt', 'Purchase Order', 'Production Order', 'POS Setting', 'Period Closing Voucher', 'Purchase Invoice', 'Maintenance Visit', 'Maintenance Schedule', 'Leave Application', 'Leave Allocation', 'Lead', 'Journal Voucher', 'Installation Note', 'Material Request', 'GL Entry', 'Expense Claim', 'Opportunity', 'Delivery Note', 'Customer Issue', 'Bin', 'Authorization Rule', 'Attendance', 'C-Form', - 'Appraisal', 'Installation Note', 'Communication', "Supplier Quotation"] + 'Appraisal', 'Installation Note', 'Communication', "Supplier Quotation", "Newsletter", + "Job Applicant", "Web Page", "Website Slideshow", "Blog Post", "Blog Category", "Blogger", + "Time Log", "Time Log Batch", "Workflow"] for d in trans: for t in webnotes.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d): webnotes.conn.sql("delete from `tab%s`" % (t)) @@ -66,6 +68,7 @@ def delete_masters(): 'Item Group': ['All Item Groups', 'Default'], 'Item': '', 'Holiday List': '', + 'Activity Type': '', 'Grade': '', 'Feed': '', 'Expense Claim Type': ['Travel', 'Medical', 'Calls', 'Food', 'Others'],