Raffael Meyer | ff878c0 | 2019-02-07 03:28:27 +0100 | [diff] [blame] | 1 | import frappe |
barredterra | 6b2e4f2 | 2021-04-07 20:03:59 +0200 | [diff] [blame] | 2 | from frappe.custom.doctype.custom_field.custom_field import create_custom_fields |
Raffael Meyer | ff878c0 | 2019-02-07 03:28:27 +0100 | [diff] [blame] | 3 | |
Raffael Meyer | 1f72b44 | 2019-01-27 23:32:41 +0100 | [diff] [blame] | 4 | |
| 5 | def setup(company=None, patch=True): |
barredterra | 6b2e4f2 | 2021-04-07 20:03:59 +0200 | [diff] [blame] | 6 | make_custom_fields() |
Nabin Hait | 10c6137 | 2021-04-13 15:46:01 +0530 | [diff] [blame] | 7 | add_custom_roles_for_reports() |
barredterra | 6b2e4f2 | 2021-04-07 20:03:59 +0200 | [diff] [blame] | 8 | |
| 9 | |
| 10 | def make_custom_fields(): |
| 11 | custom_fields = { |
| 12 | 'Party Account': [ |
| 13 | dict(fieldname='debtor_creditor_number', label='Debtor/Creditor Number', |
barredterra | 368a654 | 2021-04-08 16:26:56 +0200 | [diff] [blame] | 14 | fieldtype='Data', insert_after='account', translatable=0) |
barredterra | 6b2e4f2 | 2021-04-07 20:03:59 +0200 | [diff] [blame] | 15 | ] |
| 16 | } |
| 17 | |
| 18 | create_custom_fields(custom_fields) |
Raffael Meyer | 6daae68 | 2021-04-16 12:37:14 +0200 | [diff] [blame] | 19 | |
| 20 | |
Nabin Hait | 10c6137 | 2021-04-13 15:46:01 +0530 | [diff] [blame] | 21 | def add_custom_roles_for_reports(): |
| 22 | """Add Access Control to UAE VAT 201.""" |
| 23 | if not frappe.db.get_value('Custom Role', dict(report='DATEV')): |
| 24 | frappe.get_doc(dict( |
| 25 | doctype='Custom Role', |
| 26 | report='DATEV', |
| 27 | roles= [ |
| 28 | dict(role='Accounts User'), |
| 29 | dict(role='Accounts Manager') |
| 30 | ] |
Raffael Meyer | 6daae68 | 2021-04-16 12:37:14 +0200 | [diff] [blame] | 31 | )).insert() |