mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 05:09:11 +00:00
fix: except einvoice loading error seperately
This commit is contained in:
@@ -465,19 +465,22 @@ def make_einvoice(invoice):
|
|||||||
try:
|
try:
|
||||||
einvoice = safe_json_load(einvoice)
|
einvoice = safe_json_load(einvoice)
|
||||||
einvoice = santize_einvoice_fields(einvoice)
|
einvoice = santize_einvoice_fields(einvoice)
|
||||||
|
except Exception:
|
||||||
|
show_link_to_error_log(invoice, einvoice)
|
||||||
|
|
||||||
validate_totals(einvoice)
|
validate_totals(einvoice)
|
||||||
|
|
||||||
except Exception:
|
return einvoice
|
||||||
log_error(einvoice)
|
|
||||||
link_to_error_list = '<a href="List/Error Log/List?method=E Invoice Request Failed">Error Log</a>'
|
def show_link_to_error_log(invoice, einvoice):
|
||||||
|
err_log = log_error(einvoice)
|
||||||
|
link_to_error_log = get_link_to_form('Error Log', err_log.name, 'Error Log')
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_('An error occurred while creating e-invoice for {}. Please check {} for more information.').format(
|
_('An error occurred while creating e-invoice for {}. Please check {} for more information.').format(
|
||||||
invoice.name, link_to_error_list),
|
invoice.name, link_to_error_log),
|
||||||
title=_('E Invoice Creation Failed')
|
title=_('E Invoice Creation Failed')
|
||||||
)
|
)
|
||||||
|
|
||||||
return einvoice
|
|
||||||
|
|
||||||
def log_error(data=None):
|
def log_error(data=None):
|
||||||
if isinstance(data, six.string_types):
|
if isinstance(data, six.string_types):
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user