[Minor] Report related fixes (#14620)
* fix in query incase list is empty * periodicity not found error when called from consolidated financial statements and custom cash flow is activated * unset currency filter to apply default currency or so * python 2 - 3 fix
This commit is contained in:
parent
51e4d641c8
commit
e25dcd2737
@ -25,15 +25,14 @@ def get_mappers_from_db():
|
||||
|
||||
|
||||
def get_accounts_in_mappers(mapping_names):
|
||||
return frappe.db.sql(
|
||||
'select cfma.name, cfm.label, cfm.is_working_capital, cfm.is_income_tax_liability, '
|
||||
'cfm.is_income_tax_expense, cfm.is_finance_cost, cfm.is_finance_cost_adjustment '
|
||||
'from `tabCash Flow Mapping Accounts` cfma '
|
||||
'join `tabCash Flow Mapping` cfm on cfma.parent=cfm.name '
|
||||
'where cfma.parent in %s '
|
||||
'order by cfm.is_working_capital',
|
||||
(mapping_names,)
|
||||
)
|
||||
return frappe.db.sql('''
|
||||
select cfma.name, cfm.label, cfm.is_working_capital, cfm.is_income_tax_liability,
|
||||
cfm.is_income_tax_expense, cfm.is_finance_cost, cfm.is_finance_cost_adjustment
|
||||
from `tabCash Flow Mapping Accounts` cfma
|
||||
join `tabCash Flow Mapping` cfm on cfma.parent=cfm.name
|
||||
where cfma.parent in (%s)
|
||||
order by cfm.is_working_capital
|
||||
''', (', '.join(['"%s"' % d for d in mapping_names])))
|
||||
|
||||
|
||||
def setup_mappers(mappers):
|
||||
@ -334,6 +333,7 @@ def compute_data(filters, company_currency, profit_data, period_list, light_mapp
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters.periodicity: filters.periodicity = "Monthly"
|
||||
period_list = get_period_list(
|
||||
filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity,
|
||||
filters.accumulated_values, filters.company
|
||||
@ -376,6 +376,7 @@ def _get_account_type_based_data(filters, account_names, period_list, accumulate
|
||||
total = 0
|
||||
for period in period_list:
|
||||
start_date = get_start_date(period, accumulated_values, company)
|
||||
accounts = ', '.join(['"%s"' % d for d in account_names])
|
||||
|
||||
if opening_balances:
|
||||
date_info = dict(date=start_date)
|
||||
@ -397,19 +398,19 @@ def _get_account_type_based_data(filters, account_names, period_list, accumulate
|
||||
from `tabGL Entry`
|
||||
where company=%s and posting_date >= %s and posting_date <= %s
|
||||
and voucher_type != 'Period Closing Voucher'
|
||||
and account in ( SELECT name FROM tabAccount WHERE name IN %s
|
||||
OR parent_account IN %s)
|
||||
""", (company, start, end, account_names, account_names))
|
||||
and account in ( SELECT name FROM tabAccount WHERE name IN (%s)
|
||||
OR parent_account IN (%s))
|
||||
""", (company, start, end, accounts, accounts))
|
||||
else:
|
||||
gl_sum = frappe.db.sql_list("""
|
||||
select sum(credit) - sum(debit)
|
||||
from `tabGL Entry`
|
||||
where company=%s and posting_date >= %s and posting_date <= %s
|
||||
and voucher_type != 'Period Closing Voucher'
|
||||
and account in ( SELECT name FROM tabAccount WHERE name IN %s
|
||||
OR parent_account IN %s)
|
||||
and account in ( SELECT name FROM tabAccount WHERE name IN (%s)
|
||||
OR parent_account IN (%s))
|
||||
""", (company, start_date if accumulated_values else period['from_date'],
|
||||
period['to_date'], account_names, account_names))
|
||||
period['to_date'], accounts, accounts))
|
||||
|
||||
if gl_sum and gl_sum[0]:
|
||||
amount = gl_sum[0]
|
||||
|
@ -15,7 +15,8 @@ $.extend(erpnext, {
|
||||
|
||||
get_presentation_currency_list: () => {
|
||||
const docs = frappe.boot.docs;
|
||||
const currency_list = docs.filter(d => d.doctype === ":Currency").map(d => d.name);
|
||||
let currency_list = docs.filter(d => d.doctype === ":Currency").map(d => d.name);
|
||||
currency_list.unshift("");
|
||||
return currency_list;
|
||||
},
|
||||
|
||||
|
@ -77,8 +77,8 @@ def get_party_addresses_and_contact(party_type, party, party_group):
|
||||
result.extend(add_blank_columns_for("Address"))
|
||||
data.append(result)
|
||||
else:
|
||||
addresses = map(list, addresses)
|
||||
contacts = map(list, contacts)
|
||||
addresses = list(map(list, addresses))
|
||||
contacts = list(map(list, contacts))
|
||||
|
||||
max_length = max(len(addresses), len(contacts))
|
||||
for idx in range(0, max_length):
|
||||
|
Loading…
x
Reference in New Issue
Block a user