mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 08:35:00 +00:00
fix(regional-uae): mark export items as zero rated
This commit is contained in:
@@ -428,3 +428,4 @@ erpnext.patches.v15_0.set_company_on_pos_inv_merge_log
|
||||
erpnext.patches.v15_0.rename_price_list_to_buying_price_list
|
||||
erpnext.patches.v15_0.patch_missing_buying_price_list_in_material_request
|
||||
erpnext.patches.v15_0.remove_sales_partner_from_consolidated_sales_invoice
|
||||
erpnext.patches.v15_0.update_uae_zero_rated_fetch
|
||||
|
||||
9
erpnext/patches/v15_0/update_uae_zero_rated_fetch.py
Normal file
9
erpnext/patches/v15_0/update_uae_zero_rated_fetch.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import frappe
|
||||
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
||||
|
||||
|
||||
def execute():
|
||||
if not frappe.db.get_value("Company", {"country": "United Arab Emirates"}):
|
||||
return
|
||||
|
||||
make_property_setter("Sales Invoice Item", "is_zero_rated", "fetch_if_empty", 1, "Check")
|
||||
@@ -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