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

In process_check_run, serialize current transactions if null #260

Closed
agritheory opened this issue Jul 8, 2024 · 0 comments · Fixed by #261
Closed

In process_check_run, serialize current transactions if null #260

agritheory opened this issue Jul 8, 2024 · 0 comments · Fixed by #261
Assignees

Comments

@agritheory
Copy link
Owner

agritheory commented Jul 8, 2024

This happens when the configured settings for a Check Run allow it to be processed without any other changes.

There are a couple of events that lead to this error, and it would be better to address the root causes:

  • get_entries is called from the browser but frm is not marked as dirty at this point even though the data in transactions has changed
  • The document isn't aware that it cannot be processed because there are no transactions

To reproduce:
bench reinstall --yes --admin-password admin --mariadb-root-password admin && bench execute 'check_run.tests.setup.before_test'

Then start a new Check Run with the default company, account and bank account.
Then "Modify Settings" and check "Pre-Select Overdue Items" and "Automatically Release On Hold Invoices"
Return to the Check Run and click "Process Check Run"

Stack Trace ### App Versions ``` { "check_run": "14.11.5", "erpnext": "14.70.6", "frappe": "14.76.2", "hrms": "14.28.5" } ``` ### Route ``` Form/Check Run/ACC-CR-2024-00001 ``` ### Traceback ``` Traceback (most recent call last): File "apps/frappe/frappe/app.py", line 97, 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 48, in handle data = execute_cmd(cmd) File "apps/frappe/frappe/handler.py", line 86, in execute_cmd return frappe.call(method, **frappe.form_dict) File "apps/frappe/frappe/__init__.py", line 1619, in call return fn(*args, **newargs) File "apps/check_run/check_run/check_run/doctype/check_run/check_run.py", line 939, in process_check_run doc.process_check_run() File "apps/check_run/check_run/check_run/doctype/check_run/check_run.py", line 188, in process_check_run for t in json.loads(self.transactions) File "/home/tyler/.pyenv/versions/3.10.10/lib/python3.10/json/__init__.py", line 339, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not NoneType
### Request Data

{
"type": "POST",
"args": {
"docname": "ACC-CR-2024-00001"
},
"headers": {},
"error_handlers": {},
"url": "/api/method/check_run.check_run.doctype.check_run.check_run.process_check_run"
}

### Response Data

{
"exception": "TypeError: the JSON object must be str, bytes or bytearray, not NoneType"
}

</details>


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants