mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
fix(regional-uae): mark export items as zero rated
This commit is contained in:
@@ -143,7 +143,7 @@ def get_total_emiratewise(filters):
|
||||
on
|
||||
i.parent = s.name
|
||||
where
|
||||
s.docstatus = 1 and i.is_exempt != 1 and i.is_zero_rated != 1
|
||||
s.docstatus = 1 and i.is_exempt != 1 and i.is_zero_rated != 1
|
||||
{conditions}
|
||||
group by
|
||||
s.vat_emirate;
|
||||
|
||||
@@ -20,6 +20,7 @@ def make_custom_fields():
|
||||
label="Is Zero Rated",
|
||||
fieldtype="Check",
|
||||
fetch_from="item_code.is_zero_rated",
|
||||
fetch_if_empty=1,
|
||||
insert_after="description",
|
||||
print_hide=1,
|
||||
)
|
||||
|
||||
@@ -7,10 +7,6 @@ from erpnext.controllers.taxes_and_totals import get_itemised_tax
|
||||
|
||||
|
||||
def update_itemised_tax_data(doc):
|
||||
# maybe this should be a standard function rather than a regional one
|
||||
if not doc.taxes:
|
||||
return
|
||||
|
||||
if not doc.items:
|
||||
return
|
||||
|
||||
@@ -19,6 +15,14 @@ def update_itemised_tax_data(doc):
|
||||
return
|
||||
|
||||
itemised_tax = get_itemised_tax(doc.taxes)
|
||||
is_export = 0
|
||||
|
||||
if doc.customer_address and doc.company_address:
|
||||
company_country = frappe.get_cached_value("Address", doc.company_address, "country")
|
||||
customer_country = frappe.db.get_value("Address", doc.customer_address, "country")
|
||||
|
||||
if company_country != customer_country:
|
||||
is_export = 1
|
||||
|
||||
for row in doc.items:
|
||||
tax_rate, tax_amount = 0.0, 0.0
|
||||
@@ -30,6 +34,7 @@ def update_itemised_tax_data(doc):
|
||||
tax_amount += flt((row.net_amount * _tax_rate) / 100, row.precision("tax_amount"))
|
||||
tax_rate += _tax_rate
|
||||
|
||||
row.is_zero_rated = is_export
|
||||
row.tax_rate = flt(tax_rate, row.precision("tax_rate"))
|
||||
row.tax_amount = flt(tax_amount, row.precision("tax_amount"))
|
||||
row.total_amount = flt((row.net_amount + row.tax_amount), row.precision("total_amount"))
|
||||
|
||||
Reference in New Issue
Block a user