From b3489548a98685a959b5d027d1f5e071acf9cce4 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 8 Feb 2017 11:20:04 +0530 Subject: [PATCH] minor fix --- .../bank_reconciliation/bank_reconciliation.py | 3 +++ .../profitability_analysis.py | 18 ++++++++++-------- erpnext/config/learn.py | 7 +------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index abc6ebaf9c0..11dcfe7537f 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -74,6 +74,9 @@ class BankReconciliation(Document): clearance_date_updated = False for d in self.get('payment_entries'): if d.clearance_date: + if not d.payment_document: + frappe.throw(_("Row #{0}: Payment document is required to complete the trasaction")) + if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date): frappe.throw(_("Row #{0}: Clearance date {1} cannot be before Cheque Date {2}") .format(d.idx, d.clearance_date, d.cheque_date)) diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.py b/erpnext/accounts/report/profitability_analysis/profitability_analysis.py index 4f9fd15f666..6d952374af8 100644 --- a/erpnext/accounts/report/profitability_analysis/profitability_analysis.py +++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.py @@ -11,9 +11,11 @@ from erpnext.accounts.report.trial_balance.trial_balance import validate_filters value_fields = ("income", "expense", "gross_profit_loss") def execute(filters=None): + if not filters.get('based_on'): filters["based_on"] = 'Cost Center' + based_on = filters.based_on.replace(' ', '_').lower() validate_filters(filters) - accounts = get_accounts_data(based_on, filters.company) + accounts = get_accounts_data(based_on, filters.get("company")) data = get_data(accounts, filters, based_on) columns = get_columns(filters) return columns, data @@ -27,14 +29,14 @@ def get_accounts_data(based_on, company): def get_data(accounts, filters, based_on): if not accounts: - return None + return [] accounts, accounts_by_name, parent_children_map = filter_accounts(accounts) gl_entries_by_account = {} - set_gl_entries_by_account(filters.company, filters.from_date, - filters.to_date, based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry)) + set_gl_entries_by_account(filters.get("company"), filters.get("from_date"), + filters.get("to_date"), based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.get("with_period_closing_entry"))) total_row = calculate_values(accounts, gl_entries_by_account, filters) accumulate_values_into_parents(accounts, accounts_by_name) @@ -90,7 +92,7 @@ def accumulate_values_into_parents(accounts, accounts_by_name): def prepare_data(accounts, filters, total_row, parent_children_map, based_on): data = [] - company_currency = frappe.db.get_value("Company", filters.company, "default_currency") + company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency") for d in accounts: has_value = False @@ -99,7 +101,7 @@ def prepare_data(accounts, filters, total_row, parent_children_map, based_on): "account": d.name, "parent_account": d.parent_account, "indent": d.indent, - "fiscal_year": filters.fiscal_year, + "fiscal_year": filters.get("fiscal_year"), "currency": company_currency, "based_on": based_on } @@ -122,9 +124,9 @@ def get_columns(filters): return [ { "fieldname": "account", - "label": _(filters.based_on), + "label": _(filters.get("based_on")), "fieldtype": "Link", - "options": filters.based_on, + "options": filters.get("based_on"), "width": 300 }, { diff --git a/erpnext/config/learn.py b/erpnext/config/learn.py index 426449ba69c..86db8081d75 100644 --- a/erpnext/config/learn.py +++ b/erpnext/config/learn.py @@ -44,7 +44,7 @@ def get_data(): }, { "type": "help", - "label": _("Setting up Email"), + "label": _("Setting up Email Account"), "youtube_id": "YFYe0DrB95o" }, { @@ -62,11 +62,6 @@ def get_data(): "label": _("Workflow"), "youtube_id": "yObJUg9FxFs" }, - { - "type": "help", - "label": _("Email Account"), - "youtube_id": "YFYe0DrB95o" - }, { "type": "help", "label": _("File Manager"),