feat(UAE VAT 21): Add region fields for UAE VAT 21

This commit is contained in:
hasnain2808 2020-09-24 13:21:23 +05:30
parent f44524dd3e
commit 3ef11b1d64
3 changed files with 30 additions and 5 deletions

View File

@ -243,6 +243,9 @@ doc_events = {
"erpnext.regional.italy.utils.sales_invoice_on_cancel",
"erpnext.erpnext_integrations.taxjar_integration.delete_transaction"
],
"validate": [
"erpnext.regional.united_arab_emirates.utils.validate_returns",
],
"on_trash": "erpnext.regional.check_deletion_permission"
},
"Purchase Invoice": {

View File

@ -20,9 +20,6 @@ def make_custom_fields():
insert_after='group_same_items', print_hide=1, collapsible=1),
dict(fieldname='permit_no', label='Permit Number',
fieldtype='Data', insert_after='vat_section', print_hide=1),
dict(fieldname='reverse_charge', label='Reverse Charge Applicable',
fieldtype='Select', insert_after='permit_no', print_hide=1,
options='Y\nN', default='N')
]
purchase_invoice_fields = [
@ -31,7 +28,12 @@ def make_custom_fields():
fetch_from='company.tax_id', print_hide=1),
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)
fetch_from='supplier.supplier_name_in_arabic', print_hide=1),
dict(fieldname='reverse_charge', label='Reverse Charge Applicable',
fieldtype='Select', insert_after='permit_no', print_hide=1,
options='Y\nN', default='N'),
dict(fieldname='claimable_reverse_charge', label='Claimable Reverse Charge (Percentage)',
insert_after='reverse_charge', fieldtype='Percent'),
]
sales_invoice_fields = [
@ -43,6 +45,12 @@ def make_custom_fields():
fetch_from='customer.customer_name_in_arabic', print_hide=1),
dict(fieldname='emirate', label='Emirate', insert_after='customer_address',
fieldtype='Read Only', fetch_from='customer_address.emirates'),
dict(fieldname='returns_column_break', fieldtype='Column Break',
insert_after='select_print_heading'),
dict(fieldname='tourist_tax_return', label='Tax Refund provided to Tourists (AED)',
insert_after='returns_column_break', fieldtype='Currency',),
dict(fieldname='standard_rated_expenses', label='Standard Rated Expenses (AED)',
insert_after='tourist_tax_return', fieldtype='Currency',),
]
invoice_item_fields = [
@ -69,6 +77,10 @@ def make_custom_fields():
'Item': [
dict(fieldname='tax_code', label='Tax Code',
fieldtype='Data', insert_after='item_group'),
# dict(fieldname='is_zero_rated', label='Is Zero Rated',
# fieldtype='Check', insert_after='tax_code'),
# dict(fieldname='is_exempt', label='Is Exempt ',
# fieldtype='Check', insert_after='is_zero_rated')
],
'Customer': [
dict(fieldname='customer_name_in_arabic', label='Customer Name in Arabic',

View File

@ -166,4 +166,14 @@ def make_regional_gl_entries(gl_entries, doc):
else tax.tax_amount_after_discount_amount
}, account_currency, item=tax)
)
return gl_entries
return gl_entries
def validate_returns(doc, method):
print("validate_returns")
country = frappe.get_cached_value('Company', doc.company, 'country')
if country != 'United Arab Emirates':
return
if flt(doc.tourist_tax_return) + flt(doc.standard_rated_expenses) > flt(doc.total_taxes_and_charges):
frappe.throw(_("The Total Returns(Tax Refund provided to Tourists (AED) + Standard Rated Expenses (AED)) should be less than the Total Taxes and Charges (Company Currency)"))