Skip to content

Commit

Permalink
Merge pull request #29175 from rtdany10/patch-14
Browse files Browse the repository at this point in the history
fix: seperate custom field creation for KSA
  • Loading branch information
deepeshgarg007 authored Jan 15, 2022
2 parents 2b681f0 + 2e5f22a commit 3438e1f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 29 deletions.
2 changes: 1 addition & 1 deletion erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ erpnext.patches.v14_0.delete_healthcare_doctypes
erpnext.patches.v13_0.update_category_in_ltds_certificate
erpnext.patches.v13_0.create_pan_field_for_india #2
erpnext.patches.v14_0.delete_hub_doctypes
erpnext.patches.v13_0.create_ksa_vat_custom_fields
erpnext.patches.v13_0.create_ksa_vat_custom_fields # 07-01-2022
erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents
erpnext.patches.v14_0.migrate_crm_settings
erpnext.patches.v13_0.rename_ksa_qr_field
Expand Down
83 changes: 55 additions & 28 deletions erpnext/regional/saudi_arabia/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

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
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_fields

def setup(company=None, patch=True):
uae_custom_fields()
add_print_formats()
add_permissions()
make_custom_fields()
Expand Down Expand Up @@ -40,38 +38,67 @@ def make_custom_fields():
- Company Name in Arabic
- Address in Arabic
"""
is_zero_rated = dict(fieldname='is_zero_rated', label='Is Zero Rated',
fieldtype='Check', fetch_from='item_code.is_zero_rated', insert_after='description',
print_hide=1)

is_exempt = dict(fieldname='is_exempt', label='Is Exempt',
fieldtype='Check', fetch_from='item_code.is_exempt', insert_after='is_zero_rated',
print_hide=1)

purchase_invoice_fields = [
dict(fieldname='company_trn', label='Company TRN',
fieldtype='Read Only', insert_after='shipping_address',
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)
]

sales_invoice_fields = [
dict(fieldname='company_trn', label='Company TRN',
fieldtype='Read Only', insert_after='company_address',
fetch_from='company.tax_id', print_hide=1),
dict(fieldname='customer_name_in_arabic', label='Customer Name in Arabic',
fieldtype='Read Only', insert_after='customer_name',
fetch_from='customer.customer_name_in_arabic', print_hide=1),
dict(fieldname='ksa_einv_qr', label='KSA E-Invoicing QR',
fieldtype='Attach Image', read_only=1, no_copy=1, hidden=1)
]

custom_fields = {
'Sales Invoice': [
dict(
fieldname='ksa_einv_qr',
label='KSA E-Invoicing QR',
fieldtype='Attach Image',
read_only=1, no_copy=1, hidden=1
)
'Item': [is_zero_rated, is_exempt],
'Customer': [
dict(fieldname='customer_name_in_arabic', label='Customer Name in Arabic',
fieldtype='Data', insert_after='customer_name'),
],
'POS Invoice': [
dict(
fieldname='ksa_einv_qr',
label='KSA E-Invoicing QR',
fieldtype='Attach Image',
read_only=1, no_copy=1, hidden=1
)
'Supplier': [
dict(fieldname='supplier_name_in_arabic', label='Supplier Name in Arabic',
fieldtype='Data', insert_after='supplier_name'),
],
'Purchase Invoice': purchase_invoice_fields,
'Purchase Order': purchase_invoice_fields,
'Purchase Receipt': purchase_invoice_fields,
'Sales Invoice': sales_invoice_fields,
'POS Invoice': sales_invoice_fields,
'Sales Order': sales_invoice_fields,
'Delivery Note': sales_invoice_fields,
'Sales Invoice Item': [is_zero_rated, is_exempt],
'POS Invoice Item': [is_zero_rated, is_exempt],
'Purchase Invoice Item': [is_zero_rated, is_exempt],
'Sales Order Item': [is_zero_rated, is_exempt],
'Delivery Note Item': [is_zero_rated, is_exempt],
'Quotation Item': [is_zero_rated, is_exempt],
'Purchase Order Item': [is_zero_rated, is_exempt],
'Purchase Receipt Item': [is_zero_rated, is_exempt],
'Supplier Quotation Item': [is_zero_rated, is_exempt],
'Address': [
dict(
fieldname='address_in_arabic',
label='Address in Arabic',
fieldtype='Data',
insert_after='address_line2'
)
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'
)
dict(fieldname='company_name_in_arabic', label='Company Name In Arabic',
fieldtype='Data', insert_after='company_name')
]
}

Expand Down

0 comments on commit 3438e1f

Please sign in to comment.