rohitwaghchaure | 4e17fae | 2017-12-12 14:40:52 +0530 | [diff] [blame] | 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors |
| 2 | # License: GNU General Public License v3. See license.txt |
| 3 | |
Ahmad | cb0c2d1 | 2021-08-26 07:35:59 +0500 | [diff] [blame] | 4 | import frappe |
| 5 | from frappe.permissions import add_permission, update_permission_property |
Ahmad | 87380d0 | 2021-09-06 23:36:55 +0500 | [diff] [blame] | 6 | from erpnext.regional.united_arab_emirates.setup import make_custom_fields as uae_custom_fields, add_print_formats |
Ahmad | cb0c2d1 | 2021-08-26 07:35:59 +0500 | [diff] [blame] | 7 | from erpnext.regional.saudi_arabia.wizard.operations.setup_ksa_vat_setting import create_ksa_vat_setting |
Ahmad | 87380d0 | 2021-09-06 23:36:55 +0500 | [diff] [blame] | 8 | from frappe.custom.doctype.custom_field.custom_field import create_custom_field |
rohitwaghchaure | 4e17fae | 2017-12-12 14:40:52 +0530 | [diff] [blame] | 9 | |
| 10 | def setup(company=None, patch=True): |
Ahmad | 87380d0 | 2021-09-06 23:36:55 +0500 | [diff] [blame] | 11 | uae_custom_fields() |
rohitwaghchaure | 4e17fae | 2017-12-12 14:40:52 +0530 | [diff] [blame] | 12 | add_print_formats() |
Ahmad | cb0c2d1 | 2021-08-26 07:35:59 +0500 | [diff] [blame] | 13 | add_permissions() |
| 14 | create_ksa_vat_setting(company) |
Ahmad | 0950713 | 2021-09-14 14:29:33 +0500 | [diff] [blame] | 15 | make_qrcode_field() |
Ahmad | cb0c2d1 | 2021-08-26 07:35:59 +0500 | [diff] [blame] | 16 | |
| 17 | def 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) |
Ahmad | 87380d0 | 2021-09-06 23:36:55 +0500 | [diff] [blame] | 27 | |
Ahmad | de01066 | 2021-09-14 14:29:45 +0500 | [diff] [blame] | 28 | def make_qrcode_field(): |
Ahmad | 9dae36b | 2021-09-17 01:51:32 +0500 | [diff] [blame] | 29 | """Created QR code Image file""" |
Ahmad | 87380d0 | 2021-09-06 23:36:55 +0500 | [diff] [blame] | 30 | qr_code_field = dict( |
Ahmad | 9dae36b | 2021-09-17 01:51:32 +0500 | [diff] [blame] | 31 | fieldname='qr_code', |
| 32 | label='QR Code', |
| 33 | fieldtype='Attach Image', |
Ahmad | 87380d0 | 2021-09-06 23:36:55 +0500 | [diff] [blame] | 34 | read_only=1, no_copy=1, hidden=1) |
Ahmad | 9dae36b | 2021-09-17 01:51:32 +0500 | [diff] [blame] | 35 | |
Ahmad | 87380d0 | 2021-09-06 23:36:55 +0500 | [diff] [blame] | 36 | create_custom_field('Sales Invoice', qr_code_field) |