From 89339bb80c3ff90b6bf273f1a55a183071c9e4f1 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Wed, 24 Jul 2019 21:32:55 +0530 Subject: [PATCH 1/3] fix: GSTR-1 query fix --- erpnext/regional/report/gstr_1/gstr_1.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py index e8c170e721..2da1085732 100644 --- a/erpnext/regional/report/gstr_1/gstr_1.py +++ b/erpnext/regional/report/gstr_1/gstr_1.py @@ -161,8 +161,9 @@ class Gstr1Report(object): "gst_category": ["in", ["Registered Regular", "Deemed Export", "SEZ"]] }) - conditions += """ and ifnull(gst_category, '') != 'Overseas' and is_return != 1 - and customer in ({0})""".format(", ".join([frappe.db.escape(c.name) for c in customers])) + if customers: + conditions += """ and ifnull(gst_category, '') != 'Overseas' and is_return != 1 + and customer in ({0})""".format(", ".join([frappe.db.escape(c.name) for c in customers])) if self.filters.get("type_of_business") in ("B2C Large", "B2C Small"): b2c_limit = frappe.db.get_single_value('GST Settings', 'b2c_limit') @@ -174,11 +175,11 @@ class Gstr1Report(object): "gst_category": ["in", ["Unregistered"]] }) - if self.filters.get("type_of_business") == "B2C Large": + if self.filters.get("type_of_business") == "B2C Large" and customers: conditions += """ and SUBSTR(place_of_supply, 1, 2) != SUBSTR(company_gstin, 1, 2) and grand_total > {0} and is_return != 1 and customer in ({1})""".\ format(flt(b2c_limit), ", ".join([frappe.db.escape(c.name) for c in customers])) - elif self.filters.get("type_of_business") == "B2C Small": + elif self.filters.get("type_of_business") == "B2C Small" and customers: conditions += """ and ( SUBSTR(place_of_supply, 1, 2) = SUBSTR(company_gstin, 1, 2) or grand_total <= {0}) and is_return != 1 and customer in ({1})""".\ From 53dc0c52cacf2a53a71cad845b16f28a7776ab91 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 25 Jul 2019 12:23:40 +0530 Subject: [PATCH 2/3] Dynamic link issue fix in Bank reconciliation statement --- .../bank_reconciliation_statement.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py index 1923f78cf8..63317c52d8 100644 --- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py +++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py @@ -58,8 +58,7 @@ def get_columns(): { "fieldname": "payment_document", "label": _("Payment Document Type"), - "fieldtype": "Link", - "options": "DocType", + "fieldtype": "Data", "width": 220 }, { From 6998412990b4574e1b737a6e508491f632764a7a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 26 Jul 2019 08:15:45 +0530 Subject: [PATCH 3/3] fix(Account): Pass parent currency to child currency In a scenario where Parent Company Account's Currency is different from it's default currency, the Account Currency of Child would be set from the default currency of Company which might be wrong --- erpnext/accounts/doctype/account/account.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 68efe37719..0e57b3f198 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -123,7 +123,9 @@ class Account(NestedSet): doc.flags.ignore_root_company_validation = True doc.update({ "company": company, - "account_currency": None, + # parent account's currency should be passed down to child account's curreny + # if it is None, it picks it up from default company currency, which might be unintended + "account_currency": self.account_currency, "parent_account": parent_acc_name_map[company] }) doc.save()