2017-12-12 09:10:52 +00:00
|
|
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
2021-08-26 02:35:59 +00:00
|
|
|
import frappe
|
|
|
|
from frappe.permissions import add_permission, update_permission_property
|
2021-09-06 18:36:55 +00:00
|
|
|
from erpnext.regional.united_arab_emirates.setup import make_custom_fields as uae_custom_fields, add_print_formats
|
2021-08-26 02:35:59 +00:00
|
|
|
from erpnext.regional.saudi_arabia.wizard.operations.setup_ksa_vat_setting import create_ksa_vat_setting
|
2021-09-06 18:36:55 +00:00
|
|
|
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
2017-12-12 09:10:52 +00:00
|
|
|
|
|
|
|
def setup(company=None, patch=True):
|
2021-09-06 18:36:55 +00:00
|
|
|
uae_custom_fields()
|
2017-12-12 09:10:52 +00:00
|
|
|
add_print_formats()
|
2021-08-26 02:35:59 +00:00
|
|
|
add_permissions()
|
|
|
|
create_ksa_vat_setting(company)
|
2021-10-30 14:18:45 +00:00
|
|
|
make_custom_fields()
|
2021-08-26 02:35:59 +00:00
|
|
|
|
|
|
|
def add_permissions():
|
|
|
|
"""Add Permissions for KSA VAT Setting."""
|
|
|
|
add_permission('KSA VAT Setting', 'All', 0)
|
|
|
|
for role in ('Accounts Manager', 'Accounts User', 'System Manager'):
|
|
|
|
add_permission('KSA VAT Setting', role, 0)
|
|
|
|
update_permission_property('KSA VAT Setting', role, 0, 'write', 1)
|
|
|
|
update_permission_property('KSA VAT Setting', role, 0, 'create', 1)
|
|
|
|
|
|
|
|
"""Enable KSA VAT Report"""
|
|
|
|
frappe.db.set_value('Report', 'KSA VAT', 'disabled', 0)
|
2021-09-06 18:36:55 +00:00
|
|
|
|
2021-10-30 14:18:45 +00:00
|
|
|
def make_custom_fields():
|
|
|
|
"""Create Custom fields
|
|
|
|
- QR code Image file
|
|
|
|
- Company Name in Arabic
|
|
|
|
- Address in Arabic
|
|
|
|
"""
|
|
|
|
qr_code = dict(
|
2021-09-16 20:51:32 +00:00
|
|
|
fieldname='qr_code',
|
|
|
|
label='QR Code',
|
|
|
|
fieldtype='Attach Image',
|
2021-09-06 18:36:55 +00:00
|
|
|
read_only=1, no_copy=1, hidden=1)
|
2021-09-16 20:51:32 +00:00
|
|
|
|
2021-10-30 14:18:45 +00:00
|
|
|
create_custom_field('Sales Invoice', qr_code)
|
|
|
|
|
|
|
|
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)
|