From 43df8041763d3358ad97f16bd0c7e4bd517fb512 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 1 Dec 2016 11:08:43 +0530 Subject: [PATCH 1/3] Fixed renamed fieldname --- erpnext/accounts/report/purchase_register/purchase_register.py | 2 +- erpnext/patches/v6_16/update_billing_status_in_dn_and_pr.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index 4bba066f44e..47f79f17126 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -185,7 +185,7 @@ def get_invoice_po_pr_map(invoice_list): pr_list = [d.purchase_receipt] elif d.po_detail: pr_list = frappe.db.sql_list("""select distinct parent from `tabPurchase Receipt Item` - where docstatus=1 and prevdoc_detail_docname=%s""", d.po_detail) + where docstatus=1 and purchase_order_item=%s""", d.po_detail) if pr_list: invoice_po_pr_map.setdefault(d.parent, frappe._dict()).setdefault("purchase_receipt", pr_list) diff --git a/erpnext/patches/v6_16/update_billing_status_in_dn_and_pr.py b/erpnext/patches/v6_16/update_billing_status_in_dn_and_pr.py index b660d39d53b..481f13005ba 100644 --- a/erpnext/patches/v6_16/update_billing_status_in_dn_and_pr.py +++ b/erpnext/patches/v6_16/update_billing_status_in_dn_and_pr.py @@ -22,7 +22,7 @@ def execute(): # Update billed_amt in DN and PR which are not against any order for d in frappe.db.sql("""select name from `tabPurchase Receipt Item` item - where (prevdoc_detail_docname is null or prevdoc_detail_docname = '') and docstatus=1""", as_dict=1): + where (purchase_order_item is null or purchase_order_item = '') and docstatus=1""", as_dict=1): billed_amt = frappe.db.sql("""select sum(amount) from `tabPurchase Invoice Item` where pr_detail=%s and docstatus=1""", d.name) From 76a8508d2badbc988cf0ad4d192f935edec0cf6b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 9 Dec 2016 15:07:54 +0530 Subject: [PATCH 2/3] Unlink Quality Inspection from PR while cancelling QI --- .../doctype/quality_inspection/quality_inspection.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py index d1d9518bc25..8d85715fc86 100644 --- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py +++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.py @@ -28,15 +28,12 @@ class QualityInspection(Document): frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = %s, t2.modified = %s where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name""", - (self.name, self.modified, self.purchase_receipt_no, - self.item_code)) + (self.name, self.modified, self.purchase_receipt_no, self.item_code)) def on_cancel(self): if self.purchase_receipt_no: - frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 - set t1.qa_no = '', t2.modified = %s - where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name""", - (self.modified, self.purchase_receipt_no, self.item_code)) + frappe.db.sql("""update `tabPurchase Receipt Item` set qa_no = '', modified=%s + where qa_no = %s""", (self.modified, self.name)) def item_query(doctype, txt, searchfield, start, page_len, filters): if filters.get("from"): From b00df641e0239981b7b0a1a18b491ec9e308c463 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 9 Dec 2016 15:08:44 +0530 Subject: [PATCH 3/3] Fixed period end date if year starts in the middle of the month --- erpnext/accounts/report/financial_statements.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index e66d20eb4d4..bc4a220faa1 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -42,9 +42,6 @@ def get_period_list(from_fiscal_year, to_fiscal_year, periodicity): if to_date == get_first_day(to_date): # if to_date is the first day, get the last day of previous month to_date = add_days(to_date, -1) - else: - # to_date should be the last day of the new to_date's month - to_date = get_last_day(to_date) if to_date <= year_end_date: # the normal case