Error in bench update to v9 when migrating

Hi!
After I solved some issues when I tried to update. https://discuss.erpnext.com/t/macos-high-sierra-error-updating-bench-2017-09-28/28852/8 I got another error now.

The trace :

➜ frappe-bench bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
Requirement already satisfied: olefile in ./env/lib/python2.7/site-packages (from Pillow)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull upstream master
From https://github.com/frappe/frappe

  • branch master -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull upstream master
    From https://github.com/frappe/erpnext
  • branch master -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    Updating Python libraries…
    INFO:bench.utils:./env/bin/pip install --upgrade pip
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    INFO:bench.utils:./env/bin/pip install -q -r /Users/anibal/PythonDev/bench-repo/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/library_management/requirements.txt
    Updating node libraries…
    INFO:bench.utils:npm install
    npm WARN frappe@ No description
    Backing up sites…
    Patching sites…
    Migrating library
    Executing frappe.patches.v8_0.set_currency_field_precision # 2017-05-09 in library (00299a408dc3498a)
    Traceback (most recent call last):
    File “/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
    main()
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/Users/anibal/PythonDev/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 722, in call
    return self.main(*args, **kwargs)
    File “/Users/anibal/PythonDev/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 697, in main
    rv = self.invoke(ctx)
    File “/Users/anibal/PythonDev/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/Users/anibal/PythonDev/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/Users/anibal/PythonDev/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/Users/anibal/PythonDev/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
    return callback(*args, **kwargs)
    File “/Users/anibal/PythonDev/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/commands/site.py”, line 217, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
    frappe.modules.patch_handler.run_all()
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
    if not run_single(patchmodule = patch):
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + “.execute”)()
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/patches/v8_0/set_currency_field_precision.py”, line 9, in execute
    frappe.reload_doc(‘core’, ‘doctype’, ‘system_settings’, force=True)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/init.py”, line 679, in reload_doc
    return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 153, in reload_doc
    return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 19, in import_files
    reset_permissions=reset_permissions)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 24, in import_file
    ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 58, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 131, in import_doc
    doc.insert()
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/model/document.py”, line 245, in insert
    self.run_post_save_methods()
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/model/document.py”, line 827, in run_post_save_methods
    self.run_method(“on_update”)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/model/document.py”, line 702, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/model/document.py”, line 924, in composer
    return composed(self, method, *args, **kwargs)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/model/document.py”, line 907, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/model/document.py”, line 696, in
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 206, in on_update
    make_module_and_roles(self)
    File “/Users/anibal/PythonDev/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 767, in make_module_and_roles
    if doc.restrict_to_domain and not frappe.db.exists(‘Domain’, doc.restrict_to_domain):
    AttributeError: ‘DocType’ object has no attribute ‘restrict_to_domain’

I can’t find any issue same like this one …

I really would appreciated any help …

Regards

I personally would just uninstall your current frappe/erpnext apps and DB and start again. Following this install tutorial make sure that your currently installed python, mariadb, redis, and node settings are correct. Sorry if this sounds like a scorched earth approach but sometimes its just faster. Good luck :slight_smile:

Yeah, you’re right, this is the easy way to solve the problem.
But if I take this way I never learn how to solve problems :wink: So I’ll prefer to take the hard way and search for a solution, don’t you think is better?
Anyway, thanks for your advice and wishes :slight_smile:

Agreed but sometimes its better just to focus on achieving the stated goal which is to develop a working ERP. It sounds like your problem was caused by Apple breaking stuff with an OSX upgrade. This isn’t a lesson that will come in handy down the track.
I personally prefer a VM based dev setup on my local machine using either vagrant or docker. This isolates python, mariadb, redis, node etc from OSX and allows me to test frappe in a native Centos7 environment which is where it will eventually end up running once live.

I think this conversation is for other thread :slight_smile:
But, about your point of view I think you’re are right in some way, but I think I’m right in another point of view. In my particular case, my profile is more extensive and I try to cover up the entire process of implementation of the product. By the way, I use a Virtualbox with Debian and frappe and erpnext installed from the scratch. I like your point of view, but I like too mine point of view.

As to the problem of the thread, you can see now it’s not a problem about the software on my Mac, I think is something about updating some data (DocTypes maybe) or a missing column in that table. I have no made modifications or tweaks to any table or DocType.

Anyway, thank you for share your thoughts.

Ok .
Did u know how to solve it ?
Coz i’m in the same situation

Nope, I didn’t find any solution … I deleted the site site1.local , then run bench update again and this are going well and permits to finishing the update, after this I’m going to create a new site and start over again …

If you have the exactly same error, you could try adding the row ‘restrict_to_domain’ VARCHAR(40) to the table tabDocType of your sites or try with the site of the error … (in my case, site1.local) … I think MAYBE this can fix the problem.
Let me know if it works.

Regards

1 Like

that works

thank you

i`v added that column and update worked perfectly

Ohh, Great!!!

Nice to know!!!

Maybe we can make as solved this post.

Regards

Thanks @anibal.duardo!!

U Welcome @dirkvdl16!! I glad to see that my problem and solution is useful to others!

1 Like

After running ALTER TABLE tabDocType ADD COLUMN restrict_to_domain VARCHAR(40); be sure to run bench update again to continue the installation