Update to ERPNext v.11 gave me this error

So I was clean install frappe on my Ubuntu 16. The frappe that installed was in version 10, it worked fine until I switch the branch to staging to installed the version 11. Here’s what I did:

Switch to staging branch
bench switch-to-branch staging frappe
bench switch-to-branch staging erpnext
Setup requirements
bench setup requirements
Migrate site
bench --site site-name migrate
Restart supervisor
bench restart

bench migrate
bench update --patch

And after that, I was getting these errors:

Migrating site1.local
Executing erpnext.patches.v11_0.add_healthcare_service_unit_tree_root in site1.local (1bd3e0294da19198)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 222, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 39, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py", line 14, in execute
    }).insert(ignore_permissions=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 223, in insert
    self._validate()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 446, in _validate
    self._validate_mandatory()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 725, in _validate_mandatory
    name=self.name))
frappe.exceptions.MandatoryError: [Healthcare Service Unit, All Healthcare Service Units]: company

Can someone help me?

just a thought … maybe try (if that is still possible) to rollback to before the upgrade, then run

  1. a regular bench udate
  2. migrate to v11 (staging branch) as described above

I have the same problem with the latest VM.
I started over several times but the result was always:

“frappe.exceptions.MandatoryError: [Healthcare Service Unit, All Healthcare Service Units]: company”

It seems to make no difference if I do a “bench update” before switching branches and starting the upgrade to v11.

1 Like

I have the same issue regarding a custom app.
Will be doing some explorations to clarify what this means specifically.

The fix was merged sometime back. Are you still facing any issues? Your post seems to be about custom patches that you have, right?

A custom application, namely a custom field. I’m checking what is the problem and will post solution here when I clear it

while moving from 10.1 to 11.1 I encountered error

frappe.exceptions.MandatoryError: [Contact, Guest]: mobile_no

at Executing frappe.patches.v11_0.create_contact_for_user in site1.local (1bd3e0294da19198)

I fixed this by putting some value in mobile_no filed for all users having null mobile_no in user table.
Ex.

update tabUser set mobile_no=7 where name=‘Guest’;

1 Like

Looks like the original issue is resolved, closing this