8848digital / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
0 stars 0 forks source link

Error in test_lower_deduction_certificate_application #550

Closed aartimanjare closed 2 days ago

aartimanjare commented 3 days ago

Information about bug

ERROR: test_lower_deduction_certificate_application (erpnext.accounts.doctype.tax_withholding_category.test_tax_withholding_category.TestTaxWithholdingCategory)

Module

accounts

Version

Frappe - v15 Erpnext -v15

Installation method

None

Relevant log output / Stack trace / Full Error Message.

bench run-tests --doctype "Tax Withholding Category" --test test_lower_deduction_certificate_application
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/aarti/postgres/frappe-bench-post/env/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/env/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/aarti/postgres/frappe-bench-post/env/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/aarti/postgres/frappe-bench-post/env/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/aarti/postgres/frappe-bench-post/env/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/aarti/postgres/frappe-bench-post/env/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/env/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/commands/utils.py", line 790, in run_tests
    ret = frappe.test_runner.main(
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/test_runner.py", line 88, in main
    ret = run_tests_for_doctype(
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/test_runner.py", line 214, in run_tests_for_doctype
    return _run_unittest(
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/test_runner.py", line 283, in _run_unittest
    out = runner.run(test_suite)
  File "/usr/lib/python3.10/unittest/runner.py", line 184, in run
    test(result)
  File "/usr/lib/python3.10/unittest/suite.py", line 84, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python3.10/unittest/suite.py", line 122, in run
    test(result)
  File "/usr/lib/python3.10/unittest/case.py", line 650, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python3.10/unittest/case.py", line 591, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.10/unittest/case.py", line 549, in _callTestMethod
    method()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py", line 478, in test_lower_deduction_certificate_application
    pi2 = create_purchase_invoice(supplier="Test LDC Supplier", rate=35000)
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py", line 668, in create_purchase_invoice
    pi.save()
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 359, in _save
    return self.insert()
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 291, in insert
    self.run_before_save_methods()
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods
    self.run_method("validate")
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 261, in validate
    super().validate()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/controllers/buying_controller.py", line 32, in validate
    super().validate()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/controllers/subcontracting_controller.py", line 56, in validate
    super().validate()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/controllers/stock_controller.py", line 52, in validate
    super().validate()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/controllers/accounts_controller.py", line 258, in validate
    self.set_tax_withholding()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 1719, in set_tax_withholding
    tax_withholding_details, advance_taxes, voucher_wise_amount = get_party_tax_withholding_details(
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 142, in get_party_tax_withholding_details
    tax_amount, tax_deducted, tax_deducted_on_advances, voucher_wise_amount = get_tax_amount(
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 309, in get_tax_amount
    limit_consumed = get_limit_consumed(ldc, parties)
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 653, in get_limit_consumed
    limit_consumed = frappe.db.get_value(
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/database.py", line 512, in get_value
    result = self.get_values(
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/database.py", line 616, in get_values
    out = self._get_values_from_table(
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/database.py", line 889, in _get_values_from_table
    return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/postgres/database.py", line 218, in sql
    return super().sql(modify_query(query), modify_values(values), *args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/database.py", line 249, in sql
    traceback.print_stack()
'Error in query:\ncolumn "tabPurchase Invoice.modified" must appear in the GROUP BY clause or be used in an aggregate function\nLINE 1: ...025-03-31\' AND "company"=\'_Test Company\' ORDER BY "modified"...\n                                                             ^\n'
E
======================================================================
ERROR: test_lower_deduction_certificate_application (erpnext.accounts.doctype.tax_withholding_category.test_tax_withholding_category.TestTaxWithholdingCategory)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py", line 478, in test_lower_deduction_certificate_application
    pi2 = create_purchase_invoice(supplier="Test LDC Supplier", rate=35000)
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py", line 668, in create_purchase_invoice
    pi.save()
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 359, in _save
    return self.insert()
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 291, in insert
    self.run_before_save_methods()
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods
    self.run_method("validate")
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 261, in validate
    super().validate()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/controllers/buying_controller.py", line 32, in validate
    super().validate()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/controllers/subcontracting_controller.py", line 56, in validate
    super().validate()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/controllers/stock_controller.py", line 52, in validate
    super().validate()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/controllers/accounts_controller.py", line 258, in validate
    self.set_tax_withholding()
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 1719, in set_tax_withholding
    tax_withholding_details, advance_taxes, voucher_wise_amount = get_party_tax_withholding_details(
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 142, in get_party_tax_withholding_details
    tax_amount, tax_deducted, tax_deducted_on_advances, voucher_wise_amount = get_tax_amount(
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 309, in get_tax_amount
    limit_consumed = get_limit_consumed(ldc, parties)
  File "/home/aarti/postgres/frappe-bench-post/apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 653, in get_limit_consumed
    limit_consumed = frappe.db.get_value(
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/database.py", line 512, in get_value
    result = self.get_values(
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/database.py", line 616, in get_values
    out = self._get_values_from_table(
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/database.py", line 889, in _get_values_from_table
    return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/postgres/database.py", line 218, in sql
    return super().sql(modify_query(query), modify_values(values), *args, **kwargs)
  File "/home/aarti/postgres/frappe-bench-post/apps/frappe/frappe/database/database.py", line 227, in sql
    self._cursor.execute(query, values)
psycopg2.errors.GroupingError: column "tabPurchase Invoice.modified" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ...025-03-31' AND "company"='_Test Company' ORDER BY "modified"...
                                                             ^

----------------------------------------------------------------------
Ran 1 test in 2.620s

FAILED (errors=1)
tinadn commented 2 days ago

Issue Resolved. Hence Closing.