mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 23:19:20 +00:00
fix(UAE VAT 201): Remove Chart
This commit is contained in:
@@ -8,8 +8,7 @@ from frappe import _
|
|||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
columns = get_columns()
|
columns = get_columns()
|
||||||
data, emirates, amounts_by_emirate = get_data(filters)
|
data, emirates, amounts_by_emirate = get_data(filters)
|
||||||
chart = get_chart(emirates, amounts_by_emirate)
|
return columns, data
|
||||||
return columns, data, None, chart
|
|
||||||
|
|
||||||
def get_columns():
|
def get_columns():
|
||||||
"""Creates a list of dictionaries that are used to generate column headers of the data table."""
|
"""Creates a list of dictionaries that are used to generate column headers of the data table."""
|
||||||
@@ -49,32 +48,6 @@ def get_data(filters = None):
|
|||||||
append_vat_on_expenses(data, filters)
|
append_vat_on_expenses(data, filters)
|
||||||
return data, emirates, amounts_by_emirate
|
return data, emirates, amounts_by_emirate
|
||||||
|
|
||||||
def get_chart(emirates, amounts_by_emirate):
|
|
||||||
"""Returns chart data."""
|
|
||||||
labels = []
|
|
||||||
amount = []
|
|
||||||
vat_amount = []
|
|
||||||
for emirate in emirates:
|
|
||||||
if emirate in amounts_by_emirate:
|
|
||||||
amount.append(amounts_by_emirate[emirate]["raw_amount"])
|
|
||||||
vat_amount.append(amounts_by_emirate[emirate]["raw_vat_amount"])
|
|
||||||
labels.append(emirate)
|
|
||||||
|
|
||||||
datasets = []
|
|
||||||
datasets.append({'name': _('Amount (AED)'), 'values': amount})
|
|
||||||
datasets.append({'name': _('Vat Amount (AED)'), 'values': vat_amount})
|
|
||||||
|
|
||||||
chart = {
|
|
||||||
"type": "bar",
|
|
||||||
"fieldtype": "Currency",
|
|
||||||
"data": {
|
|
||||||
'labels': labels,
|
|
||||||
'datasets': datasets
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return chart
|
|
||||||
|
|
||||||
def append_vat_on_sales(data, filters):
|
def append_vat_on_sales(data, filters):
|
||||||
"""Appends Sales and All Other Outputs."""
|
"""Appends Sales and All Other Outputs."""
|
||||||
append_data(data, '', _('VAT on Sales and All Other Outputs'), '', '')
|
append_data(data, '', _('VAT on Sales and All Other Outputs'), '', '')
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def get_tax_accounts(company):
|
|||||||
if not tax_accounts_list and not frappe.flags.in_test:
|
if not tax_accounts_list and not frappe.flags.in_test:
|
||||||
frappe.throw(_('Please set Vat Accounts for Company: "{0}" in UAE VAT Settings').format(company))
|
frappe.throw(_('Please set Vat Accounts for Company: "{0}" in UAE VAT Settings').format(company))
|
||||||
for tax_account in tax_accounts_list:
|
for tax_account in tax_accounts_list:
|
||||||
for _, name in tax_account.items():
|
for account, name in tax_account.items():
|
||||||
tax_accounts_dict[name] = name
|
tax_accounts_dict[name] = name
|
||||||
|
|
||||||
return tax_accounts_dict
|
return tax_accounts_dict
|
||||||
|
|||||||
Reference in New Issue
Block a user