frappe / non_profit

Non Profit module for Frappe/ERPNext
GNU General Public License v3.0
34 stars 55 forks source link

Unable to install non_profit on version-15 #27

Open shantanoo opened 3 months ago

shantanoo commented 3 months ago
$ bench version
education 15.0.0
erpnext 15.16.1
frappe 15.17.0
hrms 15.12.0
non_profit 0.0.1
payments 0.0.1
$ bench --site all install-app non_profit
App erpnext already installed

Installing non_profit...
An error occurred while installing non_profit: ('Module Def', 'Non Profit', IntegrityError(1062, "Duplicate entry 'Non Profit' for key 'PRIMARY'"))
Traceback with variables (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 446, in install_app
    _install_app(app, verbose=context.verbose, force=force)
      context = {'sites': ['erp.jpsdc.org'], 'force': False, 'verbose': False, 'profile': False}
      apps = ('non_profit',)
      force = False
      _install_app = <function install_app at 0xffff9f2f5630>
      filelock = <function filelock at 0xffff9f2f52d0>
      exit_code = 0
      site = 'erp.jpsdc.org'
      app = 'non_profit'
      err = DuplicateEntryError('Module Def', 'Non Profit', IntegrityError(1062, "Duplicate entry 'Non Profit' for key 'PRIMARY'"))
  File "apps/frappe/frappe/installer.py", line 297, in install_app
    add_module_defs(name, ignore_if_duplicate=force)
      name = 'non_profit'
      verbose = False
      set_as_patched = True
      force = False
      sync_jobs = <function sync_jobs at 0xffff9e256e60>
      sync_for = <function sync_for at 0xffff9e257880>
      sync_customizations = <function sync_customizations at 0xffff9f3fe950>
      sync_fixtures = <function sync_fixtures at 0xffff9e257a30>
      app_hooks = {'after_install': ['non_profit.setup.setup_non_profit'], 'app_color': ['grey'], 'app_description': ['Non Profit'], 'app_email': ['pandikunta@frappe.io'], 'app_icon': ['octicon octicon-file-directory'], 'app_license': ['MIT'], 'app_name': ['non_profit'], 'app_publisher': ['Frappe'], 'app_title': ['Non Profit'], 'before_tests': ['non_profit.non_profit.utils.before_tests'], 'doctype_js': {'Sales Invoice': ['public/js/payment_entry.js']}, 'global_search_doctypes': {'Non Profit': [{'doctype': 'Certified Consultant', 'index': 1}, {'doctype': 'Certification Application', 'index': 2}, {'doctype': 'Volunteer', 'index': 3}, {'doctype': 'Membership', 'index': 4}, {'doctype': 'Member', 'index': 5}, {'doctype': 'Donor', 'index': 6}, {'doctype': 'Chapter', 'index': 7}, {'doctype': 'Grant Application', 'index': 8}, {'doctype': 'Volunteer Type', 'index': 9}, {'doctype': 'Donor Type', 'index': 10}, {'doctype': 'Membership Type', 'index': 11}]}, 'override_doctype_class': {'Payment Entry': ['non_profit.n...
      installed_apps = ['frappe', 'erpnext', 'hrms', 'education', 'payments']
      app = 'erpnext'
      required_app = 'erpnext'
  File "apps/frappe/frappe/installer.py", line 629, in add_module_defs
    d.insert(ignore_permissions=True, ignore_if_duplicate=ignore_if_duplicate)
      app = 'non_profit'
      ignore_if_duplicate = False
      modules = ['Non Profit']
      module = 'Non Profit'
      d = <ModuleDef: Non Profit>
  File "apps/frappe/frappe/model/document.py", line 300, in insert
    self.db_insert(ignore_if_duplicate=ignore_if_duplicate)
      self = <ModuleDef: Non Profit>
      ignore_permissions = True
      ignore_links = None
      ignore_if_duplicate = False
      ignore_mandatory = None
      set_name = None
      set_child_names = True
  File "apps/frappe/frappe/model/base_document.py", line 577, in db_insert
    raise frappe.DuplicateEntryError(self.doctype, self.name, e)
      self = <ModuleDef: Non Profit>
      ignore_if_duplicate = False
      conflict_handler = ''
      d = {'name': 'Non Profit', 'creation': '2024-03-07 02:01:12.762897', 'modified': '2024-03-07 02:01:12.762897', 'modified_by': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'idx': 0, 'module_name': 'Non Profit', 'custom': 0, 'package': None, 'app_name': 'non_profit', 'restrict_to_domain': None, '_user_tags': None, '_comments': None, '_assign': None, '_liked_by': None}
      columns = ['name', 'creation', 'modified', 'modified_by', 'owner', 'docstatus', 'idx', 'module_name', 'custom', 'package', 'app_name', 'restrict_to_domain', '_user_tags', '_comments', '_assign', '_liked_by']
frappe.exceptions.DuplicateEntryError: ('Module Def', 'Non Profit', IntegrityError(1062, "Duplicate entry 'Non Profit' for key 'PRIMARY'"))
justmejust2 commented 3 months ago

install payment bench get app payments then delete from tabModule Def WHERE NAME LIKE '%ofit%'; install payment bench --site {sitename} install-app payment that is it

david-loe commented 1 month ago

I've also trouble installing non_profit on ERPNext v15

frappe@3c6991a24641:~/frappe-bench$ bench --site 127.0.0.1 install-app non_profit
App erpnext already installed

Installing non_profit...
Document Insert Error
Traceback (most recent call last):
  File "apps/frappe/frappe/desk/page/setup_wizard/setup_wizard.py", line 423, in make_records
    doc.insert(ignore_permissions=True, ignore_if_duplicate=True)
  File "apps/frappe/frappe/model/document.py", line 283, in insert
    self._validate_links()
  File "apps/frappe/frappe/model/document.py", line 930, in _validate_links
    frappe.throw(_("Could not find {0}").format(msg), frappe.LinkValidationError)
  File "apps/frappe/frappe/__init__.py", line 645, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 610, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 561, in _raise_exception
    raise exc
frappe.exceptions.LinkValidationError: Could not find Party Type: Member

Document Insert Error
Traceback (most recent call last):
  File "apps/frappe/frappe/desk/page/setup_wizard/setup_wizard.py", line 423, in make_records
    doc.insert(ignore_permissions=True, ignore_if_duplicate=True)
  File "apps/frappe/frappe/model/document.py", line 283, in insert
    self._validate_links()
  File "apps/frappe/frappe/model/document.py", line 930, in _validate_links
    frappe.throw(_("Could not find {0}").format(msg), frappe.LinkValidationError)
  File "apps/frappe/frappe/__init__.py", line 645, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 610, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 561, in _raise_exception
    raise exc
frappe.exceptions.LinkValidationError: Could not find Party Type: Donor

An error occurred while installing non_profit: Could not find DocType: Member
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': ['127.0.0.1'], 'force': False, 'verbose': False, 'profile': False}
      apps = ('non_profit',)
      force = False
      _install_app = <function install_app at 0x7f3a05e4ccc0>
      filelock = <function filelock at 0x7f3a05e3e0c0>
      exit_code = 0
      site = '127.0.0.1'
      app = 'non_profit'
      err = LinkValidationError('Could not find DocType: Member')
  File "apps/frappe/frappe/installer.py", line 311, in install_app
    frappe.get_attr(after_install)()
      name = 'non_profit'
      verbose = False
      set_as_patched = True
      force = False
      sync_jobs = <function sync_jobs at 0x7f3a04e1e7a0>
      sync_for = <function sync_for at 0x7f3a04e1f600>
      sync_customizations = <function sync_customizations at 0x7f3a05fca700>
      sync_fixtures = <function sync_fixtures at 0x7f3a04e1f920>
      app_hooks = {'after_install': ['non_profit.setup.setup_non_profit'], 'app_color': ['grey'], 'app_description': ['Non Profit'], 'app_email': ['pandikunta@frappe.io'], 'app_icon': ['octicon octicon-file-directory'], 'app_license': ['MIT'], 'app_name': ['non_profit'], 'app_publisher': ['Frappe'], 'app_title': ['Non Profit'], 'before_tests': ['non_profit.non_profit.utils.before_tests'], 'doctype_js': {'Sales Invoice': ['public/js/payment_entry.js']}, 'global_search_doctypes': {'Non Profit': [{'doctype': 'Certified Consultant', 'index': 1}, {'doctype': 'Certification Application', 'index': 2}, {'doctype': 'Volunteer', 'index': 3}, {'doctype': 'Membership', 'index': 4}, {'doctype': 'Member', 'index': 5}, {'doctype': 'Donor', 'index': 6}, {'doctype': 'Chapter', 'index': 7}, {'doctype': 'Grant Application', 'index': 8}, {'doctype': 'Volunteer Type', 'index': 9}, {'doctype': 'Donor Type', 'index': 10}, {'doctype': 'Membership Type', 'index': 11}]}, 'override_doctype_class': {'Payment Entry': ['non_profit.n...
      installed_apps = ['frappe', 'erpnext']
      app = 'erpnext'
      required_app = 'erpnext'
      after_install = 'non_profit.setup.setup_non_profit'
  File "apps/non_profit/non_profit/setup.py", line 16, in setup_non_profit
    make_custom_fields()
  File "apps/non_profit/non_profit/setup.py", line 42, in make_custom_fields
    create_custom_fields(custom_fields, update=update)
      update = True
      custom_fields = {'Company': [{'fieldname': 'non_profit_section', 'label': 'Non Profit Settings', 'fieldtype': 'Section Break', 'insert_after': 'asset_received_but_not_billed', 'collapsible': 1}, {'fieldname': 'company_80g_number', 'label': '80G Number', 'fieldtype': 'Data', 'insert_after': 'non_profit_section'}, {'fieldname': 'with_effect_from', 'label': '80G With Effect From', 'fieldtype': 'Date', 'insert_after': 'company_80g_number'}, {'fieldname': 'non_profit_column_break', 'fieldtype': 'Column Break', 'insert_after': 'with_effect_from'}, {'fieldname': 'pan_details', 'label': 'PAN Number', 'fieldtype': 'Data', 'insert_after': 'with_effect_from'}], 'Member': [{'fieldname': 'pan_number', 'label': 'PAN Details', 'fieldtype': 'Data', 'insert_after': 'email_id'}], 'Donor': [{'fieldname': 'pan_number', 'label': 'PAN Details', 'fieldtype': 'Data', 'insert_after': 'email'}]}
  File "apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 326, in create_custom_fields
    create_custom_field(doctype, df, ignore_validate=ignore_validate)
      custom_fields = {'Company': [{'fieldname': 'non_profit_section', 'label': 'Non Profit Settings', 'fieldtype': 'Section Break', 'insert_after': 'asset_received_but_not_billed', 'collapsible': 1}, {'fieldname': 'company_80g_number', 'label': '80G Number', 'fieldtype': 'Data', 'insert_after': 'non_profit_section'}, {'fieldname': 'with_effect_from', 'label': '80G With Effect From', 'fieldtype': 'Date', 'insert_after': 'company_80g_number'}, {'fieldname': 'non_profit_column_break', 'fieldtype': 'Column Break', 'insert_after': 'with_effect_from'}, {'fieldname': 'pan_details', 'label': 'PAN Number', 'fieldtype': 'Data', 'insert_after': 'with_effect_from'}], 'Member': [{'fieldname': 'pan_number', 'label': 'PAN Details', 'fieldtype': 'Data', 'insert_after': 'email_id'}], 'Donor': [{'fieldname': 'pan_number', 'label': 'PAN Details', 'fieldtype': 'Data', 'insert_after': 'email'}]}
      ignore_validate = False
      update = True
      doctypes_to_update = {'Company', 'Member'}
      doctypes = ('Member',)
      fields = [{'fieldname': 'pan_number', 'label': 'PAN Details', 'fieldtype': 'Data', 'insert_after': 'email_id'}]
      doctype = 'Member'
      df = {'fieldname': 'pan_number', 'label': 'PAN Details', 'fieldtype': 'Data', 'insert_after': 'email_id', 'owner': 'Administrator'}
      field = None
  File "apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 292, in create_custom_field
    custom_field.insert()
      doctype = 'Member'
      df = {'fieldname': 'pan_number', 'label': 'PAN Details', 'fieldtype': 'Data', 'insert_after': 'email_id', 'owner': 'Administrator'}
      ignore_validate = False
      is_system_generated = True
      custom_field = <CustomField: unsaved>
  File "apps/frappe/frappe/model/document.py", line 283, in insert
    self._validate_links()
      self = <CustomField: unsaved>
      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 930, in _validate_links
    frappe.throw(_("Could not find {0}").format(msg), frappe.LinkValidationError)
      self = <CustomField: unsaved>
      invalid_links = [('dt', 'Member', 'DocType: Member')]
      cancelled_links = []
      msg = 'DocType: Member'
  File "apps/frappe/frappe/__init__.py", line 645, in throw
    msgprint(
      msg = 'Could not find DocType: Member'
      exc = <class 'frappe.exceptions.LinkValidationError'>
      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 = 'Could not find DocType: Member'
      title = None
      raise_exception = <class 'frappe.exceptions.LinkValidationError'>
      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 0x7f3a0236a660>
      inspect = <module 'inspect' from '/usr/local/lib/python3.11/inspect.py'>
      out = {'message': 'Could not find DocType: Member', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': '9a2caaab5ab84a05fffd52c4796d074c3ed598f0490c152bc2d3e768'}
  File "apps/frappe/frappe/__init__.py", line 561, in _raise_exception
    raise exc
      exc = LinkValidationError('Could not find DocType: Member')
      inspect = <module 'inspect' from '/usr/local/lib/python3.11/inspect.py'>
      msg = 'Could not find DocType: Member'
      out = {'message': 'Could not find DocType: Member', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': '9a2caaab5ab84a05fffd52c4796d074c3ed598f0490c152bc2d3e768'}
      raise_exception = <class 'frappe.exceptions.LinkValidationError'>
frappe.exceptions.LinkValidationError: Could not find DocType: Member
frappe@3c6991a24641:~/frappe-bench$ bench version
erpnext 15.22.0
frappe 15.25.0
non_profit 0.0.1
david-loe commented 1 month ago

Error was the same as with the other install failures: missing payments

So before installing non_profit install payments. This worked for me on a fresh site:

bench get-app payments
bench --site 127.0.0.1 install-app payments
bench get-app non_profit
bench --site 127.0.0.1 install-app non_profit

NEEDS TO BE ADDED TO THE README!!

shantanoo commented 1 month ago

@david-loe instead of adding it in README, it would be better to put it requirements.txt