blob: ee25b38846e4ece6e781349286a41759836e7e2b [file] [log] [blame]
rohitwaghchaure4e17fae2017-12-12 14:40:52 +05301# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
2# License: GNU General Public License v3. See license.txt
3
Ahmadcb0c2d12021-08-26 07:35:59 +05004import frappe
5from frappe.permissions import add_permission, update_permission_property
Ahmad87380d02021-09-06 23:36:55 +05006from erpnext.regional.united_arab_emirates.setup import make_custom_fields as uae_custom_fields, add_print_formats
Ahmadcb0c2d12021-08-26 07:35:59 +05007from erpnext.regional.saudi_arabia.wizard.operations.setup_ksa_vat_setting import create_ksa_vat_setting
Ahmad87380d02021-09-06 23:36:55 +05008from frappe.custom.doctype.custom_field.custom_field import create_custom_field
rohitwaghchaure4e17fae2017-12-12 14:40:52 +05309
10def setup(company=None, patch=True):
Ahmad87380d02021-09-06 23:36:55 +050011 uae_custom_fields()
rohitwaghchaure4e17fae2017-12-12 14:40:52 +053012 add_print_formats()
Ahmadcb0c2d12021-08-26 07:35:59 +050013 add_permissions()
14 create_ksa_vat_setting(company)
Ahmad09507132021-09-14 14:29:33 +050015 make_qrcode_field()
Ahmadcb0c2d12021-08-26 07:35:59 +050016
17def add_permissions():
18 """Add Permissions for KSA VAT Setting."""
19 add_permission('KSA VAT Setting', 'All', 0)
20 for role in ('Accounts Manager', 'Accounts User', 'System Manager'):
21 add_permission('KSA VAT Setting', role, 0)
22 update_permission_property('KSA VAT Setting', role, 0, 'write', 1)
23 update_permission_property('KSA VAT Setting', role, 0, 'create', 1)
24
25 """Enable KSA VAT Report"""
26 frappe.db.set_value('Report', 'KSA VAT', 'disabled', 0)
Ahmad87380d02021-09-06 23:36:55 +050027
Ahmadde010662021-09-14 14:29:45 +050028def make_qrcode_field():
Ahmad9dae36b2021-09-17 01:51:32 +050029 """Created QR code Image file"""
Ahmad87380d02021-09-06 23:36:55 +050030 qr_code_field = dict(
Ahmad9dae36b2021-09-17 01:51:32 +050031 fieldname='qr_code',
32 label='QR Code',
33 fieldtype='Attach Image',
Ahmad87380d02021-09-06 23:36:55 +050034 read_only=1, no_copy=1, hidden=1)
Ahmad9dae36b2021-09-17 01:51:32 +050035
Ahmad87380d02021-09-06 23:36:55 +050036 create_custom_field('Sales Invoice', qr_code_field)