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

An error occurred while installing payments: Web Form: Options must be a valid DocType for field Payment Gateway in row 57 #87

Open
octantdesign opened this issue May 31, 2024 · 1 comment

Comments

@octantdesign
Copy link

octantdesign commented May 31, 2024

Hello,
An error occurred while installing payments,
Web Form : Options must be a valid DocType for the Payment Gateway field in line 57.

Docker installation (single server example)
Frappe Framework: v15.27.0
ERPNext: v15.24.0
Payments: v0.0.1


frappe@xxxxxxxxx:~/frappe-bench$ bench --site xxxxx.yyyyy.zz install-app payments

Installing payments...
* Installing Payment Custom Fields in Web Form
An error occurred while installing payments: Web Form: Options must be a valid DocType for field Payment Gateway in row 57
Traceback with variables (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 445, in install_app
    _install_app(app, verbose=context.verbose, force=force)
      context = {'sites': ['xxxxx.yyyyy.zz'], 'force': False, 'verbose': False, 'profile': False}
      apps = ('payments',)
      force = False
      _install_app = <function install_app at 0x7f7dc5711440>
      filelock = <function filelock at 0x7f7dc570e660>
      exit_code = 0
      site = 'xxxxx.yyyyy.zz'
      app = 'payments'
      err = WrongOptionsDoctypeLinkError('Web Form: Options must be a valid DocType for field Payment Gateway in row 57')
  File "apps/frappe/frappe/installer.py", line 311, in install_app
    frappe.get_attr(after_install)()
      name = 'payments'
      verbose = False
      set_as_patched = True
      force = False
      sync_jobs = <function sync_jobs at 0x7f7dc46e2e80>
      sync_for = <function sync_for at 0x7f7dc46e3ec0>
      sync_customizations = <function sync_customizations at 0x7f7dc589ee80>
      sync_fixtures = <function sync_fixtures at 0x7f7dc46f80e0>
      app_hooks = {'after_install': ['payments.utils.make_custom_fields'], 'app_description': ['Payments app for frappe'], 'app_email': ['[email protected]'], 'app_license': ['MIT'], 'app_name': ['payments'], 'app_publisher': ['Frappe Technologies'], 'app_title': ['Payments'], 'app_version': ['0.0.1'], 'before_install': ['payments.utils.before_install'], 'before_tests': ['erpnext.setup.utils.before_tests'], 'before_uninstall': ['payments.utils.delete_custom_fields'], 'override_doctype_class': {'Web Form': ['payments.overrides.payment_webform.PaymentWebForm']}, 'override_whitelisted_methods': {'frappe.website.doctype.web_form.web_form.accept': ['payments.overrides.payment_webform.accept']}, 'scheduler_events': {'all': ['payments.payment_gateways.doctype.razorpay_settings.razorpay_settings.capture_payment']}}
      installed_apps = ['frappe', 'erpnext']
      before_install = 'payments.utils.before_install'
      out = None
      after_install = 'payments.utils.make_custom_fields'
  File "apps/payments/payments/utils/utils.py", line 60, in make_custom_fields
    create_custom_fields(
  File "apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 327, in create_custom_fields
    create_custom_field(doctype, df, ignore_validate=ignore_validate)
      custom_fields = {'Web Form': [{'fieldname': 'payments_tab', 'fieldtype': 'Tab Break', 'label': 'Payments', 'insert_after': 'custom_css'}, {'default': '0', 'fieldname': 'accept_payment', 'fieldtype': 'Check', 'label': 'Accept Payment', 'insert_after': 'payments'}, {'depends_on': 'accept_payment', 'fieldname': 'payment_gateway', 'fieldtype': 'Link', 'label': 'Payment Gateway', 'options': 'Payment Gateway', 'insert_after': 'accept_payment'}, {'default': 'Buy Now', 'depends_on': 'accept_payment', 'fieldname': 'payment_button_label', 'fieldtype': 'Data', 'label': 'Button Label', 'insert_after': 'payment_gateway'}, {'depends_on': 'accept_payment', 'fieldname': 'payment_button_help', 'fieldtype': 'Text', 'label': 'Button Help', 'insert_after': 'payment_button_label'}, {'fieldname': 'payments_cb', 'fieldtype': 'Column Break', 'insert_after': 'payment_button_help'}, {'default': '0', 'depends_on': 'accept_payment', 'fieldname': 'amount_based_on_field', 'fieldtype': 'Check', 'label': 'Amount Based On Field', 'in...
      ignore_validate = False
      update = True
      doctypes_to_update = {'Web Form'}
      doctypes = ('Web Form',)
      fields = [{'fieldname': 'payments_tab', 'fieldtype': 'Tab Break', 'label': 'Payments', 'insert_after': 'custom_css'}, {'default': '0', 'fieldname': 'accept_payment', 'fieldtype': 'Check', 'label': 'Accept Payment', 'insert_after': 'payments'}, {'depends_on': 'accept_payment', 'fieldname': 'payment_gateway', 'fieldtype': 'Link', 'label': 'Payment Gateway', 'options': 'Payment Gateway', 'insert_after': 'accept_payment'}, {'default': 'Buy Now', 'depends_on': 'accept_payment', 'fieldname': 'payment_button_label', 'fieldtype': 'Data', 'label': 'Button Label', 'insert_after': 'payment_gateway'}, {'depends_on': 'accept_payment', 'fieldname': 'payment_button_help', 'fieldtype': 'Text', 'label': 'Button Help', 'insert_after': 'payment_button_label'}, {'fieldname': 'payments_cb', 'fieldtype': 'Column Break', 'insert_after': 'payment_button_help'}, {'default': '0', 'depends_on': 'accept_payment', 'fieldname': 'amount_based_on_field', 'fieldtype': 'Check', 'label': 'Amount Based On Field', 'insert_after': ...
      doctype = 'Web Form'
      df = {'depends_on': 'accept_payment', 'fieldname': 'payment_gateway', 'fieldtype': 'Link', 'label': 'Payment Gateway', 'options': 'Payment Gateway', 'insert_after': 'accept_payment', 'owner': 'Administrator'}
      field = None
  File "apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 293, in create_custom_field
    custom_field.insert()
      doctype = 'Web Form'
      df = {'depends_on': 'accept_payment', 'fieldname': 'payment_gateway', 'fieldtype': 'Link', 'label': 'Payment Gateway', 'options': 'Payment Gateway', 'insert_after': 'accept_payment', 'owner': 'Administrator'}
      ignore_validate = False
      is_system_generated = True
      custom_field = <CustomField: Web Form-payment_gateway>
  File "apps/frappe/frappe/model/document.py", line 315, in insert
    self.run_post_save_methods()
      self = <CustomField: Web Form-payment_gateway>
      ignore_permissions = None
      ignore_links = None
      ignore_if_duplicate = False
      ignore_mandatory = None
      set_name = None
      set_child_names = True
  File "apps/frappe/frappe/model/document.py", line 1128, in run_post_save_methods
    self.run_method("on_update")
      self = <CustomField: Web Form-payment_gateway>
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
      self = <CustomField: Web Form-payment_gateway>
      method = 'on_update'
      args = ()
      kwargs = {}
      fn = <function Document.run_method.<locals>.fn at 0x7f7dc228ed40>
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
      self = <CustomField: Web Form-payment_gateway>
      args = ()
      kwargs = {}
      hooks = [<function clear_doctype_notifications at 0x7f7dc228f880>, <function process_workflow_actions at 0x7f7dc22936a0>, <function attach_files_to_document at 0x7f7dc46854e0>, <function apply at 0x7f7dc229e3e0>, <function update_due_date at 0x7f7dc229e480>, <function apply_permissions_for_non_standard_user_type at 0x7f7dc229fba0>]
      method = 'on_update'
      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 = 'frappe.core.doctype.user_type.user_type.apply_permissions_for_non_standard_user_type'
      composed = <function Document.hook.<locals>.compose.<locals>.runner at 0x7f7dc1efbc40>
      compose = <function Document.hook.<locals>.compose at 0x7f7dc2037f60>
      f = <function Document.run_method.<locals>.fn at 0x7f7dc228ed40>
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
      self = <CustomField: Web Form-payment_gateway>
      method = 'on_update'
      args = ()
      kwargs = {}
      add_to_return_value = <function Document.hook.<locals>.add_to_return_value at 0x7f7dc2037880>
      fn = <function Document.run_method.<locals>.fn at 0x7f7dc228ed40>
      hooks = (<function clear_doctype_notifications at 0x7f7dc228f880>, <function process_workflow_actions at 0x7f7dc22936a0>, <function attach_files_to_document at 0x7f7dc46854e0>, <function apply at 0x7f7dc229e3e0>, <function update_due_date at 0x7f7dc229e480>, <function apply_permissions_for_non_standard_user_type at 0x7f7dc229fba0>)
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
      self = <CustomField: Web Form-payment_gateway>
      args = ()
      kwargs = {}
      method_object = <bound method CustomField.on_update of <CustomField: Web Form-payment_gateway>>
      method = 'on_update'
  File "apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 207, in on_update
    validate_fields_for_doctype(self.dt)
      self = <CustomField: Web Form-payment_gateway>
      validate_fields_for_doctype = <function validate_fields_for_doctype at 0x7f7dc2034cc0>
  File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1201, in validate_fields_for_doctype
    validate_fields(meta)
      doctype = 'Web Form'
      meta = <Meta: Web Form>
  File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1637, in validate_fields
    check_link_table_options(meta.get("name"), d)
      meta = <Meta: Web Form>
      check_illegal_characters = <function validate_fields.<locals>.check_illegal_characters at 0x7f7dc1efb6a0>
      check_invalid_fieldnames = <function validate_fields.<locals>.check_invalid_fieldnames at 0x7f7dc1efb9c0>
      check_unique_fieldname = <function validate_fields.<locals>.check_unique_fieldname at 0x7f7dc1efb880>
      check_fieldname_length = <function validate_fields.<locals>.check_fieldname_length at 0x7f7dc1efb7e0>
      check_illegal_mandatory = <function validate_fields.<locals>.check_illegal_mandatory at 0x7f7dc1efbba0>
      check_link_table_options = <function validate_fields.<locals>.check_link_table_options at 0x7f7dc1d0a0c0>
      check_hidden_and_mandatory = <function validate_fields.<locals>.check_hidden_and_mandatory at 0x7f7dc1d0a2a0>
      check_width = <function validate_fields.<locals>.check_width at 0x7f7dc1d09120>
      check_in_list_view = <function validate_fields.<locals>.check_in_list_view at 0x7f7dc1d091c0>
      check_in_global_search = <function validate_fields.<locals>.check_in_global_search at 0x7f7dc1d09260>
      check_dynamic_link_options = <function validate_fields.<locals>.check_dynamic_link_options at 0x7f7dc1d09300>
      check_illegal_default = <function validate_fields.<locals>.check_illegal_default at 0x7f7dc1d093a0>
      check_precision = <function validate_fields.<locals>.check_precision at 0x7f7dc1d09440>
      check_unique_and_text = <function validate_fields.<locals>.check_unique_and_text at 0x7f7dc1d094e0>
      check_fold = <function validate_fields.<locals>.check_fold at 0x7f7dc1d09580>
      check_search_fields = <function validate_fields.<locals>.check_search_fields at 0x7f7dc1d09620>
      check_title_field = <function validate_fields.<locals>.check_title_field at 0x7f7dc1d096c0>
      check_image_field = <function validate_fields.<locals>.check_image_field at 0x7f7dc1d09760>
      check_is_published_field = <function validate_fields.<locals>.check_is_published_field at 0x7f7dc1d09800>
      check_website_search_field = <function validate_fields.<locals>.check_website_search_field at 0x7f7dc1d098a0>
      check_timeline_field = <function validate_fields.<locals>.check_timeline_field at 0x7f7dc1d09940>
      check_sort_field = <function validate_fields.<locals>.check_sort_field at 0x7f7dc1d099e0>
      check_illegal_depends_on_conditions = <function validate_fields.<locals>.check_illegal_depends_on_conditions at 0x7f7dc1d09a80>
      check_table_multiselect_option = <function validate_fields.<locals>.check_table_multiselect_option at 0x7f7dc1d09b20>
      scrub_options_in_select = <function validate_fields.<locals>.scrub_options_in_select at 0x7f7dc1d09bc0>
      scrub_fetch_from = <function validate_fields.<locals>.scrub_fetch_from at 0x7f7dc1d09c60>
      validate_data_field_type = <function validate_fields.<locals>.validate_data_field_type at 0x7f7dc1d09d00>
      check_child_table_option = <function validate_fields.<locals>.check_child_table_option at 0x7f7dc1d09da0>
      check_max_height = <function validate_fields.<locals>.check_max_height at 0x7f7dc1d09e40>
      check_no_of_ratings = <function validate_fields.<locals>.check_no_of_ratings at 0x7f7dc1d09f80>
      d = <LinkDocField: payment_gateway parent=Web Form>
      fieldname_list = ['form_tab', 'title', 'route', 'published', 'column_break_vdhm', 'doc_type', 'module', 'is_standard', 'section_break_1', 'introduction_text', 'web_form_fields', 'settings_tab', 'login_required', 'allow_multiple', 'allow_edit', 'allow_delete', 'anonymous', 'column_break_2', 'apply_document_permissions', 'allow_print', 'print_format', 'allow_comments', 'show_attachments', 'allow_incomplete', 'section_break_2', 'max_attachment_size', 'condition_section', 'condition_description', 'condition_json', 'section_break_3', 'list_setting_message', 'show_list', 'list_title', 'list_columns', 'section_break_4', 'show_sidebar', 'website_sidebar', 'customization_tab', 'button_label', 'banner_image', 'column_break_3', 'breadcrumbs', 'section_break_5', 'success_title', 'success_url', 'column_break_4', 'success_message', 'meta_section', 'meta_title', 'meta_description', 'column_break_khxs', 'meta_image', 'section_break_6', 'client_script', 'custom_css', 'payments_tab', 'payment_gateway', 'accept_payment']
      fields = [<Tab BreakDocField: form_tab parent=Web Form>, <DataDocField: title parent=Web Form>, <DataDocField: route parent=Web Form>, <CheckDocField: published parent=Web Form>, <Column BreakDocField: column_break_vdhm parent=Web Form>, <LinkDocField: doc_type parent=Web Form>, <LinkDocField: module parent=Web Form>, <CheckDocField: is_standard parent=Web Form>, <Section BreakDocField: section_break_1 parent=Web Form>, <Text EditorDocField: introduction_text parent=Web Form>, <TableDocField: web_form_fields parent=Web Form>, <Tab BreakDocField: settings_tab parent=Web Form>, <CheckDocField: login_required parent=Web Form>, <CheckDocField: allow_multiple parent=Web Form>, <CheckDocField: allow_edit parent=Web Form>, <CheckDocField: allow_delete parent=Web Form>, <CheckDocField: anonymous parent=Web Form>, <Column BreakDocField: column_break_2 parent=Web Form>, <CheckDocField: apply_document_permissions parent=Web Form>, <CheckDocField: allow_print parent=Web Form>, <LinkDocField: print_format p...
      not_allowed_in_list_view = ['Section Break', 'Column Break', 'Tab Break', 'HTML', 'Table', 'Table MultiSelect', 'Button', 'Image', 'Fold', 'Heading', 'Attach Image']
  File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1276, in check_link_table_options
    frappe.throw(
      docname = 'Web Form'
      d = <LinkDocField: payment_gateway parent=Web Form>
      options = None
  File "apps/frappe/frappe/__init__.py", line 645, in throw
    msgprint(
      msg = 'Web Form: Options must be a valid DocType for field Payment Gateway in row 57'
      exc = <class 'frappe.core.doctype.doctype.doctype.WrongOptionsDoctypeLinkError'>
      title = None
      is_minimizable = False
      wide = False
      as_list = False
      primary_action = None
  File "apps/frappe/frappe/__init__.py", line 610, in msgprint
    _raise_exception()
      msg = 'Web Form: Options must be a valid DocType for field Payment Gateway in row 57'
      title = None
      raise_exception = <class 'frappe.core.doctype.doctype.doctype.WrongOptionsDoctypeLinkError'>
      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 0x7f7dc1d0a3e0>
      inspect = <module 'inspect' from '/usr/local/lib/python3.11/inspect.py'>
      out = {'message': 'Web Form: Options must be a valid DocType for field Payment Gateway in row 57', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': '50ededc0282a663527bdf51112c1c7a132723981adec8e46fd7762d1'}
  File "apps/frappe/frappe/__init__.py", line 561, in _raise_exception
    raise exc
      exc = WrongOptionsDoctypeLinkError('Web Form: Options must be a valid DocType for field Payment Gateway in row 57')
      inspect = <module 'inspect' from '/usr/local/lib/python3.11/inspect.py'>
      msg = 'Web Form: Options must be a valid DocType for field Payment Gateway in row 57'
      out = {'message': 'Web Form: Options must be a valid DocType for field Payment Gateway in row 57', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': '50ededc0282a663527bdf51112c1c7a132723981adec8e46fd7762d1'}
      raise_exception = <class 'frappe.core.doctype.doctype.doctype.WrongOptionsDoctypeLinkError'>
frappe.core.doctype.doctype.doctype.WrongOptionsDoctypeLinkError: Web Form: Options must be a valid DocType for field Payment Gateway in row 57


@Elkanaaa
Copy link

I'm getting this exact same error. Fresh install on 24.04 as per Unattended Install Script.

bench get-app payments --branch version-15
bench --site site1.local install-app payments

+----------+---------+------------+---------+
| App      | Version | Branch     | Commit  |
+----------+---------+------------+---------+
| erpnext  | 15.29.3 | version-15 | ce8b423 |
| frappe   | 15.34.1 | version-15 | b6373cf |
| payments | 0.0.1   | version-15 | a3a84cd |
+----------+---------+------------+---------+

I could just do "bench --site site1.local migrate" and ignore it - but is this safe to do?
If not what are we doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants