blob: 6113f48d3f155d4a182d7b1e41d9f21c648db40a [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
4from __future__ import unicode_literals
Ahmadcb0c2d12021-08-26 07:35:59 +05005import frappe
6from frappe.permissions import add_permission, update_permission_property
Ahmad87380d02021-09-06 23:36:55 +05007from erpnext.regional.united_arab_emirates.setup import make_custom_fields as uae_custom_fields, add_print_formats
Ahmadcb0c2d12021-08-26 07:35:59 +05008from erpnext.regional.saudi_arabia.wizard.operations.setup_ksa_vat_setting import create_ksa_vat_setting
Ahmad87380d02021-09-06 23:36:55 +05009from frappe.custom.doctype.custom_field.custom_field import create_custom_field
rohitwaghchaure4e17fae2017-12-12 14:40:52 +053010
11def setup(company=None, patch=True):
Ahmad87380d02021-09-06 23:36:55 +050012 uae_custom_fields()
rohitwaghchaure4e17fae2017-12-12 14:40:52 +053013 add_print_formats()
Ahmadcb0c2d12021-08-26 07:35:59 +050014 add_permissions()
15 create_ksa_vat_setting(company)
Ahmad09507132021-09-14 14:29:33 +050016 make_qrcode_field()
Ahmadcb0c2d12021-08-26 07:35:59 +050017
18def add_permissions():
19 """Add Permissions for KSA VAT Setting."""
20 add_permission('KSA VAT Setting', 'All', 0)
21 for role in ('Accounts Manager', 'Accounts User', 'System Manager'):
22 add_permission('KSA VAT Setting', role, 0)
23 update_permission_property('KSA VAT Setting', role, 0, 'write', 1)
24 update_permission_property('KSA VAT Setting', role, 0, 'create', 1)
25
26 """Enable KSA VAT Report"""
27 frappe.db.set_value('Report', 'KSA VAT', 'disabled', 0)
Ahmad87380d02021-09-06 23:36:55 +050028
Ahmadde010662021-09-14 14:29:45 +050029def make_qrcode_field():
Ahmad9dae36b2021-09-17 01:51:32 +050030 """Created QR code Image file"""
Ahmad87380d02021-09-06 23:36:55 +050031 qr_code_field = dict(
Ahmad9dae36b2021-09-17 01:51:32 +050032 fieldname='qr_code',
33 label='QR Code',
34 fieldtype='Attach Image',
Ahmad87380d02021-09-06 23:36:55 +050035 read_only=1, no_copy=1, hidden=1)
Ahmad9dae36b2021-09-17 01:51:32 +050036
Ahmad87380d02021-09-06 23:36:55 +050037 create_custom_field('Sales Invoice', qr_code_field)