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 on a new site creation. #581

Open anandk-spyke-o1 opened 1 day ago

anandk-spyke-o1 commented 1 day ago

Information about bug

When I tried to create a new site today it gave me attribute error from BaseDocument class as AttributeError: 'BaseDocument' object has no attribute 'unique'

Module

other

Version

Frappe

Installation method

None

Relevant log output / Stack trace / Full Error Message.

bench new-site new --db-type postgres
Postgres super user password: 

Installing frappe...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/env/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/env/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/env/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/env/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/env/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/env/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/commands/site.py", line 68, in new_site
    _new_site(
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/installer.py", line 112, in _new_site
    install_app(app, verbose=verbose, set_as_patched=not source_sql, force=False)
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/installer.py", line 291, in install_app
    out = frappe.get_attr(before_install)()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/utils/install.py", line 11, in before_install
    frappe.reload_doc("core", "doctype", "doctype_state")
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/__init__.py", line 1446, in reload_doc
    return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/modules/utils.py", line 216, in reload_doc
    return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/modules/import_file.py", line 57, in import_files
    return import_file(
           ^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/modules/import_file.py", line 65, in import_file
    return import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/modules/import_file.py", line 146, in import_file_by_path
    import_doc(
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/modules/import_file.py", line 239, in import_doc
    doc.insert()
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/model/document.py", line 302, in insert
    self.db_insert(ignore_if_duplicate=ignore_if_duplicate)
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/model/base_document.py", line 536, in db_insert
    self.show_unique_validation_message_for_postgress()
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/model/base_document.py", line 597, in show_unique_validation_message_for_postgress
    unique_column = self.get_unique_columns()  # Custom method to retrieve unique columns
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anand/postgress-erp/frappe-v15/frappe-bench-postgres/apps/frappe/frappe/model/base_document.py", line 631, in get_unique_columns
    if field.unique:
       ^^^^^^^^^^^^
AttributeError: 'BaseDocument' object has no attribute 'unique'
anandk-spyke-o1 commented 1 day ago

The error is coming from 'get_unique_columns' method in BaseDocument class.