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

Error on a new site creation. #581

Closed
anandk-spyke-o1 opened this issue Nov 7, 2024 · 2 comments · Fixed by 8848digital/frappe-v15#37
Closed

Error on a new site creation. #581

anandk-spyke-o1 opened this issue Nov 7, 2024 · 2 comments · Fixed by 8848digital/frappe-v15#37
Assignees
Labels
bug Something isn't working

Comments

@anandk-spyke-o1
Copy link

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 anandk-spyke-o1 added the bug Something isn't working label Nov 7, 2024
@anandk-spyke-o1
Copy link
Author

anandk-spyke-o1 commented Nov 7, 2024

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

@Abhishek8848 Abhishek8848 self-assigned this Nov 7, 2024
@Abhishek8848 Abhishek8848 linked a pull request Nov 7, 2024 that will close this issue
@tinadn
Copy link

tinadn commented Nov 11, 2024

Issue resolved. Hence closing.

@tinadn tinadn closed this as completed Nov 11, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants