Merge pull request #7172 from nabinhait/hotfix
Issue fixed in Quality Inspection, P&L period and purchase register
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index e66d20e..bc4a220 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -42,9 +42,6 @@
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 4bba066..47f79f1 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -185,7 +185,7 @@
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 d1d9518..8d85715 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
@@ -28,15 +28,12 @@
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 b660d39..481f130 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 @@
# 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)