Merge pull request #7692 from rohitwaghchaure/minor_fixes_v_7_2

Minor fixes
This commit is contained in:
Nabin Hait 2017-02-08 11:21:54 +05:30 committed by GitHub
commit 6f93cd5bd0
3 changed files with 14 additions and 14 deletions

View File

@ -74,6 +74,9 @@ class BankReconciliation(Document):
clearance_date_updated = False clearance_date_updated = False
for d in self.get('payment_entries'): for d in self.get('payment_entries'):
if d.clearance_date: 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): 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}") frappe.throw(_("Row #{0}: Clearance date {1} cannot be before Cheque Date {2}")
.format(d.idx, d.clearance_date, d.cheque_date)) .format(d.idx, d.clearance_date, d.cheque_date))

View File

@ -11,9 +11,11 @@ from erpnext.accounts.report.trial_balance.trial_balance import validate_filters
value_fields = ("income", "expense", "gross_profit_loss") value_fields = ("income", "expense", "gross_profit_loss")
def execute(filters=None): def execute(filters=None):
if not filters.get('based_on'): filters["based_on"] = 'Cost Center'
based_on = filters.based_on.replace(' ', '_').lower() based_on = filters.based_on.replace(' ', '_').lower()
validate_filters(filters) 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) data = get_data(accounts, filters, based_on)
columns = get_columns(filters) columns = get_columns(filters)
return columns, data return columns, data
@ -27,14 +29,14 @@ def get_accounts_data(based_on, company):
def get_data(accounts, filters, based_on): def get_data(accounts, filters, based_on):
if not accounts: if not accounts:
return None return []
accounts, accounts_by_name, parent_children_map = filter_accounts(accounts) accounts, accounts_by_name, parent_children_map = filter_accounts(accounts)
gl_entries_by_account = {} gl_entries_by_account = {}
set_gl_entries_by_account(filters.company, filters.from_date, set_gl_entries_by_account(filters.get("company"), filters.get("from_date"),
filters.to_date, based_on, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry)) 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) total_row = calculate_values(accounts, gl_entries_by_account, filters)
accumulate_values_into_parents(accounts, accounts_by_name) 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): def prepare_data(accounts, filters, total_row, parent_children_map, based_on):
data = [] 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: for d in accounts:
has_value = False has_value = False
@ -99,7 +101,7 @@ def prepare_data(accounts, filters, total_row, parent_children_map, based_on):
"account": d.name, "account": d.name,
"parent_account": d.parent_account, "parent_account": d.parent_account,
"indent": d.indent, "indent": d.indent,
"fiscal_year": filters.fiscal_year, "fiscal_year": filters.get("fiscal_year"),
"currency": company_currency, "currency": company_currency,
"based_on": based_on "based_on": based_on
} }
@ -122,9 +124,9 @@ def get_columns(filters):
return [ return [
{ {
"fieldname": "account", "fieldname": "account",
"label": _(filters.based_on), "label": _(filters.get("based_on")),
"fieldtype": "Link", "fieldtype": "Link",
"options": filters.based_on, "options": filters.get("based_on"),
"width": 300 "width": 300
}, },
{ {

View File

@ -44,7 +44,7 @@ def get_data():
}, },
{ {
"type": "help", "type": "help",
"label": _("Setting up Email"), "label": _("Setting up Email Account"),
"youtube_id": "YFYe0DrB95o" "youtube_id": "YFYe0DrB95o"
}, },
{ {
@ -62,11 +62,6 @@ def get_data():
"label": _("Workflow"), "label": _("Workflow"),
"youtube_id": "yObJUg9FxFs" "youtube_id": "yObJUg9FxFs"
}, },
{
"type": "help",
"label": _("Email Account"),
"youtube_id": "YFYe0DrB95o"
},
{ {
"type": "help", "type": "help",
"label": _("File Manager"), "label": _("File Manager"),