Error confirm invoice - frappe.render_template(‘erpnext/regional/italy/e-invoice.xml’

hi,
i have a problem when confirm the sales invoice.

this is the error of frappe log:

Request Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 61, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1030, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 19, in savedocs
doc.submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 848, in submit
self._submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 837, in _submit
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 313, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 908, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1033, in runner
add_to_return_value(self, f(self, method, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/italy/utils.py”, line 275, in sales_invoice_on_submit
prepare_and_attach_invoice(doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/italy/utils.py”, line 281, in prepare_and_attach_invoice
invoice_xml = frappe.render_template(‘erpnext/regional/italy/e-invoice.xml’, context={“doc”: invoice}, is_path=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 72, in render_template
return get_jenv().get_template(template).render(context)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/./regional/italy/e-invoice.xml”, line 202, in top-level template code
{{ doc.vat_collectability.split(“-”)[0] }}
UndefinedError: ‘None’ has no attribute ‘split’
[ERROR] 2019-04-06 09:21:06,234 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py:
New Exception collected with id: 2019-04-06 09:21:06.208024-192.168.1.6-fcc
[ERROR] 2019-04-06 09:27:08,483 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py:
New Exception collected with id: 2019-04-06 09:27:08.449483-192.168.1.6-e17
[ERROR] 2019-04-06 09:58:22,544 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py:
New Exception collected with id: 2019-04-06 09:58:22.386166-192.168.1.6-131

any help? thanks for all help

Similar error here, after invoice confimation:

something related to doc.vat_collectability.split - EsigibilitaIVA

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 19, in savedocs
doc.submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 848, in submit
self._submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 837, in _submit
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 313, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 908, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1033, in runner
add_to_return_value(self, f(self, method, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/italy/utils.py”, line 275, in sales_invoice_on_submit
prepare_and_attach_invoice(doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/italy/utils.py”, line 281, in prepare_and_attach_invoice
invoice_xml = frappe.render_template(‘erpnext/regional/italy/e-invoice.xml’, context={“doc”: invoice}, is_path=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 72, in render_template
return get_jenv().get_template(template).render(context)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/./regional/italy/e-invoice.xml”, line 202, in top-level template code
{{ doc.vat_collectability.split(“-”)[0] }}
UndefinedError: ‘None’ has no attribute ‘split’

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 61, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1026, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 19, in savedocs
doc.submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 848, in submit
self._submit()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 837, in _submit
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 313, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 908, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1048, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1033, in runner
add_to_return_value(self, f(self, method, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/italy/utils.py”, line 275, in sales_invoice_on_submit
prepare_and_attach_invoice(doc)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/italy/utils.py”, line 281, in prepare_and_attach_invoice
invoice_xml = frappe.render_template(‘erpnext/regional/italy/e-invoice.xml’, context={“doc”: invoice}, is_path=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 72, in render_template
return get_jenv().get_template(template).render(context)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/./regional/italy/e-invoice.xml”, line 202, in top-level template code
EsigibilitaIVA>{{ doc.vat_collectability.split(“-”)[0] }}
UndefinedError: ‘None’ has no attribute ‘split’

Thanks

This looks like a lead feat(regional): Italian Localization and E-Invoicing export by gaurav-naik · Pull Request #16598 · frappe/erpnext · GitHub

Thank you very much for the indication.
To be more precise, my problem is created in the draft saving phase. when I safe the selection of VAT Collectability from the drop down menù become blank.

Before

After saving

I believe that this is the cause of the error…

I found a workaround a little rough. Checking the structure of the invoice

I Found the Fetch From
company.vat_collectability

if the fetch declaration is removed the procedure ends and the invoice is created correctly.
I believe that it is not declared … but I don’t know where to go to set it - Help! :frowning: