resilient-tech / india-compliance

Simple, yet powerful compliance solutions for Indian businesses
https://indiacompliance.app
GNU General Public License v3.0
150 stars 139 forks source link

update india compliance app and migrating bench #982

Closed riddhisolanki001 closed 1 year ago

riddhisolanki001 commented 1 year ago

Information about bug

When attempting to update the app within the Frappe cloud environment, an issue arises during the migration process as indicated by the failure message in the log provided

Version

ERPNext: v14.20.1 (HEAD)

Frappe Framework: v14.40.0 (HEAD)

India Compliance: v14.5.1 (HEAD)

Relevant log output / Stack trace / Full Error Message.

Executing execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #25 in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 6.89s
Executing execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #3 in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.762s
Executing india_compliance.patches.post_install.remove_old_fields in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.012s
Executing india_compliance.patches.post_install.update_company_gstin in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.513s
Executing execute:from india_compliance.audit_trail.setup import create_custom_fields, CUSTOM_FIELDS; create_custom_fields(CUSTOM_FIELDS) in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.257s
Executing india_compliance.patches.post_install.update_hsn_code in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 4.286s
Executing execute:from india_compliance.gst_india.setup import map_default_uoms; map_default_uoms() in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.04s
Executing india_compliance.patches.v14.set_correct_root_account_for_rcm in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.054s
Executing india_compliance.patches.v14.set_autogenerate_e_waybill_with_e_invoice in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.031s
Executing execute:import frappe; frappe.db.set_value("GST Settings", None, "archive_party_info_days", 7) in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.007s
Executing execute:import frappe; frappe.db.set_value("GST Settings", None, "enable_retry_e_invoice_generation", 1) in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.007s
Executing india_compliance.patches.v14.set_reverse_charge_applicability_in_supplier in mignesh.frappe.cloud (_562c87e2b1dd5835)
Success: Done in 0.028s
Executing india_compliance.patches.post_install.update_e_waybill_status in mignesh.frappe.cloud (_562c87e2b1dd5835)

