Could not find Default Item Group: Products

You mean you updated your production server without testing the update? You might want to change your update protocols.

Can you restore then add Products back into the Item Group Tree?

It’s just a test environment. Not in production yet. :wink:

LOL. That is a relief!

@AnthonyVV try this:

$ cd ~/frappe-bench/
$ bench --site sitename console

$ doc = frappe.new_doc("Item Group")
$ doc.update({
    "item_group_name": "Products",
    "parent_item_group": "All Item Groups",
    "is_group": 0
})

$ doc.insert()
$ frappe.db.commit() # commit your changes to the DB

It should be done from the server console. Let me know if anything goes wrong!

4 Likes

Thank you @yefritavarez! It worked! :smile:

Hi!,

I have the same error but with the Warehouse!.. Could you help me please ? i tried this but before the last part i have an error:

In [5]: doc.insert()

MandatoryError Traceback (most recent call last)
/frappe-bench/apps/frappe/frappe/commands/utils.pyc in ()
----> 1 doc.insert()

/frappe-bench/apps/frappe/frappe/model/document.pyc in insert(self, ignore_permissions, ignore_if_duplicate, ignore_mandatory)
217 self._validate_links()
218 self.run_before_save_methods()
→ 219 self._validate()
220 self.set_docstatus()
221 self.flags.in_insert = False

/frappe-bench/apps/frappe/frappe/model/document.pyc in _validate(self)
434
435 def _validate(self):
→ 436 self._validate_mandatory()
437 self._validate_selects()
438 self._validate_constants()

/frappe-bench/apps/frappe/frappe/model/document.pyc in _validate_mandatory(self)
653 fields=", ".join((each[0] for each in missing)),
654 doctype=self.doctype,
→ 655 name=self.name))
656
657 def _validate_links(self):

MandatoryError: [Warehouse, a9131d32cf]: warehouse_name, company

@yefritavarez could you help me please ?

Hi @gvargas,

You need to check what are the mandatory fields in the form.

It says that you’re missing two fields in the document. Fill them up with valid data and try again.

Thank you for answer me first of all.

i try this:

$ doc.update({
“item_group_name”: “Products”,
“parent_item_group”: “All Item Groups”,
“is_group”: 0
})

So… in the i put in this way this “item_group_name”: “Products”, → “item_group_name”: “Sucursales - VC”,

i don’t know if i need put in this way then: “item_group_name”: “Sucursales, VC”

do you agree ? i couldn’t view what are the mandatory field because i can’t run the erp it says “UPDATING”

I’m confused now.

Are you trying to add a new Item Group record or a Warehouse one @gvargas?

Hi @yefritavarez,

I also have the same problem while updating, the error is:
frappe.exceptions.LinkValidationError: Could not find Parent Item Group: All Item Groups.

When I try with the console, it replied with the same error.

Thank you

Sorry @yefritavarez, i try to explain me…

When i try to update this is the error that i had:

Migrating erp.local
Executing execute:frappe.get_single(‘Domain Settings’).save() in erp.local (c6d2cec0a2672282)
Traceback (most recent call last):
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/Developers/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/Developers/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/Developers/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/Developers/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/Developers/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/Developers/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/Developers/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/Developers/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/Developers/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/Developers/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/Developers/frappe-bench/apps/frappe/frappe/commands/site.py”, line 217, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/Developers/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/Developers/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/Developers/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/Developers/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 81, in execute_patch
exec(patchmodule.split(“execute:”)[1],globals())
File “”, line 1, in
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 307, in _save
self.run_post_save_methods()
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 827, in run_post_save_methods
self.run_method(“on_update”)
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 702, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 964, in composer
return composed(self, method, *args, **kwargs)
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 947, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 696, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/Developers/frappe-bench/apps/frappe/frappe/core/doctype/domain_settings/domain_settings.py”, line 20, in on_update
domain.setup_domain()
File “/Developers/frappe-bench/apps/frappe/frappe/core/doctype/domain/domain.py”, line 20, in setup_domain
self.set_values()
File “/Developers/frappe-bench/apps/frappe/frappe/core/doctype/domain/domain.py”, line 74, in set_values
doc.save()
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 289, in _save
self._validate_links()
File “/Developers/frappe-bench/apps/frappe/frappe/model/document.py”, line 671, in _validate_links
frappe.LinkValidationError)
File “/Developers/frappe-bench/apps/frappe/frappe/init.py”, line 319, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/Developers/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/Developers/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
frappe.exceptions.LinkValidationError: Could not find Default Warehouse: Sucursales - VC

So trying to repeat your solution of the other error this is what happen:

MandatoryError: [Warehouse, a9131d32cf]: warehouse_name, company

and please ignore me last post is all wrong.

Thanks for the support

@gvargas, try this:

$ cd ~/frappe-bench/
$ bench --site sitename console

$ doc = frappe.new_doc("Warehouse")
$ doc.update({
    "warehouse_name": "Sucursales - VC",
    "company": [company_name],
    "is_group": 1
})

$ doc.insert()
$ frappe.db.commit() # commit your changes to the DB

@hokgt, see in your DB what is the name of your root Item Group.

Should be the one that does not have any parent.

Hi @yefritavarez,

I have access to the db and please refer the picture below:


