From 8916916a03cffd22b9c26b8a0df7843d37c9ad01 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 28 Oct 2019 13:00:18 +0530 Subject: [PATCH 1/2] fix: 'NoneType' object is not iterable --- .../account_balance_timeline/account_balance_timeline.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py index bc07b6d807..d098d8421c 100644 --- a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py +++ b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import frappe, json +from frappe import _ from frappe.utils import add_to_date, date_diff, getdate, nowdate, get_last_day, formatdate from erpnext.accounts.report.general_ledger.general_ledger import execute from frappe.core.page.dashboard.dashboard import cache_source, get_from_date_from_timespan @@ -24,6 +25,9 @@ def get(chart_name = None, chart = None, no_cache = None, from_date = None, to_d account = filters.get("account") company = filters.get("company") + if not account and chart: + frappe.throw(_("Account is not set for the dashboard chart {0}").format(chart)) + if not to_date: to_date = nowdate() if not from_date: From 88d2c973913b68c0256e7fb4dcab35428585083b Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 28 Oct 2019 17:37:55 +0530 Subject: [PATCH 2/2] fix: default accounts are not added on creation of company --- erpnext/setup/doctype/company/company.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index e69a6aaded..8b42b19921 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -33,6 +33,10 @@ class Company(NestedSet): return exists def validate(self): + self.update_default_account = False + if self.is_new(): + self.update_default_account = True + self.validate_abbr() self.validate_default_accounts() self.validate_currency() @@ -203,8 +207,8 @@ class Company(NestedSet): "default_expense_account": "Cost of Goods Sold" }) - for default_account in default_accounts: - if self.is_new() or frappe.flags.in_test or frappe.flags.in_demo: + if self.update_default_account or frappe.flags.in_test: + for default_account in default_accounts: self._set_default_account(default_account, default_accounts.get(default_account)) if not self.default_income_account: