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 | |
| 4 | from __future__ import unicode_literals |
| 5 | |
| 6 | import frappe |
| 7 | from frappe.custom.doctype.custom_field.custom_field import create_custom_fields |
| 8 | |
| 9 | def setup(company=None, patch=True): |
| 10 | make_custom_fields() |
| 11 | add_custom_roles_for_reports() |
| 12 | |
| 13 | def make_custom_fields(): |
| 14 | custom_fields = { |
| 15 | 'Company': [ |
| 16 | dict(fieldname='siren_number', label='SIREN Number', |
| 17 | fieldtype='Data', insert_after='website') |
| 18 | ] |
| 19 | } |
| 20 | |
| 21 | create_custom_fields(custom_fields) |
| 22 | |
| 23 | def add_custom_roles_for_reports(): |
| 24 | report_name = 'Fichier des Ecritures Comptables [FEC]' |
| 25 | |
| 26 | if not frappe.db.get_value('Custom Role', dict(report=report_name)): |
| 27 | frappe.get_doc(dict( |
| 28 | doctype='Custom Role', |
| 29 | report=report_name, |
| 30 | roles= [ |
| 31 | dict(role='Accounts Manager') |
| 32 | ] |
| 33 | )).insert() |