refactor: fix linting
This commit is contained in:
parent
a5e8e449ee
commit
3294f86b92
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from erpnext.regional.united_arab_emirates.utils import get_tax_accounts
|
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
@ -14,11 +13,7 @@ def execute(filters=None):
|
|||||||
return columns, data, None, chart
|
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."""
|
||||||
|
|
||||||
Returns:
|
|
||||||
List(Dict): list of dictionaries that are used to generate column headers of the data table
|
|
||||||
"""
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"fieldname": "no",
|
"fieldname": "no",
|
||||||
@ -47,22 +42,15 @@ def get_columns():
|
|||||||
]
|
]
|
||||||
|
|
||||||
def get_data(filters = None):
|
def get_data(filters = None):
|
||||||
"""Returns the list of dictionaries. Each dictionary is a row in the datatable and chart data
|
"""Returns the list of dictionaries. Each dictionary is a row in the datatable and chart data."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
List(Dict): Each dictionary is a row in the datatable
|
|
||||||
Dict: Dictionary containing chart data
|
|
||||||
"""
|
|
||||||
data = []
|
data = []
|
||||||
data.append({
|
data.append({
|
||||||
"no": '',
|
"no": '',
|
||||||
"legend": f'VAT on Sales and All Other Outputs',
|
"legend": 'VAT on Sales and All Other Outputs',
|
||||||
"amount": '',
|
"amount": '',
|
||||||
"vat_amount": ''
|
"vat_amount": ''
|
||||||
})
|
})
|
||||||
|
|
||||||
total_emiratewise = get_total_emiratewise(filters)
|
total_emiratewise = get_total_emiratewise(filters)
|
||||||
emirates = get_emirates()
|
emirates = get_emirates()
|
||||||
amounts_by_emirate = {}
|
amounts_by_emirate = {}
|
||||||
@ -92,7 +80,7 @@ def get_data(filters = None):
|
|||||||
data.append(
|
data.append(
|
||||||
{
|
{
|
||||||
"no": '2',
|
"no": '2',
|
||||||
"legend": f'Tax Refunds provided to Tourists under the Tax Refunds for Tourists Scheme',
|
"legend": 'Tax Refunds provided to Tourists under the Tax Refunds for Tourists Scheme',
|
||||||
"amount": (-1) * get_tourist_tax_return_total(filters),
|
"amount": (-1) * get_tourist_tax_return_total(filters),
|
||||||
"vat_amount": (-1) * get_tourist_tax_return_tax(filters)
|
"vat_amount": (-1) * get_tourist_tax_return_tax(filters)
|
||||||
}
|
}
|
||||||
@ -101,7 +89,7 @@ def get_data(filters = None):
|
|||||||
data.append(
|
data.append(
|
||||||
{
|
{
|
||||||
"no": '3',
|
"no": '3',
|
||||||
"legend": f'Supplies subject to the reverse charge provision',
|
"legend": 'Supplies subject to the reverse charge provision',
|
||||||
"amount": get_reverse_charge_total(filters),
|
"amount": get_reverse_charge_total(filters),
|
||||||
"vat_amount": get_reverse_charge_tax(filters)
|
"vat_amount": get_reverse_charge_tax(filters)
|
||||||
}
|
}
|
||||||
@ -110,7 +98,7 @@ def get_data(filters = None):
|
|||||||
data.append(
|
data.append(
|
||||||
{
|
{
|
||||||
"no": '4',
|
"no": '4',
|
||||||
"legend": f'Zero Rated',
|
"legend": 'Zero Rated',
|
||||||
"amount": get_zero_rated_total(filters),
|
"amount": get_zero_rated_total(filters),
|
||||||
"vat_amount": "-"
|
"vat_amount": "-"
|
||||||
}
|
}
|
||||||
@ -119,7 +107,7 @@ def get_data(filters = None):
|
|||||||
data.append(
|
data.append(
|
||||||
{
|
{
|
||||||
"no": '5',
|
"no": '5',
|
||||||
"legend": f'Exempt Supplies',
|
"legend": 'Exempt Supplies',
|
||||||
"amount": get_exempt_total(filters),
|
"amount": get_exempt_total(filters),
|
||||||
"vat_amount": "-"
|
"vat_amount": "-"
|
||||||
}
|
}
|
||||||
@ -127,22 +115,24 @@ def get_data(filters = None):
|
|||||||
|
|
||||||
data.append({
|
data.append({
|
||||||
"no": '',
|
"no": '',
|
||||||
"legend": f'VAT on Expenses and All Other Inputs',
|
"legend": 'VAT on Expenses and All Other Inputs',
|
||||||
"amount": '',
|
"amount": '',
|
||||||
"vat_amount": ''
|
"vat_amount": ''
|
||||||
})
|
})
|
||||||
|
|
||||||
data.append(
|
data.append(
|
||||||
{
|
{
|
||||||
"no": '9',
|
"no": '9',
|
||||||
"legend": f'Standard Rated Expenses',
|
"legend": 'Standard Rated Expenses',
|
||||||
"amount": get_standard_rated_expenses_total(filters),
|
"amount": get_standard_rated_expenses_total(filters),
|
||||||
"vat_amount": get_standard_rated_expenses_tax(filters)
|
"vat_amount": get_standard_rated_expenses_tax(filters)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
data.append(
|
data.append(
|
||||||
{
|
{
|
||||||
"no": '10',
|
"no": '10',
|
||||||
"legend": f'Supplies subject to the reverse charge provision',
|
"legend": 'Supplies subject to the reverse charge provision',
|
||||||
"amount": get_reverse_charge_recoverable_total(filters),
|
"amount": get_reverse_charge_recoverable_total(filters),
|
||||||
"vat_amount": get_reverse_charge_recoverable_tax(filters)
|
"vat_amount": get_reverse_charge_recoverable_tax(filters)
|
||||||
}
|
}
|
||||||
@ -152,15 +142,7 @@ def get_data(filters = None):
|
|||||||
|
|
||||||
|
|
||||||
def get_chart(emirates, amounts_by_emirate):
|
def get_chart(emirates, amounts_by_emirate):
|
||||||
"""Returns chart data
|
"""Returns chart data."""
|
||||||
|
|
||||||
Args:
|
|
||||||
emirates (List): List of Emirates
|
|
||||||
amounts_by_emirate (Dict): Vat and Tax amount by emirates with emirates as key
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
[Dict]: Chart Data
|
|
||||||
"""
|
|
||||||
labels = []
|
labels = []
|
||||||
amount = []
|
amount = []
|
||||||
vat_amount = []
|
vat_amount = []
|
||||||
@ -186,6 +168,7 @@ def get_chart(emirates, amounts_by_emirate):
|
|||||||
return chart
|
return chart
|
||||||
|
|
||||||
def get_total_emiratewise(filters):
|
def get_total_emiratewise(filters):
|
||||||
|
"""Returns Emiratewise Amount and Taxes."""
|
||||||
return frappe.db.sql(f"""
|
return frappe.db.sql(f"""
|
||||||
select emirate, sum(total), sum(total_taxes_and_charges) from `tabSales Invoice`
|
select emirate, sum(total), sum(total_taxes_and_charges) from `tabSales Invoice`
|
||||||
where docstatus = 1 {get_conditions(filters)}
|
where docstatus = 1 {get_conditions(filters)}
|
||||||
@ -193,11 +176,7 @@ def get_total_emiratewise(filters):
|
|||||||
""", filters)
|
""", filters)
|
||||||
|
|
||||||
def get_emirates():
|
def get_emirates():
|
||||||
"""Returns a List of emirates in the order that they are to be displayed
|
"""Returns a List of emirates in the order that they are to be displayed."""
|
||||||
|
|
||||||
Returns:
|
|
||||||
List(String): List of emirates in the order that they are to be displayed
|
|
||||||
"""
|
|
||||||
return [
|
return [
|
||||||
'Abu Dhabi',
|
'Abu Dhabi',
|
||||||
'Dubai',
|
'Dubai',
|
||||||
@ -209,14 +188,7 @@ def get_emirates():
|
|||||||
]
|
]
|
||||||
|
|
||||||
def get_conditions(filters):
|
def get_conditions(filters):
|
||||||
"""The conditions to be used to filter data to calculate the total sale
|
"""The conditions to be used to filter data to calculate the total sale."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
String: Concatenated list of conditions to be applied to calculate the total sale
|
|
||||||
"""
|
|
||||||
conditions = ""
|
conditions = ""
|
||||||
for opts in (("company", " and company=%(company)s"),
|
for opts in (("company", " and company=%(company)s"),
|
||||||
("from_date", " and posting_date>=%(from_date)s"),
|
("from_date", " and posting_date>=%(from_date)s"),
|
||||||
@ -226,22 +198,8 @@ def get_conditions(filters):
|
|||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
def get_reverse_charge_total(filters):
|
def get_reverse_charge_total(filters):
|
||||||
"""Returns the sum of the total of each Purchase invoice made
|
"""Returns the sum of the total of each Purchase invoice made."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of the total of each Purchase invoice made
|
|
||||||
"""
|
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
print("""
|
|
||||||
select sum(total) from
|
|
||||||
`tabPurchase Invoice`
|
|
||||||
where
|
|
||||||
reverse_charge = "Y"
|
|
||||||
and docstatus = 1 {where_conditions} ;
|
|
||||||
""".format(where_conditions=conditions))
|
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(total) from
|
select sum(total) from
|
||||||
`tabPurchase Invoice`
|
`tabPurchase Invoice`
|
||||||
@ -251,14 +209,7 @@ def get_reverse_charge_total(filters):
|
|||||||
""".format(where_conditions=conditions), filters)[0][0] or 0
|
""".format(where_conditions=conditions), filters)[0][0] or 0
|
||||||
|
|
||||||
def get_reverse_charge_tax(filters):
|
def get_reverse_charge_tax(filters):
|
||||||
"""Returns the sum of the tax of each Purchase invoice made
|
"""Returns the sum of the tax of each Purchase invoice made."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of the tax of each Purchase invoice made
|
|
||||||
"""
|
|
||||||
conditions = get_conditions_join(filters)
|
conditions = get_conditions_join(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(debit) from
|
select sum(debit) from
|
||||||
@ -273,14 +224,7 @@ def get_reverse_charge_tax(filters):
|
|||||||
""".format(where_conditions=conditions), filters)[0][0] or 0
|
""".format(where_conditions=conditions), filters)[0][0] or 0
|
||||||
|
|
||||||
def get_conditions_join(filters):
|
def get_conditions_join(filters):
|
||||||
"""The conditions to be used to filter data to calculate the total vat
|
"""The conditions to be used to filter data to calculate the total vat."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
String: Concatenated list of conditions to be applied to calculate the total vat
|
|
||||||
"""
|
|
||||||
conditions = ""
|
conditions = ""
|
||||||
for opts in (("company", " and `tabPurchase Invoice`.company=%(company)s"),
|
for opts in (("company", " and `tabPurchase Invoice`.company=%(company)s"),
|
||||||
("from_date", " and `tabPurchase Invoice`.posting_date>=%(from_date)s"),
|
("from_date", " and `tabPurchase Invoice`.posting_date>=%(from_date)s"),
|
||||||
@ -290,14 +234,7 @@ def get_conditions_join(filters):
|
|||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
def get_reverse_charge_recoverable_total(filters):
|
def get_reverse_charge_recoverable_total(filters):
|
||||||
"""Returns the sum of the total of each Purchase invoice made with claimable reverse charge
|
"""Returns the sum of the total of each Purchase invoice made with claimable reverse charge."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of the total of each Purchase invoice made with claimable reverse charge
|
|
||||||
"""
|
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(total) from
|
select sum(total) from
|
||||||
@ -309,14 +246,7 @@ def get_reverse_charge_recoverable_total(filters):
|
|||||||
""".format(where_conditions=conditions), filters)[0][0] or 0
|
""".format(where_conditions=conditions), filters)[0][0] or 0
|
||||||
|
|
||||||
def get_reverse_charge_recoverable_tax(filters):
|
def get_reverse_charge_recoverable_tax(filters):
|
||||||
"""Returns the sum of the tax of each Purchase invoice made
|
"""Returns the sum of the tax of each Purchase invoice made."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of the tax of each Purchase invoice made
|
|
||||||
"""
|
|
||||||
conditions = get_conditions_join(filters)
|
conditions = get_conditions_join(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(debit * `tabPurchase Invoice`.claimable_reverse_charge / 100) from
|
select sum(debit * `tabPurchase Invoice`.claimable_reverse_charge / 100) from
|
||||||
@ -332,14 +262,7 @@ def get_reverse_charge_recoverable_tax(filters):
|
|||||||
""".format(where_conditions=conditions), filters)[0][0] or 0
|
""".format(where_conditions=conditions), filters)[0][0] or 0
|
||||||
|
|
||||||
def get_standard_rated_expenses_total(filters):
|
def get_standard_rated_expenses_total(filters):
|
||||||
"""Returns the sum of the total of each Purchase invoice made with claimable reverse charge
|
"""Returns the sum of the total of each Purchase invoice made with claimable reverse charge."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of the total of each Purchase invoice made with claimable reverse charge
|
|
||||||
"""
|
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(total) from
|
select sum(total) from
|
||||||
@ -350,14 +273,7 @@ def get_standard_rated_expenses_total(filters):
|
|||||||
""".format(where_conditions=conditions), filters)[0][0] or 0
|
""".format(where_conditions=conditions), filters)[0][0] or 0
|
||||||
|
|
||||||
def get_standard_rated_expenses_tax(filters):
|
def get_standard_rated_expenses_tax(filters):
|
||||||
"""Returns the sum of the tax of each Purchase invoice made
|
"""Returns the sum of the tax of each Purchase invoice made."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of the tax of each Purchase invoice made
|
|
||||||
"""
|
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(standard_rated_expenses) from
|
select sum(standard_rated_expenses) from
|
||||||
@ -368,14 +284,7 @@ def get_standard_rated_expenses_tax(filters):
|
|||||||
""".format(where_conditions=conditions), filters)[0][0] or 0
|
""".format(where_conditions=conditions), filters)[0][0] or 0
|
||||||
|
|
||||||
def get_tourist_tax_return_total(filters):
|
def get_tourist_tax_return_total(filters):
|
||||||
"""Returns the sum of the total of each Sales invoice with non zero tourist_tax_return
|
"""Returns the sum of the total of each Sales invoice with non zero tourist_tax_return."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of the total of each Sales invoice with non zero tourist_tax_return
|
|
||||||
"""
|
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(total) from
|
select sum(total) from
|
||||||
@ -386,14 +295,7 @@ def get_tourist_tax_return_total(filters):
|
|||||||
""".format(where_conditions=conditions), filters)[0][0] or 0
|
""".format(where_conditions=conditions), filters)[0][0] or 0
|
||||||
|
|
||||||
def get_tourist_tax_return_tax(filters):
|
def get_tourist_tax_return_tax(filters):
|
||||||
"""Returns the sum of the tax of each Sales invoice with non zero tourist_tax_return
|
"""Returns the sum of the tax of each Sales invoice with non zero tourist_tax_return."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of the tax of each Sales invoice with non zero tourist_tax_return
|
|
||||||
"""
|
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(tourist_tax_return) from
|
select sum(tourist_tax_return) from
|
||||||
@ -404,14 +306,7 @@ def get_tourist_tax_return_tax(filters):
|
|||||||
""".format(where_conditions=conditions), filters)[0][0] or 0
|
""".format(where_conditions=conditions), filters)[0][0] or 0
|
||||||
|
|
||||||
def get_zero_rated_total(filters):
|
def get_zero_rated_total(filters):
|
||||||
"""Returns the sum of each Sales Invoice Item Amount which is zero rated
|
"""Returns the sum of each Sales Invoice Item Amount which is zero rated."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of each Sales Invoice Item Amount which is zero rated
|
|
||||||
"""
|
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(i.base_amount) as total from
|
select sum(i.base_amount) as total from
|
||||||
@ -421,14 +316,7 @@ def get_zero_rated_total(filters):
|
|||||||
""".format(where_conditions=conditions), filters)[0][0] or 0
|
""".format(where_conditions=conditions), filters)[0][0] or 0
|
||||||
|
|
||||||
def get_exempt_total(filters):
|
def get_exempt_total(filters):
|
||||||
"""Returns the sum of each Sales Invoice Item Amount which is Vat Exempt
|
"""Returns the sum of each Sales Invoice Item Amount which is Vat Exempt."""
|
||||||
|
|
||||||
Args:
|
|
||||||
filters (Dict, optional): Dictionary consisting of the filters selected by the user. Defaults to None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Float: sum of each Sales Invoice Item Amount which is Vat Exempt
|
|
||||||
"""
|
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select sum(i.base_amount) as total from
|
select sum(i.base_amount) as total from
|
||||||
|
@ -131,8 +131,7 @@ def add_print_formats():
|
|||||||
name in('Simplified Tax Invoice', 'Detailed Tax Invoice', 'Tax Invoice') """)
|
name in('Simplified Tax Invoice', 'Detailed Tax Invoice', 'Tax Invoice') """)
|
||||||
|
|
||||||
def add_custom_roles_for_reports():
|
def add_custom_roles_for_reports():
|
||||||
"""Add Access Control to UAE VAT 21
|
"""Add Access Control to UAE VAT 21."""
|
||||||
"""
|
|
||||||
if not frappe.db.get_value('Custom Role', dict(report='UAE VAT 21')):
|
if not frappe.db.get_value('Custom Role', dict(report='UAE VAT 21')):
|
||||||
frappe.get_doc(dict(
|
frappe.get_doc(dict(
|
||||||
doctype='Custom Role',
|
doctype='Custom Role',
|
||||||
@ -145,8 +144,7 @@ def add_custom_roles_for_reports():
|
|||||||
)).insert()
|
)).insert()
|
||||||
|
|
||||||
def add_permissions():
|
def add_permissions():
|
||||||
"""Add Permissions for UAE VAT Settings and UAE VAT Account
|
"""Add Permissions for UAE VAT Settings and UAE VAT Account."""
|
||||||
"""
|
|
||||||
for doctype in ('UAE VAT Setting', 'UAE VAT Account'):
|
for doctype in ('UAE VAT Setting', 'UAE VAT Account'):
|
||||||
add_permission(doctype, 'All', 0)
|
add_permission(doctype, 'All', 0)
|
||||||
for role in ('Accounts Manager', 'Accounts User', 'System Manager'):
|
for role in ('Accounts Manager', 'Accounts User', 'System Manager'):
|
||||||
|
@ -31,7 +31,7 @@ def update_itemised_tax_data(doc):
|
|||||||
row.total_amount = flt((row.net_amount + row.tax_amount), row.precision("total_amount"))
|
row.total_amount = flt((row.net_amount + row.tax_amount), row.precision("total_amount"))
|
||||||
|
|
||||||
def get_account_currency(account):
|
def get_account_currency(account):
|
||||||
"""Helper function to get account currency"""
|
"""Helper function to get account currency."""
|
||||||
if not account:
|
if not account:
|
||||||
return
|
return
|
||||||
def generator():
|
def generator():
|
||||||
@ -44,14 +44,7 @@ def get_account_currency(account):
|
|||||||
return frappe.local_cache("account_currency", account, generator)
|
return frappe.local_cache("account_currency", account, generator)
|
||||||
|
|
||||||
def get_tax_accounts(company):
|
def get_tax_accounts(company):
|
||||||
"""Get the list of tax accounts for a specific company
|
"""Get the list of tax accounts for a specific company."""
|
||||||
|
|
||||||
Args:
|
|
||||||
company (String): Current Company set as default
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
tax_accounts: List of Tax Accounts for the company
|
|
||||||
"""
|
|
||||||
tax_accounts_dict = frappe._dict()
|
tax_accounts_dict = frappe._dict()
|
||||||
tax_accounts_list = frappe.get_all("UAE VAT Account",
|
tax_accounts_list = frappe.get_all("UAE VAT Account",
|
||||||
filters={"parent": company},
|
filters={"parent": company},
|
||||||
@ -67,11 +60,7 @@ def get_tax_accounts(company):
|
|||||||
return tax_accounts_dict
|
return tax_accounts_dict
|
||||||
|
|
||||||
def update_grand_total_for_rcm(doc, method):
|
def update_grand_total_for_rcm(doc, method):
|
||||||
"""If the Reverse Charge is Applicable subtract the tax amount from the grand total and update in the form
|
"""If the Reverse Charge is Applicable subtract the tax amount from the grand total and update in the form."""
|
||||||
|
|
||||||
Args:
|
|
||||||
doc (Document): The document for the current Purchase Invoice
|
|
||||||
"""
|
|
||||||
country = frappe.get_cached_value('Company', doc.company, 'country')
|
country = frappe.get_cached_value('Company', doc.company, 'country')
|
||||||
|
|
||||||
if country != 'United Arab Emirates':
|
if country != 'United Arab Emirates':
|
||||||
@ -102,14 +91,7 @@ def update_grand_total_for_rcm(doc, method):
|
|||||||
update_totals(vat_tax, base_vat_tax, doc)
|
update_totals(vat_tax, base_vat_tax, doc)
|
||||||
|
|
||||||
def update_totals(vat_tax, base_vat_tax, doc):
|
def update_totals(vat_tax, base_vat_tax, doc):
|
||||||
"""Update the grand total values in the form
|
"""Update the grand total values in the form."""
|
||||||
|
|
||||||
Args:
|
|
||||||
vat_tax (float): Vat Tax to be subtracted
|
|
||||||
base_vat_tax (float): Base Vat Tax to be subtracted
|
|
||||||
doc (Document): The document for the current Purchase Invoice
|
|
||||||
"""
|
|
||||||
|
|
||||||
doc.base_grand_total -= base_vat_tax
|
doc.base_grand_total -= base_vat_tax
|
||||||
doc.grand_total -= vat_tax
|
doc.grand_total -= vat_tax
|
||||||
|
|
||||||
@ -130,16 +112,7 @@ def update_totals(vat_tax, base_vat_tax, doc):
|
|||||||
doc.set_payment_schedule()
|
doc.set_payment_schedule()
|
||||||
|
|
||||||
def make_regional_gl_entries(gl_entries, doc):
|
def make_regional_gl_entries(gl_entries, doc):
|
||||||
"""This method is hooked to the make_regional_gl_entries in Purchase Invoice.
|
"""Hooked to make_regional_gl_entries in Purchase Invoice.It appends the region specific general ledger entries to the list of GL Entries."""
|
||||||
It appends the region specific general ledger entries to the list of GL Entries.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
gl_entries (List): List of GL entries to be made
|
|
||||||
doc (Document): The document for the current Purchase Invoice
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
List: Updates list of GL Entries
|
|
||||||
"""
|
|
||||||
country = frappe.get_cached_value('Company', doc.company, 'country')
|
country = frappe.get_cached_value('Company', doc.company, 'country')
|
||||||
|
|
||||||
if country != 'United Arab Emirates':
|
if country != 'United Arab Emirates':
|
||||||
@ -170,7 +143,7 @@ def make_regional_gl_entries(gl_entries, doc):
|
|||||||
return gl_entries
|
return gl_entries
|
||||||
|
|
||||||
def validate_returns(doc, method):
|
def validate_returns(doc, method):
|
||||||
print("validate_returns")
|
"""Sum of Tourist Returns and Standard Rated Expenses should be less than Total Tax."""
|
||||||
country = frappe.get_cached_value('Company', doc.company, 'country')
|
country = frappe.get_cached_value('Company', doc.company, 'country')
|
||||||
|
|
||||||
if country != 'United Arab Emirates':
|
if country != 'United Arab Emirates':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user