Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(india): error while parsing e-invoice #31053

Merged
merged 1 commit into from
May 18, 2022

Conversation

nextchamp-saqib
Copy link
Member

Traceback (most recent call last):
  File "apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 758, in safe_json_load
    return json.loads(json_string)
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 29 column 19 (char 746)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 649, in make_einvoice
    einvoice = safe_json_load(einvoice)
  File "apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 767, in safe_json_load
    ).format(snippet)
  File "apps/frappe/frappe/__init__.py", line 510, in throw
    as_list=as_list,
  File "apps/frappe/frappe/__init__.py", line 478, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 433, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Error in input data. Please check for any special characters near following input: 
 ,
        "LglNm": "	SMART ENGINEERING",

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 37, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 75, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1447, in call
    return fn(*args, **newargs)
  File "apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 1332, in get_einvoice
    return make_einvoice(invoice)
  File "apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 652, in make_einvoice
    show_link_to_error_log(invoice, einvoice)
  File "apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 664, in show_link_to_error_log
    err_log = log_error(einvoice)
  File "apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 676, in log_error
    data = json.loads(data)
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 29 column 19 (char 746)

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label May 17, 2022
@nextchamp-saqib nextchamp-saqib added backport version-13-hotfix and removed needs-tests This PR needs automated unit-tests. labels May 17, 2022
@codecov
Copy link

codecov bot commented May 17, 2022

Codecov Report

Merging #31053 (ccfc404) into develop (c05144f) will increase coverage by 0.05%.
The diff coverage is 14.28%.

@@             Coverage Diff             @@
##           develop   #31053      +/-   ##
===========================================
+ Coverage    63.01%   63.06%   +0.05%     
===========================================
  Files          983      985       +2     
  Lines        67062    67282     +220     
===========================================
+ Hits         42256    42434     +178     
- Misses       24806    24848      +42     
Impacted Files Coverage Δ
erpnext/regional/india/e_invoice/utils.py 40.31% <14.28%> (-1.70%) ⬇️
erpnext/accounts/doctype/bank/bank.py 71.42% <0.00%> (-14.29%) ⬇️
...urity_shortfall/process_loan_security_shortfall.py 93.75% <0.00%> (-6.25%) ⬇️
erpnext/hr/utils.py 73.10% <0.00%> (-4.63%) ⬇️
erpnext/accounts/party.py 78.09% <0.00%> (-4.33%) ⬇️
erpnext/crm/doctype/prospect/prospect.py 55.22% <0.00%> (-2.99%) ⬇️
...next/regional/doctype/gst_settings/gst_settings.py 34.93% <0.00%> (-2.94%) ⬇️
.../report/bom_operations_time/bom_operations_time.py 89.13% <0.00%> (-2.18%) ⬇️
erpnext/stock/doctype/bin/bin.py 96.22% <0.00%> (-1.78%) ⬇️
erpnext/portal/utils.py 27.69% <0.00%> (-1.54%) ⬇️
... and 49 more

@nextchamp-saqib nextchamp-saqib merged commit 9fb7b49 into frappe:develop May 18, 2022
mergify bot pushed a commit that referenced this pull request May 18, 2022
hrwX pushed a commit to hrwX/erpnext that referenced this pull request May 20, 2022
mergify bot pushed a commit that referenced this pull request Jun 3, 2022
(cherry picked from commit 9fb7b49)

# Conflicts:
#	erpnext/regional/india/e_invoice/utils.py
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant