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

patch error: india_compliance.patches.post_install.update_company_fixtures #3 #1928

Closed
1 task done
mohsinalimat opened this issue Mar 27, 2024 · 5 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@mohsinalimat
Copy link

Information about bug

frappe.exceptions.ValidationError: Account TDS Payable - XPL added multiple times

Version

Frappe Framework: v15.18.2
ERPNext: v15.17.6
India Compliance: v15.6.0

Relevant log output / Stack trace / Full Error Message.

Executing india_compliance.patches.post_install.update_company_fixtures #3 in abc.xyz.com (xyz)
Failed to execute patch
Traceback with variables (most recent call last):
  File "apps/frappe/frappe/modules/patch_handler.py", line 62, in run_patch
    if not run_single(patchmodule=patch):
      patch = 'india_compliance.patches.post_install.update_company_fixtures #3'
      skip_failing = True
  File "apps/frappe/frappe/modules/patch_handler.py", line 152, in run_single
    return execute_patch(patchmodule, method, methodargs)
      patchmodule = 'india_compliance.patches.post_install.update_company_fixtures #3'
      method = None
      methodargs = None
      force = False
      conf = {'background_workers': 1, 'dns_multitenant': True, 'file_watcher_port': 6789, 'frappe_user': 'frappe', 'gunicorn_workers': 5, 'live_reload': True, 'rebase_on_pull': False, 'redis_cache': 'redis://127.0.0.1:13002', 'redis_queue': 'redis://127.0.0.1:11002', 'redis_socketio': 'redis://127.0.0.1:13002', 'restart_supervisor_on_update': True, 'restart_systemd_on_update': False, 'serve_default_site': True, 'shallow_clone': True, 'socketio_port': 9002, 'use_redis_auth': False, 'webserver_port': 8002, 'db_name': 'xyz', 'db_password': '1234', 'db_type': 'mariadb', 'encryption_key': '1234', 'db_host': '127.0.0.1', 'db_port': '3306', 'developer_mode': 0}
  File "apps/frappe/frappe/modules/patch_handler.py", line 188, in execute_patch
    _patch()
      patchmodule = 'india_compliance.patches.post_install.update_company_fixtures #3'
      method = None
      methodargs = None
      has_patch_file = True
      patch = 'india_compliance.patches.post_install.update_company_fixtures.execute'
      docstring = ''
      _patch = <function execute at 0x7eff0a5792d0>
      start_time = 4406692.715371384
  File "apps/india_compliance/india_compliance/patches/post_install/update_company_fixtures.py", line 25, in execute
    create_income_tax_fixtures(company)
      company_list = ['XYZ PRIVATE LIMITED', 'XYZ PRIVATE LIMITED (DELHI)', 'XYZ PRIVATE LIMITED (MUMBAI)', 'XYZ PRIVATE LIMITED (KOLKATA)', 'XYZ PRIVATE LIMITED (ROORKEE)']
      company = 'XYZ PRIVATE LIMITED (DELHI)'
  File "apps/india_compliance/india_compliance/income_tax_india/overrides/company.py", line 19, in create_company_fixtures
    create_or_update_tax_withholding_category(company)
      company = 'XYZ PRIVATE LIMITED (DELHI)'
  File "apps/india_compliance/india_compliance/income_tax_india/overrides/company.py", line 54, in create_or_update_tax_withholding_category
    update_existing_tax_withholding_category(
      company = 'XYZ PRIVATE LIMITED (DELHI)'
      accounts = [{'company': 'XYZ PRIVATE LIMITED (DELHI)', 'account': 'TDS Payable - XPL-D', 'doctype': 'Tax Withholding Account'}]
      tds_account = 'TDS Payable - XPL-D'
      categories = [{'name': 'TDS - 194C - Company', 'category_name': 'Payment to Contractors (Single / Aggregate)', 'doctype': 'Tax Withholding Category', 'accounts': [{'company': 'XYZ PRIVATE LIMITED (DELHI)', 'account': 'TDS Payable - XPL-D', 'doctype': 'Tax Withholding Account'}], 'tds_section': '194C', 'entity_type': 'Company', 'round_off_tax_amount': 0, 'consider_party_ledger_amount': 0, 'tax_on_excess_amount': 0, 'rates': [{'from_date': '2023-04-01', 'to_date': '2024-04-01', 'tax_withholding_rate': 2, 'single_threshold': 30000, 'cumulative_threshold': 100000}, {'from_date': '2024-04-01', 'to_date': '2025-03-31', 'tax_withholding_rate': 2, 'single_threshold': 30000, 'cumulative_threshold': 100000}]}, {'name': 'TDS - 194C - Individual', 'category_name': 'Payment to Contractors (Single / Aggregate)', 'doctype': 'Tax Withholding Category', 'accounts': [{'company': 'XYZ PRIVATE LIMITED (DELHI)', 'account': 'TDS Payable - XPL-D', 'doctype': 'Tax Withholding Account'}], 'tds_section...
      category_doc = {'name': 'TDS - 194 - Company', 'category_name': 'Dividends', 'doctype': 'Tax Withholding Category', 'accounts': [{'company': 'XYZ PRIVATE LIMITED (DELHI)', 'account': 'TDS Payable - XPL-D', 'doctype': 'Tax Withholding Account'}], 'tds_section': '194', 'entity_type': 'Company', 'round_off_tax_amount': 0, 'consider_party_ledger_amount': 0, 'tax_on_excess_amount': 0, 'rates': [{'from_date': '2023-04-01', 'to_date': '2024-03-31', 'tax_withholding_rate': 10, 'single_threshold': 2500, 'cumulative_threshold': 0}, {'from_date': '2024-04-01', 'to_date': '2025-03-31', 'tax_withholding_rate': 10, 'single_threshold': 5000, 'cumulative_threshold': 0}]}
      existing_category_list = ['TDS - 194 - Dividends - Company', 'TDS - 194Q - Company']
      category_name = 'TDS - 194Q - Company'
  File "apps/india_compliance/india_compliance/income_tax_india/overrides/company.py", line 90, in update_existing_tax_withholding_category
    doc.save()
      category_doc = {'name': 'TDS - 194 - Company', 'category_name': 'Dividends', 'doctype': 'Tax Withholding Category', 'accounts': [{'company': 'XYZ PRIVATE LIMITED (DELHI)', 'account': 'TDS Payable - XPL-D', 'doctype': 'Tax Withholding Account'}], 'tds_section': '194', 'entity_type': 'Company', 'round_off_tax_amount': 0, 'consider_party_ledger_amount': 0, 'tax_on_excess_amount': 0, 'rates': [{'from_date': '2023-04-01', 'to_date': '2024-03-31', 'tax_withholding_rate': 10, 'single_threshold': 2500, 'cumulative_threshold': 0}, {'from_date': '2024-04-01', 'to_date': '2025-03-31', 'tax_withholding_rate': 10, 'single_threshold': 5000, 'cumulative_threshold': 0}]}
      category_name = 'TDS - 194Q - Company'
      company = 'XYZ PRIVATE LIMITED (DELHI)'
      doc = <TaxWithholdingCategory: TDS - 194Q - Company>
      row = <TaxWithholdingAccount: 62398dc37e parent=TDS - 194Q - Company>
      largest_date = datetime.date(2025, 3, 31)
      doc_row = <TaxWithholdingRate: c11dc96e10 parent=TDS - 194Q - Company>
      cat_row = {'from_date': '2024-04-01', 'to_date': '2025-03-31', 'tax_withholding_rate': 10, 'single_threshold': 5000, 'cumulative_threshold': 0}
  File "apps/frappe/frappe/model/document.py", line 335, in save
    return self._save(*args, **kwargs)
      self = <TaxWithholdingCategory: TDS - 194Q - Company>
      args = ()
      kwargs = {}
  File "apps/frappe/frappe/model/document.py", line 371, in _save
    self.run_before_save_methods()
      self = <TaxWithholdingCategory: TDS - 194Q - Company>
      ignore_permissions = None
      ignore_version = None
  File "apps/frappe/frappe/model/document.py", line 1089, in run_before_save_methods
    self.run_method("validate")
      self = <TaxWithholdingCategory: TDS - 194Q - Company>
  File "apps/frappe/frappe/model/document.py", line 960, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
      self = <TaxWithholdingCategory: TDS - 194Q - Company>
      args = ()
      kwargs = {}
      fn = <function Document.run_method.<locals>.fn at 0x7eff0a04eb90>
      method = 'validate'
  File "apps/frappe/frappe/model/document.py", line 1320, in composer
    return composed(self, method, *args, **kwargs)
      self = <TaxWithholdingCategory: TDS - 194Q - Company>
      args = ()
      kwargs = {}
      hooks = [<function apply at 0x7eff0a15a5f0>]
      method = 'validate'
      doc_events = {'*': {'on_update': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.core.doctype.file.utils.attach_files_to_document', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply', 'frappe.automation.doctype.assignment_rule.assignment_rule.update_due_date', 'frappe.core.doctype.user_type.user_type.apply_permissions_for_non_standard_user_type'], 'after_rename': ['frappe.desk.notifications.clear_doctype_notifications'], 'on_cancel': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply'], 'on_trash': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions'], 'on_update_after_submit': ['frappe.workflow.doctype.workflow_action.workflow_action.process_w...
      handler = 'erpnext.support.doctype.service_level_agreement.service_level_agreement.apply'
      composed = <function Document.hook.<locals>.compose.<locals>.runner at 0x7eff0a04fc70>
      compose = <function Document.hook.<locals>.compose at 0x7eff0a04f9a0>
      f = <function Document.run_method.<locals>.fn at 0x7eff0a04eb90>
  File "apps/frappe/frappe/model/document.py", line 1302, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
      self = <TaxWithholdingCategory: TDS - 194Q - Company>
      method = 'validate'
      args = ()
      kwargs = {}
      add_to_return_value = <function Document.hook.<locals>.add_to_return_value at 0x7eff0a04f640>
      fn = <function Document.run_method.<locals>.fn at 0x7eff0a04eb90>
      hooks = (<function apply at 0x7eff0a15a5f0>,)
  File "apps/frappe/frappe/model/document.py", line 957, in fn
    return method_object(*args, **kwargs)
      self = <TaxWithholdingCategory: TDS - 194Q - Company>
      args = ()
      kwargs = {}
      method_object = <bound method TaxWithholdingCategory.validate of <TaxWithholdingCategory: TDS - 194Q - Company>>
      method = 'validate'
  File "apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 37, in validate
    self.validate_accounts()
      self = <TaxWithholdingCategory: TDS - 194Q - Company>
  File "apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 54, in validate_accounts
    frappe.throw(_("Account {0} added multiple times").format(frappe.bold(d.get("account"))))
      self = <TaxWithholdingCategory: TDS - 194Q - Company>
      existing_accounts = ['TDS Payable - XPL', 'TDS Payable - XPL-K', 'TDS Payable - XPL-M', 'TDS Payable - XPL-R', 'TDS Payable - XPL-D']
      d = <TaxWithholdingAccount: 873ae5d3ff parent=TDS - 194Q - Company>
  File "apps/frappe/frappe/__init__.py", line 602, in throw
    msgprint(
      msg = 'Account <strong>TDS Payable - XPL</strong> added multiple times'
      exc = <class 'frappe.exceptions.ValidationError'>
      title = None
      is_minimizable = False
      wide = False
      as_list = False
      primary_action = None
  File "apps/frappe/frappe/__init__.py", line 567, in msgprint
    _raise_exception()
      title = None
      as_table = False
      as_list = False
      indicator = 'red'
      alert = False
      primary_action = None
      is_minimizable = False
      wide = False
      realtime = False
      sys = <module 'sys' (built-in)>
      _raise_exception = <function msgprint.<locals>._raise_exception at 0x7eff0a04feb0>
      inspect = <module 'inspect' from '/usr/lib/python3.10/inspect.py'>
      msg = 'Account TDS Payable - XPL added multiple times'
      out = {'message': 'Account <strong>TDS Payable - XPL</strong> added multiple times', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': '5c8e386bd13e7264eadb601437097f077e8feea01c25494163e3b72e'}
      raise_exception = <class 'frappe.exceptions.ValidationError'>
  File "apps/frappe/frappe/__init__.py", line 518, in _raise_exception
    raise exc
      exc = ValidationError('Account TDS Payable - XPL added multiple times')
      inspect = <module 'inspect' from '/usr/lib/python3.10/inspect.py'>
      msg = 'Account TDS Payable - XPL added multiple times'
      out = {'message': 'Account <strong>TDS Payable - XPL</strong> added multiple times', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': '5c8e386bd13e7264eadb601437097f077e8feea01c25494163e3b72e'}
      raise_exception = <class 'frappe.exceptions.ValidationError'>
frappe.exceptions.ValidationError: Account TDS Payable - XPL added multiple times

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mohsinalimat mohsinalimat added the bug Something isn't working label Mar 27, 2024
@mohsinalimat
Copy link
Author

mohsinalimat commented Mar 27, 2024

@sagarvora @vorasmit Try with frappe cloud and getting same issue.

FC Ticket no. #12314

@mohsinalimat mohsinalimat changed the title frappe.exceptions.ValidationError: Account TDS Payable - XPL added multiple times patch error: india_compliance.patches.post_install.update_company_fixtures #3 Mar 27, 2024
@ljain112
Copy link
Collaborator

It seems like there is an error occurring when updating accounts in the tax withholding category. The error might be due to using a different company's Account with different company.

To resolve this issue, please verify if the TaxWithholdingCategory- TDS - 194Q - Company has the correct TDS Account account linked to the correct company.

@ljain112 ljain112 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2024
@mohsinalimat
Copy link
Author

@ljain112 Before india-compliance version is 15.5.2 then after I update the version of frappe, ERPNext and india-compliance then when I migrate the site then this error appear.

@ljain112
Copy link
Collaborator

There is a patch to update TDS Withholding Categories. This patch is failing on your site.
The patch is failing due to the same account being set in the Tax withholding category.
This can happen only when an incorrect account is linked with the company.
To resolve this issue, please verify if the TaxWithholdingCategory- TDS - 194Q - Company has the correct TDS Account account linked to the correct company.

@mohsinalimat
Copy link
Author

It is correct linking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants