How to push custom fields to standard doctypes in custom App?


I would like to know if it is possible to push custom fields to Standard doctypes of erpnext from a custom app.

I am trying to prepare an app where there are certain custom fields in the Address doctype would be added if a person installs the app.

I know making new docs is possible but is it possible to push the custom fields through the app and how, it seems that this kind of thing is not explicitly explained in the help files.

1 Like
  • add:

fixtures = ["Custom Field"]

  • do bench frappe --export_fixtures

The Custom FIelds will become a part of your app.

1 Like

I am sorry to bother you again but could you be more descriptive in the explanation since I am not a seasoned developer and hence I can’t seem to find a way to add the custom fields.

I have added the line fixtures = ["doctype: 'Address'"] in my

When I run the command bench frappe --export_fixtures I am getting the following error:

`Exporting doctype: 'Address'
Traceback (most recent call last):
  File "/home/aditya/frappe-bench/env/bin/frappe", line 9, in <module>
    load_entry_point('frappe==4.4.4', 'console_scripts', 'frappe')()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 53, in main
    return run(fn, parsed_args)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 83, in run
    out = globals().get(fn)(**args)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 67, in new_fn
    return fn(*args, **new_kwargs)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 669, in export_fixtures
  File "/home/aditya/frappe-bench/apps/frappe/frappe/utils/", line 31, in export_fixtures
    export_csv(fixture, frappe.get_app_path(app, "fixtures", frappe.scrub(fixture) + ".csv"))
  File "/home/aditya/frappe-bench/apps/frappe/frappe/core/page/data_import_tool/", line 40, in export_csv
    get_template(doctype=doctype, all_doctypes="Yes", with_data="Yes")
  File "/home/aditya/frappe-bench/apps/frappe/frappe/core/page/data_import_tool/", line 24, in get_template
    for df in frappe.get_meta(doctype).get_table_fields():
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 356, in get_meta
    return frappe.model.meta.get_meta(doctype, cached=cached)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/", line 18, in get_meta
    return frappe.cache().get_value("meta:" + doctype, lambda: Meta(doctype))
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 21, in get_value
    val = builder()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/", line 18, in <lambda>
    return frappe.cache().get_value("meta:" + doctype, lambda: Meta(doctype))
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/", line 49, in __init__
    super(Meta, self).__init__("DocType", doctype)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/", line 66, in __init__
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/", line 54, in load_from_db
    super(Meta, self).load_from_db()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/model/", line 96, in load_from_db
    frappe.throw(_("{0} {1} not found").format(_(self.doctype),, frappe.DoesNotExistError)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 202, in throw
    msgprint(msg, raise_exception=exc)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 199, in msgprint
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 183, in _raise_exception
    raise raise_exception, msg
frappe.exceptions.DoesNotExistError: DocType doctype: 'Address' not found`

will add custom fields to your app so that when you install the app, custom fields will be setup

My bad

I was trying with the custom field names and other thing, read too much into your post.

Thanks for the help.