fix: KSA VAT setup issues
This commit is contained in:
parent
419e03954c
commit
c81d4734c4
@ -49,7 +49,6 @@ frappe.query_reports["KSA VAT"] = {
|
||||
value = $(`<span>${value}</span>`);
|
||||
var $value = $(value).css("font-weight", "bold");
|
||||
value = $value.wrap("<p></p>").parent().html();
|
||||
console.log($value)
|
||||
return value
|
||||
}
|
||||
}else{
|
||||
|
@ -118,14 +118,14 @@ def get_tax_data_for_each_vat_setting(vat_setting, filters, doctype):
|
||||
total_taxable_adjustment_amount = 0
|
||||
total_tax = 0
|
||||
# Fetch All Invoices
|
||||
invoices = frappe.get_list(doctype,
|
||||
invoices = frappe.get_all(doctype,
|
||||
filters ={
|
||||
'docstatus': 1,
|
||||
'posting_date': ['between', [from_date, to_date]]
|
||||
}, fields =['name', 'is_return'])
|
||||
|
||||
for invoice in invoices:
|
||||
invoice_items = frappe.get_list(f'{doctype} Item',
|
||||
invoice_items = frappe.get_all(f'{doctype} Item',
|
||||
filters ={
|
||||
'docstatus': 1,
|
||||
'parent': invoice.name,
|
||||
|
@ -5,13 +5,12 @@ import frappe
|
||||
from frappe.permissions import add_permission, update_permission_property
|
||||
from erpnext.regional.united_arab_emirates.setup import make_custom_fields as uae_custom_fields, add_print_formats
|
||||
from erpnext.regional.saudi_arabia.wizard.operations.setup_ksa_vat_setting import create_ksa_vat_setting
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||
|
||||
def setup(company=None, patch=True):
|
||||
uae_custom_fields()
|
||||
add_print_formats()
|
||||
add_permissions()
|
||||
create_ksa_vat_setting(company)
|
||||
make_custom_fields()
|
||||
|
||||
def add_permissions():
|
||||
@ -31,28 +30,34 @@ def make_custom_fields():
|
||||
- Company Name in Arabic
|
||||
- Address in Arabic
|
||||
"""
|
||||
qr_code = dict(
|
||||
fieldname='qr_code',
|
||||
label='QR Code',
|
||||
fieldtype='Attach Image',
|
||||
read_only=1, no_copy=1, hidden=1)
|
||||
custom_fields = {
|
||||
'Sales Invoice': [
|
||||
dict(
|
||||
fieldname='qr_code',
|
||||
label='QR Code',
|
||||
fieldtype='Attach Image',
|
||||
read_only=1, no_copy=1, hidden=1
|
||||
)
|
||||
],
|
||||
'Address': [
|
||||
dict(
|
||||
fieldname='address_in_arabic',
|
||||
label='Address in Arabic',
|
||||
fieldtype='Data',
|
||||
insert_after='address_line2'
|
||||
)
|
||||
],
|
||||
'Company': [
|
||||
dict(
|
||||
fieldname='company_name_in_arabic',
|
||||
label='Company Name In Arabic',
|
||||
fieldtype='Data',
|
||||
insert_after='company_name'
|
||||
)
|
||||
]
|
||||
}
|
||||
|
||||
create_custom_field('Sales Invoice', qr_code)
|
||||
create_custom_fields(custom_fields, update=True)
|
||||
|
||||
company_name_in_arabic = dict(
|
||||
fieldname='company_name_in_arabic',
|
||||
label='Company Name In Arabic',
|
||||
fieldtype='Data',
|
||||
insert_after='company_name'
|
||||
)
|
||||
|
||||
create_custom_field('Company', company_name_in_arabic)
|
||||
|
||||
address_in_arabic = dict(
|
||||
fieldname='address_in_arabic',
|
||||
label='Address in Arabic',
|
||||
fieldtype='Data',
|
||||
insert_after='address_line2'
|
||||
)
|
||||
|
||||
create_custom_field('Address', address_in_arabic)
|
||||
def update_regional_tax_settings(country, company):
|
||||
create_ksa_vat_setting(company)
|
||||
|
@ -15,7 +15,7 @@
|
||||
{
|
||||
"title": "Exempted sales",
|
||||
"item_tax_template": "KSA VAT Exempted",
|
||||
"account": "VAT Zero"
|
||||
"account": "VAT Exempted"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -40,7 +40,7 @@
|
||||
{
|
||||
"title": "Exempted purchases",
|
||||
"item_tax_template": "KSA VAT Exempted",
|
||||
"account": "VAT Zero"
|
||||
"account": "VAT Exempted"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -3,14 +3,11 @@ import os
|
||||
|
||||
import frappe
|
||||
|
||||
from erpnext.setup.setup_wizard.operations.taxes_setup import setup_taxes_and_charges
|
||||
|
||||
|
||||
def create_ksa_vat_setting(company):
|
||||
"""On creation of first company. Creates KSA VAT Setting"""
|
||||
|
||||
company = frappe.get_doc('Company', company)
|
||||
setup_taxes_and_charges(company.name, company.country)
|
||||
|
||||
file_path = os.path.join(os.path.dirname(__file__), '..', 'data', 'ksa_vat_settings.json')
|
||||
with open(file_path, 'r') as json_file:
|
||||
|
@ -2120,6 +2120,10 @@
|
||||
"account_name": "VAT 15%",
|
||||
"tax_rate": 15.00
|
||||
},
|
||||
"KSA VAT 5%": {
|
||||
"account_name": "VAT 5%",
|
||||
"tax_rate": 5.00
|
||||
},
|
||||
"KSA VAT Zero": {
|
||||
"account_name": "VAT Zero",
|
||||
"tax_rate": 0.00
|
||||
|
Loading…
x
Reference in New Issue
Block a user