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

Payment Entry assumes that there is always a purchase order linked to the Payment entry when withholding a Tax #41217

Closed
basant-in opened this issue Apr 27, 2024 · 1 comment
Labels

Comments

@basant-in
Copy link

Information about bug

This change assumes that there will always be a purchase order linked to Payment Entry when applying TDS. This breaks when there is none.

Module

accounts

Version

Frappe-version-13, ERPNext Version - 13.55

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

Since there is no PO linked to the payment, getting this exception in 
File "apps/erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py", line 675, in get_order_net_total
    tax_withholding_net_total = frappe.db.get_value(


:8000/api/method/frappe.desk.form.save.savedocs:1 
       Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR)
desk.min.js?ver=1713465470.0:sourcemap:4140 Syntax error in query:
desk.min.js?ver=1713465470.0:sourcemap:4140 select sum(base_net_total) from `tabPurchase Order` where `name` in () order by modified desc limit 1
desk.min.js?ver=1713465470.0:sourcemap:4140 Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 66, 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 38, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 76, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1474, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 25, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 312, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 334, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 263, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1059, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 943, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1267, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1249, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 940, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py", line 82, in validate
    self.set_tax_withholding()
  File "apps/erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py", line 620, in set_tax_withholding
    order_amount = self.get_order_net_total()
  File "apps/erpnext/erpnext/accounts/doctype/payment_entry/payment_entry.py", line 675, in get_order_net_total
    tax_withholding_net_total = frappe.db.get_value(
  File "apps/frappe/frappe/database/database.py", line 472, in get_value
    ret = self.get_values(
  File "apps/frappe/frappe/database/database.py", line 544, in get_values
    out = self._get_values_from_table(
  File "apps/frappe/frappe/database/database.py", line 739, in _get_values_from_table
    r = self.sql(
  File "apps/frappe/frappe/database/database.py", line 187, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.8/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "env/lib/python3.8/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.8/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.8/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') order by modified desc limit 1' at line 1")

:8000/api/method/frappe.desk.form.save.savedocs:1 
        
        
       Failed to load resource: net::ERR_NETWORK_IO_SUSPENDED
@basant-in basant-in added the bug label Apr 27, 2024
@Nihantra-Patel
Copy link
Contributor

We no longer provide support for version 13 or older.

Kindly upgrade to version 14 or 15, then refresh and check again because lots of bugs fixed in the new version.

If the issue occurs then please create a new issue according to the latest version (14 or 15) with a video document if possible.

Version EOL Branch
Version 12 End of 2022 version-12
Version 13 End of 2023 version-13
Version 14 End of 2024 (planned) version-14
Version 15 End of 2026 (planned) version-15
Bleeding edge N/A develop

For more information, please refer to the guidelines.

Thank You!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants