diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index e66d20eb4d..bc4a220faa 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 diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index 4bba066f44..47f79f1712 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/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py index d1d9518bc2..8d85715fc8 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"): 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 b660d39d53..481f13005b 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)