frappe / education

Open source education / school management system
Other
168 stars 156 forks source link

can't add new student #124

Closed AliShaatani closed 1 year ago

AliShaatani commented 1 year ago

image

App Versions

{
    "education": "0.0.1",
    "erpnext": "14.23.2",
    "frappe": "14.35.0",
    "hrms": "15.0.0-dev"
}

Route

Form/Student/new-student-1

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 66, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 45, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1607, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 26, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 305, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 327, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 259, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1045, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 914, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1264, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1246, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 911, in fn
    return method_object(*args, **kwargs)
  File "apps/education/education/education/doctype/student/student.py", line 19, in validate
    self.validate_user()
  File "apps/education/education/education/doctype/student/student.py", line 68, in validate_user
    student_user.add_roles("Student")
  File "apps/frappe/frappe/core/doctype/user/user.py", line 498, in add_roles
    self.save()
  File "apps/frappe/frappe/model/document.py", line 305, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 327, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 254, in insert
    self.set_new_name(set_name=set_name, set_child_names=set_child_names)
  File "apps/frappe/frappe/model/document.py", line 450, in set_new_name
    set_new_name(self)
  File "apps/frappe/frappe/model/naming.py", line 163, in set_new_name
    doc.run_method("autoname")
  File "apps/frappe/frappe/model/document.py", line 914, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1264, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1246, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 911, in fn
    return method_object(*args, **kwargs)
  File "apps/frappe/frappe/core/doctype/user/user.py", line 48, in autoname
    self.email = self.email.strip().lower()
AttributeError: 'NoneType' object has no attribute 'strip'

Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"docstatus\":0,\"doctype\":\"Student\",\"name\":\"new-student-1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"ali.shaatani@gmail.com\",\"enabled\":1,\"naming_series\":\"EDU-STU-.YYYY.-\",\"joining_date\":\"2023-05-04\",\"blood_group\":\"\",\"country\":\"Libya\",\"first_name\":\"عصام \",\"middle_name\":\"العجيلي\",\"last_name\":\"الشامي\"}",
        "action": "Save"
    },
    "btn": {
        "jQuery360083057001168181241": {
            "events": {
                "click": [
                    {
                        "type": "click",
                        "origType": "click",
                        "guid": 1129,
                        "namespace": ""
                    }
                ]
            }
        }
    },
    "freeze": true,
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.form.save.savedocs"
}

Response Data

{
    "exception": "AttributeError: 'NoneType' object has no attribute 'strip'"
}
asifmohtesham commented 1 year ago

@AliShaatani How are you able to run the Education app on v14.23.2? I get Internal server error immediately after install the app.

AliShaatani commented 1 year ago

@AliShaatani How are you able to run the Education app on v14.23.2? I get Internal server error immediately after install the app.

Idk it works fine in Ubuntu 22.02, no issue when installing the app with the standard commands: $ bench get-app education $ bench --site YOURSITENAME install-app education

if you are using VMware or Virtualbox, with Bitnami image, this is a common problem in that image, due to resource limitations like Ram, and Vcores

AliShaatani commented 1 year ago

the problem is that the email field wasn't shown as a mandatory field image no red asterisk in email field once entering the email address, it works fine

RitvikSardana commented 1 year ago

refer this PR #135

had same issue, but can't make it mandatory