Traceback with variables (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
      mod_name = 'frappe.utils.bench_helper'
      alter_argv = True
      mod_spec = ModuleSpec(name='frappe.utils.bench_helper', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fce77f2b5e0>, origin='/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py')
      code = <code object <module> at 0x7fce75bf12c0, file "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 1>
      main_globals = {'__name__': '__main__', '__doc__': None, '__package__': 'frappe.utils', '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7fce77f2b5e0>, '__spec__': ModuleSpec(name='frappe.utils.bench_helper', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fce77f2b5e0>, origin='/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py'), '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py', '__cached__': '/home/frappe/frappe-bench/apps/frappe/frappe/utils/__pycache__/bench_helper.cpython-310.pyc', 'importlib': <module 'importlib' from '/usr/lib/python3.10/importlib/__init__.py'>, 'json': <module 'json' from '/usr/lib/python3.10/json/__init__.py'>, 'os': <module 'os' from '/usr/lib/python3.10/os.py'>, 'traceback': <module 'traceback' from '/usr/lib/python3.10/traceback.py'>, 'warnings': <module 'warnings' from '/usr/lib/python3.10/warnings.py'>, 'click': <m...
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
      code = <code object <module> at 0x7fce75bf12c0, file "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 1>
      run_globals = {'__name__': '__main__', '__doc__': None, '__package__': 'frappe.utils', '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7fce77f2b5e0>, '__spec__': ModuleSpec(name='frappe.utils.bench_helper', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fce77f2b5e0>, origin='/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py'), '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py', '__cached__': '/home/frappe/frappe-bench/apps/frappe/frappe/utils/__pycache__/bench_helper.cpython-310.pyc', 'importlib': <module 'importlib' from '/usr/lib/python3.10/importlib/__init__.py'>, 'json': <module 'json' from '/usr/lib/python3.10/json/__init__.py'>, 'os': <module 'os' from '/usr/lib/python3.10/os.py'>, 'traceback': <module 'traceback' from '/usr/lib/python3.10/traceback.py'>, 'warnings': <module 'warnings' from '/usr/lib/python3.10/warnings.py'>, 'click': <m...
      init_globals = None
      mod_name = '__main__'
      mod_spec = ModuleSpec(name='frappe.utils.bench_helper', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fce77f2b5e0>, origin='/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py')
      pkg_name = 'frappe.utils'
      script_name = None
      loader = <_frozen_importlib_external.SourceFileLoader object at 0x7fce77f2b5e0>
      fname = '/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py'
      cached = '/home/frappe/frappe-bench/apps/frappe/frappe/utils/__pycache__/bench_helper.cpython-310.pyc'
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 109, in <module>
    main()
      ...skipped... 25 vars
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name="bench")
      commands = {'frappe': <Group frappe>, 'get-frappe-commands': <Command get-frappe-commands>, 'get-frappe-help': <Command get-frappe-help>}
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 829, in _call_
    return self.main(*args, **kwargs)
      self = <Group None>
      args = ()
      kwargs = {'prog_name': 'bench'}
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
      self = <Group None>
      args = ['frappe', '--site', 'mignesh.frappe.cloud', 'migrate', '--skip-search-index']
      prog_name = 'bench'
      complete_var = None
      standalone_mode = True
      extra = {}
      ctx = <click.core.Context object at 0x7fce75bdb760>
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
      _process_result = <function MultiCommand.invoke.<locals>._process_result at 0x7fce75bea7a0>
      args = ['migrate', '--skip-search-index']
      cmd_name = 'frappe'
      cmd = <Group frappe>
      sub_ctx = <click.core.Context object at 0x7fce75aa1570>
      ctx = <click.core.Context object at 0x7fce75bdb760>
      self = <Group None>
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
      _process_result = <function MultiCommand.invoke.<locals>._process_result at 0x7fce75ab0b80>
      args = []
      cmd_name = 'migrate'
      cmd = <Command migrate>
      sub_ctx = <click.core.Context object at 0x7fce75aa14e0>
      ctx = <click.core.Context object at 0x7fce75aa1570>
      self = <Group frappe>
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
      self = <Command migrate>
      ctx = <click.core.Context object at 0x7fce75aa14e0>
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
      args = ()
      kwargs = {'skip_search_index': True, 'skip_failing': False}
      self = <click.core.Context object at 0x7fce75aa14e0>
      callback = <function migrate at 0x7fce75a59240>
      ctx = <click.core.Context object at 0x7fce75aa14e0>
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), args, *kwargs)
      args = ()
      kwargs = {'skip_search_index': True, 'skip_failing': False}
      f = <function migrate at 0x7fce75a59000>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), args, *kwargs)
      ctx = <click.core.Context object at 0x7fce75aa14e0>
      args = ()
      kwargs = {'skip_search_index': True, 'skip_failing': False}
      profile = False
      f = <function migrate at 0x7fce75a58f70>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 557, in migrate
    SiteMigration(
      context = {'sites': ['mignesh.frappe.cloud'], 'force': False, 'verbose': False, 'profile': False}
      skip_failing = False
      skip_search_index = True
      activate_by_import = <module 'traceback_with_variables.activate_by_import' from '/home/frappe/frappe-bench/env/lib/python3.10/site-packages/traceback_with_variables/activate_by_import.py'>
      SiteMigration = <class 'frappe.migrate.SiteMigration'>
      site = 'mignesh.frappe.cloud'
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 175, in run
    self.run_schema_updates()
      self = <frappe.migrate.SiteMigration object at 0x7fce75aa1930>
      site = 'mignesh.frappe.cloud'
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 41, in wrapper
    ret = method(*args, **kwargs)
      args = (<frappe.migrate.SiteMigration object at 0x7fce75aa1930>,)
      kwargs = {}
      method = <function SiteMigration.run_schema_updates at 0x7fce738aeb90>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 114, in run_schema_updates
    frappe.modules.patch_handler.run_all(
      self = <frappe.migrate.SiteMigration object at 0x7fce75aa1930>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 75, in run_all
    run_patch(patch)
      patch_type = <PatchType.post_model_sync: 'post_model_sync'>
      executed = {'erpnext.patches.v12_0.rename_bank_reconciliation_fields # 2020-01-22', 'frappe.patches.v11_0.reload_and_rename_view_log #2019-01-03', 'erpnext.patches.v13_0.add_bin_unique_constraint', 'erpnext.patches.v13_0.create_custom_field_for_finance_book', 'execute:frappe.db.sql("delete from tabSessions where user is null")', 'erpnext.patches.v12_0.unset_customer_supplier_based_on_type_of_item_price', 'erpnext.patches.v13_0.rename_membership_settings_to_non_profit_settings', 'erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants', 'erpnext.patches.v11_0.rename_production_order_to_work_order', 'erpnext.patches.v12_0.update_pricing_rule_fields', 'frappe.patches.v13_0.update_newsletter_content_type', 'frappe.patches.v13_0.remove_chat', 'erpnext.patches.v14_0.update_reference_due_date_in_journal_entry', "execute:frappe.reload_doctype('user')", 'erpnext.patches.v12_0.set_automatically_process_deferred_accounting_in_accounts_settings', 'frappe.patches.v13_0.replace_field_target_wi...
      run_patch = <function run_all.<locals>.run_patch at 0x7fce72c6aef0>
      patches = ["execute:frappe.get_doc('Role', 'Guest').save() # remove desk access", 'frappe.core.doctype.role.patches.v13_set_default_desk_properties', 'frappe.patches.v14_0.update_workspace2 # 06.06.2023', 'frappe.patches.v14_0.drop_data_import_legacy', 'frappe.patches.v14_0.copy_mail_data #08.03.21', 'frappe.patches.v14_0.update_github_endpoints #08-11-2021', 'frappe.patches.v14_0.remove_db_aggregation', 'frappe.patches.v14_0.update_color_names_in_kanban_board_column', 'frappe.patches.v14_0.update_is_system_generated_flag', 'frappe.patches.v14_0.update_auto_account_deletion_duration', 'frappe.patches.v14_0.update_integration_request', 'frappe.patches.v14_0.set_document_expiry_default', 'frappe.patches.v14_0.delete_data_migration_tool', 'frappe.patches.v14_0.set_suspend_email_queue_default', 'frappe.patches.v14_0.different_encryption_key', 'frappe.patches.v14_0.update_multistep_webforms', 'frappe.patches.v14_0.drop_unused_indexes', 'frappe.patches.v14_0.disable_email_accounts_with_oauth', 'frappe...
      patch = 'india_compliance.patches.post_install.update_e_waybill_status'
      skip_failing = False
  File "/home/frappe/frappe-bench/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_e_waybill_status'
      skip_failing = False
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 150, in run_single
    return execute_patch(patchmodule, method, methodargs)
      patchmodule = 'india_compliance.patches.post_install.update_e_waybill_status'
      method = None
      methodargs = None
      force = False
      conf = <LocalProxy unbound>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 186, in execute_patch
    _patch()
      patchmodule = 'india_compliance.patches.post_install.update_e_waybill_status'
      method = None
      methodargs = None
      has_patch_file = True
      patch = 'india_compliance.patches.post_install.update_e_waybill_status.execute'
      docstring = ''
      _patch = <function execute at 0x7fce72d3caf0>
      start_time = 1692351928.2500272
  File "/home/frappe/frappe-bench/apps/india_compliance/india_compliance/patches/post_install/update_e_waybill_status.py", line 14, in execute
    set_not_applicable_status()
      e_waybill_enabled = None
  File "/home/frappe/frappe-bench/apps/india_compliance/india_compliance/patches/post_install/update_e_waybill_status.py", line 105, in set_not_applicable_status
    update_e_waybill_status(filters, "Not Applicable")
      filters = {'ewaybill': ['is', 'not set'], 'docstatus': ['!=', 0], 'e_waybill_status': ['is', 'not set']}
  File "/home/frappe/frappe-bench/apps/india_compliance/india_compliance/patches/post_install/update_e_waybill_status.py", line 111, in update_e_waybill_status
    frappe.qb.get_query(
      filters = {'ewaybill': ['is', 'not set'], 'docstatus': ['!=', 0], 'e_waybill_status': ['is', 'not set']}
      status = 'Not Applicable'
      doctype = 'Sales Invoice'
builtins.AttributeError: type object 'MariaDB' has no attribute 'get_query'

Code of Conduct

vorasmit commented 1 year ago

Were you trying to update India Compliance only without updating Frappe or ERPNext? There are interconnected dependencies and you may have to update all together. get_query in version-14 wasn't available in v14.40.0 hence you are getting this error.

vorasmit commented 1 year ago

The issue seems to be with frappe version used. Hence closing this issue.