Refactor(UAE VAT 201): Fix fomatiing
diff --git a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py
index 5fdb264..b0a21de 100644
--- a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py
+++ b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py
@@ -8,8 +8,8 @@
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse_account
from erpnext.regional.report.uae_vat_201.uae_vat_201 import (
- get_total_emiratewise,
- get_tourist_tax_return_total,
+ get_total_emiratewise,
+ get_tourist_tax_return_total,
get_tourist_tax_return_tax,
get_zero_rated_total,
get_exempt_total,
@@ -26,7 +26,6 @@
frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company UAE VAT'")
frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company UAE VAT'")
-
make_company("_Test Company UAE VAT", "_TCUV")
set_vat_accounts()
@@ -79,7 +78,6 @@
else:
company = frappe.get_doc("Company", company_name)
- # indempotent
company.create_default_warehouses()
if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": company.name}):
@@ -95,7 +93,7 @@
fields=["name"],
filters = {
"company": "_Test Company UAE VAT",
- "is_group": 0,
+ "is_group": 0,
"account_type": "Tax"
}
)
@@ -103,7 +101,7 @@
uae_vat_accounts = []
for account in vat_accounts:
uae_vat_accounts.append({
- "doctype": "UAE VAT Account",
+ "doctype": "UAE VAT Account",
"account": account.name
})
@@ -125,7 +123,6 @@
customer = frappe.get_doc("Customer", "_Test UAE Customer")
def make_supplier():
-
if not frappe.db.exists("Supplier", "_Test UAE Supplier"):
frappe.get_doc({
"supplier_group": "Local",
@@ -140,15 +137,15 @@
warehouse_id = erpnext.encode_company_abbr(warehouse_name, company)
if not frappe.db.exists("Warehouse", warehouse_id):
- w = frappe.new_doc("Warehouse")
- w.warehouse_name = warehouse_name
- w.parent_warehouse = "All Warehouses - _TCUV"
- w.company = company
- w.account = get_warehouse_account(warehouse_name, company)
+ warehouse = frappe.new_doc("Warehouse")
+ warehouse.warehouse_name = warehouse_name
+ warehouse.parent_warehouse = "All Warehouses - _TCUV"
+ warehouse.company = company
+ warehouse.account = get_warehouse_account(warehouse_name, company)
if properties:
- w.update(properties)
- w.save()
- return w.name
+ warehouse.update(properties)
+ warehouse.save()
+ return warehouse.name
else:
return warehouse_id
@@ -166,13 +163,15 @@
if properties:
item.update(properties)
-
+
item.insert()
return item
def make_sales_invoices():
- si = create_sales_invoice(company="_Test Company UAE VAT",
+ def make_sales_invoices_wrapper(emirate, item, tax = True, tourist_tax= False):
+ si = create_sales_invoice(
+ company="_Test Company UAE VAT",
customer = '_Test UAE Customer',
currency = 'AED',
warehouse = 'Finished Goods - _TCUV',
@@ -180,119 +179,60 @@
income_account = 'Sales - _TCUV',
expense_account = 'Cost of Goods Sold - _TCUV',
cost_center = 'Main - _TCUV',
- sales_taxes_and_charges_template = "UAE VAT 5% - _TCUV",
- item = "_Test UAE VAT Item",
+ item = item,
do_not_save=1
)
- si.append("taxes", {
- "charge_type": "On Net Total",
- "account_head": "VAT 5% - _TCUV",
- "cost_center": "Main - _TCUV",
- "description": "VAT 5% @ 5.0",
- "rate": 5.0
- })
- si.vat_emirate = 'Dubai'
- si.submit()
+ si.vat_emirate = emirate
+ if tax:
+ si.append(
+ "taxes", {
+ "charge_type": "On Net Total",
+ "account_head": "VAT 5% - _TCUV",
+ "cost_center": "Main - _TCUV",
+ "description": "VAT 5% @ 5.0",
+ "rate": 5.0
+ }
+ )
+ if tourist_tax:
+ si.tourist_tax_return = 2
+ si.submit()
- si = create_sales_invoice(company="_Test Company UAE VAT",
- customer = '_Test UAE Customer',
- currency = 'AED',
- warehouse = 'Finished Goods - _TCUV',
- debit_to = 'Debtors - _TCUV',
- income_account = 'Sales - _TCUV',
- expense_account = 'Cost of Goods Sold - _TCUV',
- cost_center = 'Main - _TCUV',
- sales_taxes_and_charges_template = "UAE VAT 5% - _TCUV",
- item = "_Test UAE VAT Item",
- do_not_save=1
- )
- si.vat_emirate = 'Sharjah'
- si.append("taxes", {
- "charge_type": "On Net Total",
- "account_head": "VAT 5% - _TCUV",
- "cost_center": "Main - _TCUV",
- "description": "VAT 5% @ 5.0",
- "rate": 5.0
- })
- si.submit()
+ #Define Item Names
+ uae_item = "_Test UAE VAT Item"
+ uae_exempt_item = "_Test UAE VAT Exempt Item"
+ uae_zero_rated_item = "_Test UAE VAT Zero Rated Item"
- si = create_sales_invoice(company="_Test Company UAE VAT",
- customer = '_Test UAE Customer',
- currency = 'AED',
- warehouse = 'Finished Goods - _TCUV',
- debit_to = 'Debtors - _TCUV',
- income_account = 'Sales - _TCUV',
- expense_account = 'Cost of Goods Sold - _TCUV',
- cost_center = 'Main - _TCUV',
- sales_taxes_and_charges_template = "UAE VAT 5% - _TCUV",
- item = "_Test UAE VAT Item",
- do_not_save=1
- )
-
- si.tourist_tax_return = 2
-
- si.vat_emirate = 'Dubai'
-
- si.append("taxes", {
- "charge_type": "On Net Total",
- "account_head": "VAT 5% - _TCUV",
- "cost_center": "Main - _TCUV",
- "description": "VAT 5% @ 5.0",
- "rate": 5.0
- })
- si.submit()
-
- si = create_sales_invoice(company="_Test Company UAE VAT",
- customer = '_Test UAE Customer',
- currency = 'AED',
- warehouse = 'Finished Goods - _TCUV',
- debit_to = 'Debtors - _TCUV',
- income_account = 'Sales - _TCUV',
- expense_account = 'Cost of Goods Sold - _TCUV',
- cost_center = 'Main - _TCUV',
- sales_taxes_and_charges_template = "UAE VAT 5% - _TCUV",
- item = "_Test UAE VAT Zero Rated Item",
- do_not_save=1
- )
- si.vat_emirate = 'Sharjah'
- si.submit()
-
- si = create_sales_invoice(company="_Test Company UAE VAT",
- customer = '_Test UAE Customer',
- currency = 'AED',
- warehouse = 'Finished Goods - _TCUV',
- debit_to = 'Debtors - _TCUV',
- income_account = 'Sales - _TCUV',
- expense_account = 'Cost of Goods Sold - _TCUV',
- cost_center = 'Main - _TCUV',
- sales_taxes_and_charges_template = "UAE VAT 5% - _TCUV",
- item = "_Test UAE VAT Exempt Item",
- do_not_save=1
- )
- si.vat_emirate = 'Sharjah'
- si.submit()
+ #Sales Invoice with standard rated expense in Dubai
+ make_sales_invoices_wrapper('Dubai', uae_item)
+ #Sales Invoice with standard rated expense in Sharjah
+ make_sales_invoices_wrapper('Sharjah', uae_item)
+ #Sales Invoice with Tourist Tax Return
+ make_sales_invoices_wrapper('Dubai', uae_item, True, True)
+ #Sales Invoice with Exempt Item
+ make_sales_invoices_wrapper('Sharjah', uae_exempt_item, False)
+ #Sales Invoice with Zero Rated Item
+ make_sales_invoices_wrapper('Sharjah', uae_zero_rated_item, False)
def create_purchase_invoices():
-
pi = make_purchase_invoice(
- company="_Test Company UAE VAT",
- supplier = '_Test UAE Supplier',
- supplier_warehouse = '_Test UAE VAT Supplier Warehouse - _TCUV',
- warehouse = '_Test UAE VAT Supplier Warehouse - _TCUV',
- currency = 'AED',
- cost_center = 'Main - _TCUV',
- expense_account = 'Cost of Goods Sold - _TCUV',
- item = "_Test UAE VAT Item",
- do_not_save=1,
- uom = "Nos"
- )
+ company="_Test Company UAE VAT",
+ supplier = '_Test UAE Supplier',
+ supplier_warehouse = '_Test UAE VAT Supplier Warehouse - _TCUV',
+ warehouse = '_Test UAE VAT Supplier Warehouse - _TCUV',
+ currency = 'AED',
+ cost_center = 'Main - _TCUV',
+ expense_account = 'Cost of Goods Sold - _TCUV',
+ item = "_Test UAE VAT Item",
+ do_not_save=1,
+ uom = "Nos"
+ )
pi.append("taxes", {
- "charge_type": "On Net Total",
- "account_head": "VAT 5% - _TCUV",
- "cost_center": "Main - _TCUV",
- "description": "VAT 5% @ 5.0",
- "rate": 5.0
- })
+ "charge_type": "On Net Total",
+ "account_head": "VAT 5% - _TCUV",
+ "cost_center": "Main - _TCUV",
+ "description": "VAT 5% @ 5.0",
+ "rate": 5.0
+ })
pi.recoverable_standard_rated_expenses = 1
diff --git a/erpnext/regional/report/uae_vat_201/uae_vat_201.py b/erpnext/regional/report/uae_vat_201/uae_vat_201.py
index f641e65..78dcb36 100644
--- a/erpnext/regional/report/uae_vat_201/uae_vat_201.py
+++ b/erpnext/regional/report/uae_vat_201/uae_vat_201.py
@@ -54,11 +54,11 @@
labels = []
amount = []
vat_amount = []
- for d in emirates:
- if d in amounts_by_emirate:
- amount.append(amounts_by_emirate[d]["raw_amount"])
- vat_amount.append(amounts_by_emirate[d]["raw_vat_amount"])
- labels.append(d)
+ 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})
@@ -81,7 +81,8 @@
emirates, amounts_by_emirate = standard_rated_expenses_emiratewise(data, filters)
- append_data(data, '2', _('Tax Refunds provided to Tourists under the Tax Refunds for Tourists Scheme'),
+ append_data(data, '2',
+ _('Tax Refunds provided to Tourists under the Tax Refunds for Tourists Scheme'),
frappe.format((-1) * get_tourist_tax_return_total(filters), 'Currency'),
frappe.format((-1) * get_tourist_tax_return_tax(filters), 'Currency'))
@@ -104,37 +105,26 @@
total_emiratewise = get_total_emiratewise(filters)
emirates = get_emirates()
amounts_by_emirate = {}
- for d in total_emiratewise:
- emirate, amount, vat= d
+ for emirate, amount, vat in total_emiratewise:
amounts_by_emirate[emirate] = {
- "legend": emirate,
- "raw_amount": amount,
- "raw_vat_amount": vat,
- "amount": frappe.format(amount, 'Currency'),
- "vat_amount": frappe.format(vat, 'Currency'),
- }
+ "legend": emirate,
+ "raw_amount": amount,
+ "raw_vat_amount": vat,
+ "amount": frappe.format(amount, 'Currency'),
+ "vat_amount": frappe.format(vat, 'Currency'),
+ }
amounts_by_emirate = append_emiratewise_expenses(data, emirates, amounts_by_emirate)
-
- for d, emirate in enumerate(emirates, 97):
- if emirate in amounts_by_emirate:
- amounts_by_emirate[emirate]["no"] = _('1{0}').format(chr(d))
- amounts_by_emirate[emirate]["legend"] = _('Standard rated supplies in {0}').format(emirate)
- data.append(amounts_by_emirate[emirate])
- else:
- append_data(data, _('1{0}').format(chr(d)),
- _('Standard rated supplies in {0}').format(emirate),
- frappe.format(0, 'Currency'), frappe.format(0, 'Currency'))
return emirates, amounts_by_emirate
def append_emiratewise_expenses(data, emirates, amounts_by_emirate):
"""Append emiratewise standard rated expenses and vat."""
- for d, emirate in enumerate(emirates, 97):
+ for no, emirate in enumerate(emirates, 97):
if emirate in amounts_by_emirate:
- amounts_by_emirate[emirate]["no"] = _('1{0}').format(chr(d))
+ amounts_by_emirate[emirate]["no"] = _('1{0}').format(chr(no))
amounts_by_emirate[emirate]["legend"] = _('Standard rated supplies in {0}').format(emirate)
data.append(amounts_by_emirate[emirate])
else:
- append_data(data, _('1{0}').format(chr(d)),
+ append_data(data, _('1{0}').format(chr(no)),
_('Standard rated supplies in {0}').format(emirate),
frappe.format(0, 'Currency'), frappe.format(0, 'Currency'))
return amounts_by_emirate
@@ -145,11 +135,9 @@
append_data(data, '9', _('Standard Rated Expenses'),
frappe.format(get_standard_rated_expenses_total(filters), 'Currency'),
frappe.format(get_standard_rated_expenses_tax(filters), 'Currency'))
-
append_data(data, '10', _('Supplies subject to the reverse charge provision'),
frappe.format(get_reverse_charge_recoverable_total(filters), 'Currency'),
- frappe.format(get_reverse_charge_recoverable_tax(filters), 'Currency')
-)
+ frappe.format(get_reverse_charge_recoverable_tax(filters), 'Currency'))
def append_data(data, no, legend, amount, vat_amount):
"""Returns data with appended value."""
@@ -159,7 +147,7 @@
"""Returns Emiratewise Amount and Taxes."""
query_filters = get_filters(filters)
query_filters['docstatus'] = ['=', 1]
- return frappe.db.get_list('Sales Invoice',
+ return frappe.db.get_all('Sales Invoice',
filters = query_filters,
fields = ['vat_emirate as emirate','sum(total)', 'sum(total_taxes_and_charges)'],
group_by='vat_emirate',
@@ -194,26 +182,30 @@
query_filters = get_filters(filters)
query_filters['reverse_charge'] = ['=', 'Y']
query_filters['docstatus'] = ['=', 1]
- return frappe.db.get_list('Purchase Invoice',
- filters = query_filters,
- fields = ['sum(total)'],
- as_list=True,
- limit = 1
- )[0][0] or 0
+ try:
+ return frappe.db.get_all('Purchase Invoice',
+ filters = query_filters,
+ fields = ['sum(total)'],
+ as_list=True,
+ limit = 1
+ )[0][0] or 0
+ except (IndexError, TypeError):
+ return 0
def get_reverse_charge_tax(filters):
"""Returns the sum of the tax of each Purchase invoice made."""
conditions = get_conditions_join(filters)
return frappe.db.sql("""
select sum(debit) from
- `tabPurchase Invoice` p inner join `tabGL Entry` gl
- on gl.voucher_no = p.name
+ `tabPurchase Invoice` p inner join `tabGL Entry` gl
+ on
+ gl.voucher_no = p.name
where
- p.reverse_charge = "Y"
- and p.docstatus = 1
- and gl.docstatus = 1
- and account in (select account from `tabUAE VAT Account` where parent=%(company)s)
- {where_conditions} ;
+ p.reverse_charge = "Y"
+ and p.docstatus = 1
+ and gl.docstatus = 1
+ and account in (select account from `tabUAE VAT Account` where parent=%(company)s)
+ {where_conditions} ;
""".format(where_conditions=conditions), filters)[0][0] or 0
def get_reverse_charge_recoverable_total(filters):
@@ -222,27 +214,33 @@
query_filters['reverse_charge'] = ['=', 'Y']
query_filters['recoverable_reverse_charge'] = ['>', '0']
query_filters['docstatus'] = ['=', 1]
- return frappe.db.get_list('Purchase Invoice',
- filters = query_filters,
- fields = ['sum(total)'],
- as_list=True,
- limit = 1
- )[0][0] or 0
+ try:
+ return frappe.db.get_all('Purchase Invoice',
+ filters = query_filters,
+ fields = ['sum(total)'],
+ as_list=True,
+ limit = 1
+ )[0][0] or 0
+ except (IndexError, TypeError):
+ return 0
def get_reverse_charge_recoverable_tax(filters):
"""Returns the sum of the tax of each Purchase invoice made."""
conditions = get_conditions_join(filters)
return frappe.db.sql("""
- select sum(debit * p.recoverable_reverse_charge / 100) from
- `tabPurchase Invoice` p inner join `tabGL Entry` gl
- on gl.voucher_no = p.name
+ select
+ sum(debit * p.recoverable_reverse_charge / 100)
+ from
+ `tabPurchase Invoice` p inner join `tabGL Entry` gl
+ on
+ gl.voucher_no = p.name
where
- p.reverse_charge = "Y"
- and p.docstatus = 1
- and p.recoverable_reverse_charge > 0
- and gl.docstatus = 1
- and account in (select account from `tabUAE VAT Account` where parent=%(company)s)
- {where_conditions} ;
+ p.reverse_charge = "Y"
+ and p.docstatus = 1
+ and p.recoverable_reverse_charge > 0
+ and gl.docstatus = 1
+ and account in (select account from `tabUAE VAT Account` where parent=%(company)s)
+ {where_conditions} ;
""".format(where_conditions=conditions), filters)[0][0] or 0
def get_conditions_join(filters):
@@ -251,8 +249,8 @@
for opts in (("company", " and p.company=%(company)s"),
("from_date", " and p.posting_date>=%(from_date)s"),
("to_date", " and p.posting_date<=%(to_date)s")):
- if filters.get(opts[0]):
- conditions += opts[1]
+ if filters.get(opts[0]):
+ conditions += opts[1]
return conditions
def get_standard_rated_expenses_total(filters):
@@ -260,77 +258,102 @@
query_filters = get_filters(filters)
query_filters['recoverable_standard_rated_expenses'] = ['>', 0]
query_filters['docstatus'] = ['=', 1]
- return frappe.db.get_list('Purchase Invoice',
- filters = query_filters,
- fields = ['sum(total)'],
- as_list=True,
- limit = 1
- )[0][0] or 0
+ try:
+ return frappe.db.get_all('Purchase Invoice',
+ filters = query_filters,
+ fields = ['sum(total)'],
+ as_list=True,
+ limit = 1
+ )[0][0] or 0
+ except (IndexError, TypeError):
+ return 0
def get_standard_rated_expenses_tax(filters):
"""Returns the sum of the tax of each Purchase invoice made."""
query_filters = get_filters(filters)
query_filters['recoverable_standard_rated_expenses'] = ['>', 0]
query_filters['docstatus'] = ['=', 1]
- return frappe.db.get_list('Purchase Invoice',
- filters = query_filters,
- fields = ['sum(recoverable_standard_rated_expenses)'],
- as_list=True,
- limit = 1
- )[0][0] or 0
+ try:
+ return frappe.db.get_all('Purchase Invoice',
+ filters = query_filters,
+ fields = ['sum(recoverable_standard_rated_expenses)'],
+ as_list=True,
+ limit = 1
+ )[0][0] or 0
+ except (IndexError, TypeError):
+ return 0
def get_tourist_tax_return_total(filters):
"""Returns the sum of the total of each Sales invoice with non zero tourist_tax_return."""
query_filters = get_filters(filters)
query_filters['tourist_tax_return'] = ['>', 0]
query_filters['docstatus'] = ['=', 1]
- return frappe.db.get_list('Sales Invoice',
- filters = query_filters,
- fields = ['sum(total)'],
- as_list=True,
- limit = 1
- )[0][0] or 0
+ try:
+ return frappe.db.get_all('Sales Invoice',
+ filters = query_filters,
+ fields = ['sum(total)'],
+ as_list=True,
+ limit = 1
+ )[0][0] or 0
+ except (IndexError, TypeError):
+ return 0
def get_tourist_tax_return_tax(filters):
"""Returns the sum of the tax of each Sales invoice with non zero tourist_tax_return."""
query_filters = get_filters(filters)
query_filters['tourist_tax_return'] = ['>', 0]
query_filters['docstatus'] = ['=', 1]
- return frappe.db.get_list('Sales Invoice',
- filters = query_filters,
- fields = ['sum(tourist_tax_return)'],
- as_list=True,
- limit = 1
- )[0][0] or 0
+ try:
+ return frappe.db.get_all('Sales Invoice',
+ filters = query_filters,
+ fields = ['sum(tourist_tax_return)'],
+ as_list=True,
+ limit = 1
+ )[0][0] or 0
+ except (IndexError, TypeError):
+ return 0
def get_zero_rated_total(filters):
"""Returns the sum of each Sales Invoice Item Amount which is zero rated."""
conditions = get_conditions(filters)
- return frappe.db.sql("""
- select sum(i.base_amount) as total from
- `tabSales Invoice Item` i inner join `tabSales Invoice` s
- on i.parent = s.name
- where s.docstatus = 1 and i.is_zero_rated = 1
- {where_conditions} ;
- """.format(where_conditions=conditions), filters)[0][0] or 0
+ try:
+ return frappe.db.sql("""
+ select
+ sum(i.base_amount) as total
+ from
+ `tabSales Invoice Item` i inner join `tabSales Invoice` s
+ on
+ i.parent = s.name
+ where
+ s.docstatus = 1 and i.is_zero_rated = 1
+ {where_conditions} ;
+ """.format(where_conditions=conditions), filters)[0][0] or 0
+ except (IndexError, TypeError):
+ return 0
def get_exempt_total(filters):
"""Returns the sum of each Sales Invoice Item Amount which is Vat Exempt."""
conditions = get_conditions(filters)
- return frappe.db.sql("""
- select sum(i.base_amount) as total from
- `tabSales Invoice Item` i inner join `tabSales Invoice` s
- on i.parent = s.name
- where s.docstatus = 1 and i.is_exempt = 1
- {where_conditions} ;
- """.format(where_conditions=conditions), filters)[0][0] or 0
-
+ try:
+ return frappe.db.sql("""
+ select
+ sum(i.base_amount) as total
+ from
+ `tabSales Invoice Item` i inner join `tabSales Invoice` s
+ on
+ i.parent = s.name
+ where
+ s.docstatus = 1 and i.is_exempt = 1
+ {where_conditions} ;
+ """.format(where_conditions=conditions), filters)[0][0] or 0
+ except (IndexError, TypeError):
+ return 0
def get_conditions(filters):
"""The conditions to be used to filter data to calculate the total sale."""
conditions = ""
for opts in (("company", " and company=%(company)s"),
("from_date", " and posting_date>=%(from_date)s"),
("to_date", " and posting_date<=%(to_date)s")):
- if filters.get(opts[0]):
- conditions += opts[1]
+ if filters.get(opts[0]):
+ conditions += opts[1]
return conditions
diff --git a/erpnext/regional/united_arab_emirates/utils.py b/erpnext/regional/united_arab_emirates/utils.py
index 7430db4..8728394 100644
--- a/erpnext/regional/united_arab_emirates/utils.py
+++ b/erpnext/regional/united_arab_emirates/utils.py
@@ -35,7 +35,12 @@
if not account:
return
def generator():
- account_currency, company = frappe.get_cached_value("Account", account, ["account_currency", "company"])
+ account_currency, company = frappe.get_cached_value(
+ "Account",
+ account,
+ ["account_currency",
+ "company"]
+ )
if not account_currency:
account_currency = frappe.get_cached_value('Company', company, "default_currency")
@@ -53,8 +58,8 @@
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))
- for d in tax_accounts_list:
- for key, name in d.items():
+ for tax_account in tax_accounts_list:
+ for _, name in tax_account.items():
tax_accounts_dict[name] = name
return tax_accounts_dict
@@ -131,8 +136,7 @@
if flt(tax.base_tax_amount_after_discount_amount) and tax.account_head in tax_accounts:
account_currency = get_account_currency(tax.account_head)
- gl_entries.append(doc.get_gl_dict(
- {
+ gl_entries.append(doc.get_gl_dict({
"account": tax.account_head,
"cost_center": tax.cost_center,
"posting_date": doc.posting_date,
@@ -141,8 +145,8 @@
dr_or_cr + "_in_account_currency": tax.base_tax_amount_after_discount_amount \
if account_currency==doc.company_currency \
else tax.tax_amount_after_discount_amount
- }, account_currency, item=tax)
- )
+ }, account_currency, item=tax
+ ))
return gl_entries
@@ -152,4 +156,6 @@
if country != 'United Arab Emirates':
return
if doc.reverse_charge == 'Y' and flt(doc.recoverable_standard_rated_expenses) != 0:
- frappe.throw(_("Recoverable Standard Rated expenses should not be set when Reverse Charge Applicable is Y"))
\ No newline at end of file
+ frappe.throw(_(
+ "Recoverable Standard Rated expenses should not be set when Reverse Charge Applicable is Y"
+ ))