### Information about bug
On fairly new install I've tried to create a new inve…ntory dimension for a Storage Bin. On creation I chose to create a new Storage Bin DocType which is checked to be custom, with single data field of storage_bin_number name and Storage Bin Number label. The field is mandatory and unique. Length is 12. When created I got sent back to the inventory dimension I was creating and when I clicked "apply to all inventory documents" I get an error message.
Message
Fetch From for field stock_uom is invalid: stock_item_code.stock_uom. Link field stock_item_code not found.
I then decided to remove the "apply to all inventory documents" flag and instead in field for "apply to document" I typed item and then went through each item on the list and tried to apply. All worked except "Asset Capitalization Stock Item" which through the above error message instantly. This would at least seem to be the source of the error, or at least one source of the error.
Issue exists on both and Developer and Production mode.
### Module
stock
### Version
Frappe: 15.16.1
ERPNext: 15.15.0
### Installation method
easy-install
### Relevant log output / Stack trace / Full Error Message.
```shell
Message
Fetch From for field stock_uom is invalid: stock_item_code.stock_uom. Link field stock_item_code not found.
Develper mode console traceback output:
06:57:35 web.1 | 127.0.0.1 - - [01/Mar/2024 06:57:35] "POST /api/method/frappe.desk.form.save.savedocs HTTP/1.1" 417 -
06:59:22 web.1 | Traceback (most recent call last):
06:59:22 web.1 | File "apps/frappe/frappe/app.py", line 110, in application
06:59:22 web.1 | response = frappe.api.handle(request)
06:59:22 web.1 | File "apps/frappe/frappe/api/__init__.py", line 49, in handle
06:59:22 web.1 | data = endpoint(**arguments)
06:59:22 web.1 | File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
06:59:22 web.1 | return frappe.handler.handle()
06:59:22 web.1 | File "apps/frappe/frappe/handler.py", line 49, in handle
06:59:22 web.1 | data = execute_cmd(cmd)
06:59:22 web.1 | File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
06:59:22 web.1 | return frappe.call(method, **frappe.form_dict)
06:59:22 web.1 | File "apps/frappe/frappe/__init__.py", line 1697, in call
06:59:22 web.1 | return fn(*args, **newargs)
06:59:22 web.1 | File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
06:59:22 web.1 | return func(*args, **kwargs)
06:59:22 web.1 | File "apps/frappe/frappe/desk/form/save.py", line 39, in savedocs
06:59:22 web.1 | doc.save()
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 331, in save
06:59:22 web.1 | return self._save(*args, **kwargs)
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 353, in _save
06:59:22 web.1 | return self.insert()
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 309, in insert
06:59:22 web.1 | self.run_post_save_methods()
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 1121, in run_post_save_methods
06:59:22 web.1 | self.run_method("on_update")
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 955, in run_method
06:59:22 web.1 | out = Document.hook(fn)(self, *args, **kwargs)
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 1315, in composer
06:59:22 web.1 | return composed(self, method, *args, **kwargs)
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 1297, in runner
06:59:22 web.1 | add_to_return_value(self, fn(self, *args, **kwargs))
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 952, in fn
06:59:22 web.1 | return method_object(*args, **kwargs)
06:59:22 web.1 | File "apps/erpnext/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py", line 148, in on_update
06:59:22 web.1 | self.add_custom_fields()
06:59:22 web.1 | File "apps/erpnext/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py", line 226, in add_custom_fields
06:59:22 web.1 | create_custom_fields(custom_fields)
06:59:22 web.1 | File "apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 326, in create_custom_fields
06:59:22 web.1 | create_custom_field(doctype, df, ignore_validate=ignore_validate)
06:59:22 web.1 | File "apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 292, in create_custom_field
06:59:22 web.1 | custom_field.insert()
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 309, in insert
06:59:22 web.1 | self.run_post_save_methods()
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 1121, in run_post_save_methods
06:59:22 web.1 | self.run_method("on_update")
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 955, in run_method
06:59:22 web.1 | out = Document.hook(fn)(self, *args, **kwargs)
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 1315, in composer
06:59:22 web.1 | return composed(self, method, *args, **kwargs)
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 1297, in runner
06:59:22 web.1 | add_to_return_value(self, fn(self, *args, **kwargs))
06:59:22 web.1 | File "apps/frappe/frappe/model/document.py", line 952, in fn
06:59:22 web.1 | return method_object(*args, **kwargs)
06:59:22 web.1 | File "apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 206, in on_update
06:59:22 web.1 | validate_fields_for_doctype(self.dt)
06:59:22 web.1 | File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1181, in validate_fields_for_doctype
06:59:22 web.1 | validate_fields(meta)
06:59:22 web.1 | File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1668, in validate_fields
06:59:22 web.1 | check_fetch_from(d)
06:59:22 web.1 | File "apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1617, in check_fetch_from
06:59:22 web.1 | frappe.throw(
06:59:22 web.1 | File "apps/frappe/frappe/__init__.py", line 593, in throw
06:59:22 web.1 | msgprint(
06:59:22 web.1 | File "apps/frappe/frappe/__init__.py", line 565, in msgprint
06:59:22 web.1 | _raise_exception()
06:59:22 web.1 | File "apps/frappe/frappe/__init__.py", line 516, in _raise_exception
06:59:22 web.1 | raise exc
06:59:22 web.1 | frappe.exceptions.ValidationError: Fetch From for field stock_uom is invalid: stock_item_code.stock_uom. Link field stock_item_code not found.
```