Charles-Henri Decultot | 90657fb | 2018-01-23 11:10:14 +0100 | [diff] [blame] | 1 | # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors |
| 2 | # License: GNU General Public License v3. See license.txt |
| 3 | |
Charles-Henri Decultot | 90657fb | 2018-01-23 11:10:14 +0100 | [diff] [blame] | 4 | |
| 5 | import frappe |
| 6 | from frappe.custom.doctype.custom_field.custom_field import create_custom_fields |
| 7 | |
| 8 | def setup(company=None, patch=True): |
| 9 | make_custom_fields() |
| 10 | add_custom_roles_for_reports() |
| 11 | |
| 12 | def make_custom_fields(): |
| 13 | custom_fields = { |
| 14 | 'Company': [ |
| 15 | dict(fieldname='siren_number', label='SIREN Number', |
| 16 | fieldtype='Data', insert_after='website') |
| 17 | ] |
| 18 | } |
| 19 | |
| 20 | create_custom_fields(custom_fields) |
| 21 | |
| 22 | def add_custom_roles_for_reports(): |
| 23 | report_name = 'Fichier des Ecritures Comptables [FEC]' |
| 24 | |
| 25 | if not frappe.db.get_value('Custom Role', dict(report=report_name)): |
| 26 | frappe.get_doc(dict( |
| 27 | doctype='Custom Role', |
| 28 | report=report_name, |
| 29 | roles= [ |
| 30 | dict(role='Accounts Manager') |
| 31 | ] |
| 32 | )).insert() |