From 5c031a3512f4395d3c8ff6c36d043442f2b51f19 Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Thu, 8 Dec 2016 17:29:04 +0530 Subject: [PATCH 1/8] [Fix] Quoted Item Comparison --- .../report/quoted_item_comparison/quoted_item_comparison.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py index 1793fc3140..3abb7b1dbe 100644 --- a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py +++ b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py @@ -39,7 +39,10 @@ def get_quote_list(item, qty_list): #Add a row for each supplier for root in set(suppliers): supplier_currency = frappe.db.get_value("Supplier",root,"default_currency") - exg = get_exchange_rate(supplier_currency,company_currency) + if supplier_currency: + exg = get_exchange_rate(supplier_currency,company_currency) + else: + exg = 1 row = frappe._dict({ "supplier_name": root From ddb856377cb925fa704943a8db345ed7f809a6a7 Mon Sep 17 00:00:00 2001 From: Viet Pham Date: Thu, 8 Dec 2016 20:02:39 +0700 Subject: [PATCH 2/8] Fix patch update_status_of_po_so.py caused error: Column 'per_billed' cannot be null --- erpnext/patches/v7_0/update_status_of_po_so.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/patches/v7_0/update_status_of_po_so.py b/erpnext/patches/v7_0/update_status_of_po_so.py index 0e2dd74a23..c0b6f59eaf 100644 --- a/erpnext/patches/v7_0/update_status_of_po_so.py +++ b/erpnext/patches/v7_0/update_status_of_po_so.py @@ -18,9 +18,9 @@ def update_po_per_received_per_billed(): `tabPurchase Order`.per_received = round((select sum(if(qty > ifnull(received_qty, 0), ifnull(received_qty, 0), qty)) / sum(qty) *100 from `tabPurchase Order Item` where parent = `tabPurchase Order`.name), 2), - `tabPurchase Order`.per_billed = round((select sum( if(amount > ifnull(billed_amt, 0), + `tabPurchase Order`.per_billed = ifnull(round((select sum( if(amount > ifnull(billed_amt, 0), ifnull(billed_amt, 0), amount)) / sum(amount) *100 from `tabPurchase Order Item` - where parent = `tabPurchase Order`.name), 2)""") + where parent = `tabPurchase Order`.name), 2), 0)""") def update_so_per_delivered_per_billed(): frappe.db.sql(""" @@ -30,9 +30,9 @@ def update_so_per_delivered_per_billed(): `tabSales Order`.per_delivered = round((select sum( if(qty > ifnull(delivered_qty, 0), ifnull(delivered_qty, 0), qty)) / sum(qty) *100 from `tabSales Order Item` where parent = `tabSales Order`.name), 2), - `tabSales Order`.per_billed = round((select sum( if(amount > ifnull(billed_amt, 0), + `tabSales Order`.per_billed = ifnull(round((select sum( if(amount > ifnull(billed_amt, 0), ifnull(billed_amt, 0), amount)) / sum(amount) *100 from `tabSales Order Item` - where parent = `tabSales Order`.name), 2)""") + where parent = `tabSales Order`.name), 2), 0)""") def update_status(): frappe.db.sql(""" From 8e885163a39cf10364b8b1e35f2a5a4fb8e7735d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 9 Dec 2016 12:17:45 +0530 Subject: [PATCH 3/8] Update quoted_item_comparison.py --- .../quoted_item_comparison.py | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py index 3abb7b1dbe..f627b4a6cd 100644 --- a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py +++ b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py @@ -3,11 +3,9 @@ from __future__ import unicode_literals from erpnext.setup.utils import get_exchange_rate - import frappe def execute(filters=None): - qty_list = get_quantity_list(filters.item) data = get_quote_list(filters.item, qty_list) @@ -15,12 +13,9 @@ def execute(filters=None): columns = get_columns(qty_list) return columns, data - def get_quote_list(item, qty_list): - out = [] - if item: price_data = [] suppliers = [] @@ -38,11 +33,11 @@ def get_quote_list(item, qty_list): #Add a row for each supplier for root in set(suppliers): - supplier_currency = frappe.db.get_value("Supplier",root,"default_currency") + supplier_currency = frappe.db.get_value("Supplier", root, "default_currency") if supplier_currency: - exg = get_exchange_rate(supplier_currency,company_currency) + exchange_rate = get_exchange_rate(supplier_currency, company_currency) else: - exg = 1 + exchange_rate = 1 row = frappe._dict({ "supplier_name": root @@ -51,7 +46,7 @@ def get_quote_list(item, qty_list): # Get the quantity for this row for item_price in price_data: if str(item_price.qty) == col.key and item_price.supplier == root: - row[col.key] = item_price.rate * exg + row[col.key] = item_price.rate * exchange_rate row[col.key + "QUOTE"] = item_price.parent break else: @@ -59,15 +54,11 @@ def get_quote_list(item, qty_list): row[col.key + "QUOTE"] = "" out.append(row) - - return out def get_quantity_list(item): - out = [] - if item: qty_list = frappe.db.sql("""select distinct qty from `tabSupplier Quotation Item` where ifnull(item_code,'')=%s and docstatus < 2""", item, as_dict=1) qty_list.sort(reverse=False) @@ -105,5 +96,4 @@ def get_columns(qty_list): "width": 90 }) - - return columns \ No newline at end of file + return columns From e5050678877558b60c10764371c409f54238f270 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 9 Dec 2016 12:55:29 +0530 Subject: [PATCH 4/8] [Fix] Payment entry showing wrong invoice amount --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index d4f8edbb6f..936b3298ea 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -639,7 +639,7 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount= if party_amount: grand_total = outstanding_amount = party_amount elif dt in ("Sales Invoice", "Purchase Invoice"): - grand_total = doc.grand_total + grand_total = doc.base_grand_total if party_account_currency == doc.company_currency else doc.grand_total outstanding_amount = doc.outstanding_amount else: total_field = "base_grand_total" if party_account_currency == doc.company_currency else "grand_total" From 43df8041763d3358ad97f16bd0c7e4bd517fb512 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 1 Dec 2016 11:08:43 +0530 Subject: [PATCH 5/8] 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 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/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) From 76a8508d2badbc988cf0ad4d192f935edec0cf6b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 9 Dec 2016 15:07:54 +0530 Subject: [PATCH 6/8] 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 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"): From b00df641e0239981b7b0a1a18b491ec9e308c463 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 9 Dec 2016 15:08:44 +0530 Subject: [PATCH 7/8] 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 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 From 10de98c0beb1fbb0ce9707f55ac8b06ecc0b01e9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 9 Dec 2016 16:15:45 +0600 Subject: [PATCH 8/8] bumped to version 7.1.23 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index b54ba59943..97ab9343d2 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.1.22' +__version__ = '7.1.23' def get_default_company(user=None): '''Get default company for user'''