├── requirements.txt ├── license.txt ├── erpnext_fattura_elettronica ├── patches.txt ├── config │ ├── __init__.py │ ├── desktop.py │ └── docs.py ├── templates │ ├── __init__.py │ └── pages │ │ └── __init__.py ├── erpnext_fattura_elettronica │ └── __init__.py ├── modules.txt ├── __init__.py └── hooks.py ├── .gitignore ├── MANIFEST.in ├── setup.py └── README.md /requirements.txt: -------------------------------------------------------------------------------- 1 | frappe -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | License: GPLv3 -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/patches.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/config/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/templates/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/templates/pages/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/erpnext_fattura_elettronica/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/modules.txt: -------------------------------------------------------------------------------- 1 | Erpnext Fattura Elettronica -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.pyc 3 | *.egg-info 4 | *.swp 5 | tags 6 | erpnext_fattura_elettronica/docs/current -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | __version__ = '0.0.1' 5 | 6 | -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/config/desktop.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | from frappe import _ 4 | 5 | def get_data(): 6 | return [ 7 | { 8 | "module_name": "Erpnext Fattura Elettronica", 9 | "color": "yellow", 10 | "icon": "fa file-text", 11 | "type": "module", 12 | "label": _("Erpnext Fattura Elettronica") 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/config/docs.py: -------------------------------------------------------------------------------- 1 | """ 2 | Configuration for docs 3 | """ 4 | 5 | # source_link = "https://github.com/[org_name]/erpnext_fattura_elettronica" 6 | # docs_base_url = "https://[org_name].github.io/erpnext_fattura_elettronica" 7 | # headline = "App that does everything" 8 | # sub_heading = "Yes, you got that right the first time, everything" 9 | 10 | def get_context(context): 11 | context.brand_html = "Erpnext Fattura Elettronica" 12 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include MANIFEST.in 2 | include requirements.txt 3 | include *.json 4 | include *.md 5 | include *.py 6 | include *.txt 7 | recursive-include erpnext_fattura_elettronica *.css 8 | recursive-include erpnext_fattura_elettronica *.csv 9 | recursive-include erpnext_fattura_elettronica *.html 10 | recursive-include erpnext_fattura_elettronica *.ico 11 | recursive-include erpnext_fattura_elettronica *.js 12 | recursive-include erpnext_fattura_elettronica *.json 13 | recursive-include erpnext_fattura_elettronica *.md 14 | recursive-include erpnext_fattura_elettronica *.png 15 | recursive-include erpnext_fattura_elettronica *.py 16 | recursive-include erpnext_fattura_elettronica *.svg 17 | recursive-include erpnext_fattura_elettronica *.txt 18 | recursive-exclude erpnext_fattura_elettronica *.pyc -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from setuptools import setup, find_packages 3 | import re, ast 4 | 5 | with open('requirements.txt') as f: 6 | install_requires = f.read().strip().split('\n') 7 | 8 | # get version from __version__ variable in erpnext_fattura_elettronica/__init__.py 9 | _version_re = re.compile(r'__version__\s+=\s+(.*)') 10 | 11 | with open('erpnext_fattura_elettronica/__init__.py', 'rb') as f: 12 | version = str(ast.literal_eval(_version_re.search( 13 | f.read().decode('utf-8')).group(1))) 14 | 15 | setup( 16 | name='erpnext_fattura_elettronica', 17 | version=version, 18 | description='App to export electronic invoice as mandated by the Italian Government', 19 | author='Massimiliano Corvino', 20 | author_email='massimiliano.corvino@gmail.com', 21 | packages=find_packages(), 22 | zip_safe=False, 23 | include_package_data=True, 24 | install_requires=install_requires 25 | ) 26 | -------------------------------------------------------------------------------- /erpnext_fattura_elettronica/hooks.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | from . import __version__ as app_version 4 | 5 | app_name = "erpnext_fattura_elettronica" 6 | app_title = "Erpnext Fattura Elettronica" 7 | app_publisher = "Massimiliano Corvino" 8 | app_description = "App to export electronic invoice as mandated by the Italian Government" 9 | app_icon = "fa file-text" 10 | app_color = "yellow" 11 | app_email = "massimiliano.corvino@gmail.com" 12 | app_license = "GPLv3" 13 | 14 | # Includes in 15 | # ------------------ 16 | 17 | # include js, css files in header of desk.html 18 | # app_include_css = "/assets/erpnext_fattura_elettronica/css/erpnext_fattura_elettronica.css" 19 | # app_include_js = "/assets/erpnext_fattura_elettronica/js/erpnext_fattura_elettronica.js" 20 | 21 | # include js, css files in header of web template 22 | # web_include_css = "/assets/erpnext_fattura_elettronica/css/erpnext_fattura_elettronica.css" 23 | # web_include_js = "/assets/erpnext_fattura_elettronica/js/erpnext_fattura_elettronica.js" 24 | 25 | # include js in page 26 | # page_js = {"page" : "public/js/file.js"} 27 | 28 | # include js in doctype views 29 | # doctype_js = {"doctype" : "public/js/doctype.js"} 30 | # doctype_list_js = {"doctype" : "public/js/doctype_list.js"} 31 | # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} 32 | # doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"} 33 | 34 | # Home Pages 35 | # ---------- 36 | 37 | # application home page (will override Website Settings) 38 | # home_page = "login" 39 | 40 | # website user home page (by Role) 41 | # role_home_page = { 42 | # "Role": "home_page" 43 | # } 44 | 45 | # Website user home page (by function) 46 | # get_website_user_home_page = "erpnext_fattura_elettronica.utils.get_home_page" 47 | 48 | # Generators 49 | # ---------- 50 | 51 | # automatically create page for each record of this doctype 52 | # website_generators = ["Web Page"] 53 | 54 | # Installation 55 | # ------------ 56 | 57 | # before_install = "erpnext_fattura_elettronica.install.before_install" 58 | # after_install = "erpnext_fattura_elettronica.install.after_install" 59 | 60 | # Desk Notifications 61 | # ------------------ 62 | # See frappe.core.notifications.get_notification_config 63 | 64 | # notification_config = "erpnext_fattura_elettronica.notifications.get_notification_config" 65 | 66 | # Permissions 67 | # ----------- 68 | # Permissions evaluated in scripted ways 69 | 70 | # permission_query_conditions = { 71 | # "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", 72 | # } 73 | # 74 | # has_permission = { 75 | # "Event": "frappe.desk.doctype.event.event.has_permission", 76 | # } 77 | 78 | # Document Events 79 | # --------------- 80 | # Hook on document methods and events 81 | 82 | # doc_events = { 83 | # "*": { 84 | # "on_update": "method", 85 | # "on_cancel": "method", 86 | # "on_trash": "method" 87 | # } 88 | # } 89 | 90 | # Scheduled Tasks 91 | # --------------- 92 | 93 | # scheduler_events = { 94 | # "all": [ 95 | # "erpnext_fattura_elettronica.tasks.all" 96 | # ], 97 | # "daily": [ 98 | # "erpnext_fattura_elettronica.tasks.daily" 99 | # ], 100 | # "hourly": [ 101 | # "erpnext_fattura_elettronica.tasks.hourly" 102 | # ], 103 | # "weekly": [ 104 | # "erpnext_fattura_elettronica.tasks.weekly" 105 | # ] 106 | # "monthly": [ 107 | # "erpnext_fattura_elettronica.tasks.monthly" 108 | # ] 109 | # } 110 | 111 | # Testing 112 | # ------- 113 | 114 | # before_tests = "erpnext_fattura_elettronica.install.before_tests" 115 | 116 | # Overriding Whitelisted Methods 117 | # ------------------------------ 118 | # 119 | # override_whitelisted_methods = { 120 | # "frappe.desk.doctype.event.event.get_events": "erpnext_fattura_elettronica.event.get_events" 121 | # } 122 | 123 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## This Custom App works only with ERPNext v10. 2 | ## Part of the code of this app was included in ERPNext V11. To use the updated version, please refer to ERPNext Project: https://github.com/frappe/erpnext 3 | 4 | ## ERPNext Fattura Elettronica ver. 0.0.1 5 | 6 | App to export electronic invoices as mandated by the Italian Government 7 | 8 | #### License 9 | 10 | GPLv3 11 | 12 | Reference (document issued by Italian Government): 13 | https://www.agenziaentrate.gov.it/wps/wcm/connect/a8316033-6124-4667-99d8-ed143dc72c20/Provvedimento_30042018+.pdf?MOD=AJPERES&CACHEID=a8316033-6124-4667-99d8-ed143dc72c20 14 | 15 | http://www.fatturapa.gov.it/export/fatturazione/sdi/Specifiche_tecniche_del_formato_FatturaPA_v1.2.1.pdf 16 | 17 | ## Requirements 18 | 19 | At scheduled time the system can generate email alerts about the documents that must be exported. The user can manage the schelude choose between (1 hour, 2 hour, or a fixed time of the day). 20 | 21 | The user will manage the export process using a new doctype: "EFE XML Export" 22 | In this doctype the user will be able to select a period and after then can select the Documents to export 23 | The system will generate an XML file for every Customer; 24 | 25 | The XML file will be complaint to: 26 | http://www.fatturapa.gov.it/export/fatturazione/it/normativa/f-2.htm 27 | and will be tested here: 28 | http://sdi.fatturapa.gov.it/SdI2FatturaPAWeb/AccediAlServizioAction.do?pagina=controlla_fattura 29 | 30 | These files can be used to send electronic invoices to SDI using a service like this: 31 | https://guide.pec.it/fatturazione-elettronica/menu-carica-fattura/upload-fatture-in-formato-xml.aspx 32 | 33 | This software is a Frappe Custom App but will be part of the Italian Localization 34 | 35 | ## Setup 36 | 37 | - bench new-site SITENAME --install-app erpnext 38 | - bench get-app --branch develop https://github.com/mascor/erpnext_fattura_elettronica.git 39 | - bench --site SITENAME install-app erpnext_fattura_elettronica 40 | 41 | ##### Company Setup: 42 | 43 | - Set Tax ID (Partita IVA) 44 | - Set Regime Fiscale 45 | - Set Company Address (Address Line 1, City/ Town, State (Provincia), Pincode (CAP)) 46 | 47 | ##### Chart of accounts Setup: 48 | 49 | If you need to use other kind of taxes, different from 22%, you can add it on the Item Master -> Item Tax. If you set to 0% it will ask to you the Natura. 50 | 51 | ##### Customers Setup: 52 | 53 | - Codice Destinatario (by default 0000000) 54 | - if Codice Destinario is 0000000, PEC Destinatario is mandatory 55 | - Tax ID (Partita IVA) 56 | - Set Customer Address (Address Line 1, City/ Town, State (Provincia), Pincode (CAP)) 57 | 58 | ##### Items Setup: 59 | 60 | - Create some Items, optionally setting the in the Item Tax section, a different Tax Account instead 22% 61 | 62 | ##### Sales Invoices Setup: 63 | 64 | - Customer 65 | - Insert some Items 66 | 67 | ##### EFE XML Export: 68 | 69 | - Type of Document 70 | - Company 71 | - From Date 72 | - To Date 73 | Export 74 | 75 | ## How to Test 76 | 77 | If you find an error or you're not able to validate your XML files, please open an Issue. 78 | In every Issue you should write these informations: 79 | - If is an ERPNext Exception, please explain the procedure you did step by step; 80 | - If is a validation error write the Validation Code and attach the XML File; 81 | - In every case attach screenshots errors or other screenshots could be useful for debug; 82 | 83 | ## ERPNext Customization 84 | 85 | Doctype updates: 86 | - Company 87 | - Customer Group 88 | - Customer 89 | - Sales Invoice 90 | 91 | New Doctypes: 92 | - EFE XML Export 93 | - Regime Fiscale 94 | - Tipo Documento 95 | - Natura 96 | 97 | ## Plan 98 | 99 | - Complete development before the second week of November (2018) 100 | - Complete test before the last week of November (2018) 101 | 102 | ## Implementation 103 | 104 | Reference: 105 | - http://www.fatturapa.gov.it/export/fatturazione/sdi/Specifiche_tecniche_del_formato_FatturaPA_v1.2.1.pdf 106 | - http://www.fatturapa.gov.it/export/fatturazione/sdi/fatturapa/v1.2.1/Rappresentazione_tabellare_del_tracciato_FatturaPA_versione_1.2.1.pdf 107 | --------------------------------------------------------------------------------