I have a custom doctype which I created with the Custom checkbox enabled that is attached to the Accounts module. I enabled it because it allows the Doctype to be shown in the Accounts menu. If I don’t, the only other way to expose the Doctype in the menu is to edit the accounts.py file in the config folder which I don’t really think is a good idea because that file gets updated once in awhile and I will have to stash changes before updating and subsequently reapplying my required changes.
What I found out is if I select the “Custom?” option when creating the doctype, when viewing the custom Doctype the system treats it as a “generic” document and therefore it doesn’t inherit the attributes of the class specified in the custom py files.
My question is:
- Would it be possible to have some functionality to expose Doctypes in menus without having to configure the config files whilst still treating the Doctype as a class on its own as opposed to a “generic” document?
- Would it be possible to enable “Custom?” Doctypes to inherit the attributes of the class specified in the custom py files?
You have another way to show a doctype on another module.
Make your own module and then make your doctype and associate him to your module. You can hide your module if you want to.
Then go to config folder of your module and make a python file with the name of the module that you want doctype to show.
Inside config folder of your module create an account.py file and in it put some thing like this:
from __future__ import unicode_literals
__author__ = 'luissaguas'
from frappe import _
"name": "Incidence Base",
"description": _("Incidence Base."),
You must change name and description in accordance with your module. If you want your module in Documents then change label to Documents. See config folder of erpnext to see more examples.
This way you have more control.
@luisfmfernandes thanks for the suggestion, I am aware of that option but as of now, the custom Doctype which I have needs to be in the Accounts module. Which is why I am asking if there is any option to expose the custom Doctype in the Accounts menu without having to change the config file or if the Custom? Doctypes could inherit the class.
@bohlian I have been wanting to do this sometime, to make Modules and DocTypes discoverable via the UI without changing the config file. WIll put it on my list (again)
@rmehta that would be great. Thank you.
@bohlian as @luisfmfernandes said,
you can show your Custom/Non Custom doctype in any module under any head documents/tools/setup
create new module in your app
create new doctype MyDoc
in MyDoc select your module
in your own app app/config folder, create file account.py
in account.py write code as @luisfmfernandes given here
from future import unicode_literals
author = ‘luissaguas’
from frappe import _
“name”: “Incidence Base”,
“description”: _(“Incidence Base.”),
@kolate_sambhaji, Thanks for your suggestion, I am aware of that option but I’m actually asking for an option without having to create a new app or change the config file. Looks like we may have this option soon
What is that “name - Incidence Base” you have mentioned? Also does this code affect core modules?