chore(UAE VAT 21): rename report

This commit is contained in:
Mohammad Hasnain 2020-10-14 12:21:36 +05:30
parent abf628c95d
commit dfc3993cec
8 changed files with 14 additions and 18 deletions

View File

@ -83,7 +83,7 @@
{
"hidden": 0,
"label": "Value-Added Tax (VAT UAE)",
"links": "[\n {\n \"label\": \"UAE VAT Setting\",\n \"name\": \"UAE VAT Setting\",\n \"type\": \"doctype\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"UAE VAT 21\",\n \"name\": \"UAE VAT 21\",\n \"type\": \"report\"\n }\n]"
"links": "[\n {\n \"label\": \"UAE VAT Setting\",\n \"name\": \"UAE VAT Setting\",\n \"type\": \"doctype\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"UAE VAT 201\",\n \"name\": \"UAE VAT 201\",\n \"type\": \"report\"\n }\n]"
}
],
"category": "Modules",

View File

@ -2,7 +2,7 @@
// For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["UAE VAT 21"] = {
frappe.query_reports["UAE VAT 201"] = {
"filters": [
{
"fieldname": "company",

View File

@ -12,11 +12,11 @@
"modified": "2020-09-10 08:51:02.298482",
"modified_by": "Administrator",
"module": "Regional",
"name": "UAE VAT 21",
"name": "UAE VAT 201",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "GL Entry",
"report_name": "UAE VAT 21",
"report_name": "UAE VAT 201",
"report_type": "Script Report",
"roles": []
}

View File

@ -279,7 +279,7 @@ def get_standard_rated_expenses_total(filters):
select sum(total) from
`tabPurchase Invoice`
where
standard_rated_expenses > 0
claimable_standard_rated_expenses > 0
and docstatus = 1 {where_conditions} ;
""".format(where_conditions=conditions), filters)[0][0] or 0
@ -287,10 +287,10 @@ def get_standard_rated_expenses_tax(filters):
"""Returns the sum of the tax of each Purchase invoice made."""
conditions = get_conditions(filters)
return frappe.db.sql("""
select sum(standard_rated_expenses) from
select sum(claimable_standard_rated_expenses) from
`tabPurchase Invoice`
where
standard_rated_expenses > 0
claimable_standard_rated_expenses > 0
and docstatus = 1 {where_conditions} ;
""".format(where_conditions=conditions), filters)[0][0] or 0

View File

@ -38,11 +38,11 @@ def make_custom_fields():
dict(fieldname='supplier_name_in_arabic', label='Supplier Name in Arabic',
fieldtype='Read Only', insert_after='supplier_name',
fetch_from='supplier.supplier_name_in_arabic', print_hide=1),
dict(fieldname='standard_rated_expenses', label='Standard Rated Expenses (AED)',
dict(fieldname='claimable_standard_rated_expenses', label='Claimable Standard Rated Expenses (AED)',
insert_after='permit_no', fieldtype='Currency', print_hide=1, default='0',
depends_on="eval:doc.reverse_charge=='N'",),
dict(fieldname='reverse_charge', label='Reverse Charge Applicable',
fieldtype='Select', insert_after='standard_rated_expenses', print_hide=1,
fieldtype='Select', insert_after='claimable_standard_rated_expenses', print_hide=1,
options='Y\nN', default='N'),
dict(fieldname='claimable_reverse_charge', label='Claimable Reverse Charge (Percentage)',
insert_after='reverse_charge', fieldtype='Percent', print_hide=1,
@ -132,11 +132,11 @@ def add_print_formats():
name in('Simplified Tax Invoice', 'Detailed Tax Invoice', 'Tax Invoice') """)
def add_custom_roles_for_reports():
"""Add Access Control to UAE VAT 21."""
if not frappe.db.get_value('Custom Role', dict(report='UAE VAT 21')):
"""Add Access Control to UAE VAT 201."""
if not frappe.db.get_value('Custom Role', dict(report='UAE VAT 201')):
frappe.get_doc(dict(
doctype='Custom Role',
report='UAE VAT 21',
report='UAE VAT 201',
roles= [
dict(role='Accounts User'),
dict(role='Accounts Manager'),

View File

@ -145,11 +145,7 @@ def make_regional_gl_entries(gl_entries, doc):
def validate_returns(doc, method):
"""Standard Rated expenses should not be set when Reverse Charge Applicable is set."""
country = frappe.get_cached_value('Company', doc.company, 'country')
print("-"*50)
print(doc.reverse_charge)
print(flt(doc.standard_rated_expenses))
if country != 'United Arab Emirates':
return
if doc.reverse_charge == 'Y' and flt(doc.standard_rated_expenses) != 0:
frappe.throw(_("Standard Rated expenses should not be set when Reverse Charge Applicable is Y"))
if doc.reverse_charge == 'Y' and flt(doc.claimable_standard_rated_expenses) != 0:
frappe.throw(_("Claimable Standard Rated expenses should not be set when Reverse Charge Applicable is Y"))