feat(UAE VAT 21): Move standard rated expense from Sales invoice to Purchase invoice
This commit is contained in:
parent
fc2ace1a31
commit
ac451b3a54
@ -242,15 +242,13 @@ 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": {
|
||||
"validate": [
|
||||
"erpnext.regional.india.utils.update_grand_total_for_rcm",
|
||||
"erpnext.regional.united_arab_emirates.utils.update_grand_total_for_rcm",
|
||||
"erpnext.regional.united_arab_emirates.utils.validate_returns"
|
||||
]
|
||||
},
|
||||
"Payment Entry": {
|
||||
|
@ -277,7 +277,7 @@ def get_standard_rated_expenses_total(filters):
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""
|
||||
select sum(total) from
|
||||
`tabSales Invoice`
|
||||
`tabPurchase Invoice`
|
||||
where
|
||||
standard_rated_expenses > 0
|
||||
and docstatus = 1 {where_conditions} ;
|
||||
@ -288,7 +288,7 @@ def get_standard_rated_expenses_tax(filters):
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""
|
||||
select sum(standard_rated_expenses) from
|
||||
`tabSales Invoice`
|
||||
`tabPurchase Invoice`
|
||||
where
|
||||
standard_rated_expenses > 0
|
||||
and docstatus = 1 {where_conditions} ;
|
||||
|
@ -38,8 +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)',
|
||||
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='permit_no', print_hide=1,
|
||||
fieldtype='Select', insert_after='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,
|
||||
@ -57,8 +60,6 @@ def make_custom_fields():
|
||||
fieldtype='Read Only', fetch_from='customer_address.emirates'),
|
||||
dict(fieldname='tourist_tax_return', label='Tax Refund provided to Tourists (AED)',
|
||||
insert_after='permit_no', fieldtype='Currency', print_hide=1, default='0'),
|
||||
dict(fieldname='standard_rated_expenses', label='Standard Rated Expenses (AED)',
|
||||
insert_after='tourist_tax_return', fieldtype='Currency', print_hide=1, default='0'),
|
||||
]
|
||||
|
||||
invoice_item_fields = [
|
||||
|
@ -143,11 +143,13 @@ def make_regional_gl_entries(gl_entries, doc):
|
||||
return gl_entries
|
||||
|
||||
def validate_returns(doc, method):
|
||||
"""Sum of Tourist Returns and Standard Rated Expenses should be less than Total Tax."""
|
||||
"""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 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)"))
|
||||
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"))
|
Loading…
Reference in New Issue
Block a user