The parrent is NULL

My question is:

  1. What is the parent of the root Item Group?
  2. There are two Item Groups that also don’t have parent, ie. Produk and Sub Assemblies, should I update those fields also?
  3. It is a bug from ERPNext? If it is, I will submit issue in github

Thank you

I suggest not to make any changes directly to the Database as it may introduce other bugs.

I’m guessing that if those three don’t have any parent is because the system needs them that way.

Anyways, try using this one:

$ cd ~/frappe-bench/
$ bench --site sitename console

$ doc = frappe.new_doc("Item Group")
$ doc.update({
    “item_group_name”: “All Item Groups”,
    “parent_item_group”: “Semua Grup Stok Barang/Item”, # or whatever that is
    “is_group”: 1
})

$ doc.save()
$ frappe.db.commit() # commit your changes to the DB
1 Like

Hi @yefritavarez ,

The last issue was solved but now same pattern except the variable is different:

frappe.exceptions.LinkValidationError: Could not find Default Unit of Measure: Unit

Could you explain how to find the which variable name should be updated? Then if the same error occured, I can find it myself.

Thank you

Well, I usually go to the DB and see the column names which will be the same as the fieldnames for the doc. Most of the time I find myself looking a the demo site to see what are the mandatory fields for a form and also to see if it already brings any default values, so that I don’t have to do it too.

1 Like

Hi @yefritavarez

I have successfully updated ERPNext to the newest version, thank you very much!

As your explanation, I went to the database and update another record for UOM from ipython console. The database field name was translated to the localization language and bench update didn’t anticipate this. I think this is issue that should be raised on github, do you agree with me? Please correct me if I have wrong conclusion.

Totally!

Please, go ahead and do that!

This is the error I get, have tried to post the codfor creating a warehouse via console; but stuck at sitename, what’s the sitename in this case?
Thanks.

login as: root
root@erp.gagawala.com’s password:
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 2.6.32-042stab126.1 x86_64)

  • Documentation: https://help.ubuntu.com/
    Last login: Sat Mar 10 13:46:21 2018 from 154.72.192.154
    root@erp:~# bench update
    You should not run this command as root
    root@erp:~# cd /home/frappe/frappe-bench
    root@erp:/home/frappe/frappe-bench# bench update
    INFO:bench.utils:updating bench
    INFO:bench.utils:git pull
    Already up-to-date.
    remote: Counting objects: 36, done.
    remote: Compressing objects: 100% (8/8), done.
    error: insufficient permission for adding an object to repository database .git/ objects
    fatal: failed to write object
    fatal: unpack-objects failed
    remote: Counting objects: 36, done.
    remote: Compressing objects: 100% (8/8), done.
    remote: Total 36 (delta 27), reused 32 (delta 27), pack-reused 1
    error: insufficient permission for adding an object to repository database .git/ objects
    fatal: failed to write object
    fatal: unpack-objects failed
    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 (fro m Pillow)
    INFO:bench.app:pulling frappe
    INFO:bench.utils:git pull upstream master
    From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript
  • 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 GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
  • 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
    /home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/vendor/requ ests/packages/urllib3/util/ssl.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not availab le on this platform. This may cause the server to present an incorrect TLS certi ficate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.i o/en/latest/security.html#snimissingwarning.
    SNIMissingWarning
    /home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/vendor/requ ests/packages/urllib3/util/ssl.py:122: InsecurePlatformWarning: A true SSLConte xt object is not available. This prevents urllib3 from configuring SSL appropria tely and may cause certain SSL connections to fail. You can upgrade to a newer v ersion of Python to solve this. For more information, see https://urllib3.readth edocs.io/en/latest/security.html#insecureplatformwarning.
    InsecurePlatformWarning
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.tx t
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
    Updating node packages…
    INFO:bench.utils:npm install
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/ch okidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@ 1.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”} )
    npm WARN frappe@ No description
    Backing up sites…
    Patching sites…
    Migrating site1.local
    Executing erpnext.patches.v8_0.create_domain_docs #16-05-2017 in site1.loc al (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”, lin e 94, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, lin e 18, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/co re.py”, line 722, in call
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/co re.py”, line 697, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/co re.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/co re.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/co re.py”, line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/co re.py”, line 535, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/de corators.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 24, 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 31, in mi grate
    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/v8_0/create_domai n_docs.py”, line 46, in execute
    domain_settings.save(ignore_permissions=True)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 25 6, in save
    return self._save(*args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 30 7, in _save
    self.run_post_save_methods()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 88 7, in run_post_save_methods
    self.run_method(“on_update”)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 75 5, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 10 24, in composer
    return composed(self, method, *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 10 07, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 74 9, in
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/domain_setting s/domain_settings.py”, line 23, in on_update
    domain.setup_domain()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/domain/domain. py”, line 20, in setup_domain
    self.set_values()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/domain/domain. py”, line 107, in set_values
    doc.save()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 25 6, in save
    return self._save(*args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 28 9, in _save
    self._validate_links()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 72 4, in _validate_links
    frappe.LinkValidationError)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
    _raise_exception()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
    raise raise_exception(encode(msg))
    frappe.exceptions.LinkValidationError: Could not find Default Warehouse: Stores - G