v12.x.x-develop
created a custom app, then created a module that contains different DocTypes. I can’t add the module or any of the DocTypes to a new desk,but I can still access using search bar
v12.x.x-develop
created a custom app, then created a module that contains different DocTypes. I can’t add the module or any of the DocTypes to a new desk,but I can still access using search bar
You have to add module_name.py file in config folder of your custom app and need to update desktop.py file
pls refer frappe or erpnext config folder.
Yes, I have created py file with the exact module name,
While clicking the Module button its show blank
These issue raising only after a recent frappe update
Look at your JS console. There might be a hint.
the only doctype is not appearing, All report type is showing in the module.
Console result is
Download the Vue Devtools extension for a better development experience:
libs.min.js?ver=1580395552.0:9254
You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at Production Deployment — Vue.js
just run
bench migrate
bench clear-cache
bench restart
done, but not worked
Are you using Frappe as a framework to build something or use ERPNext?
From your screenshot looks like you have not installed ERPNext on the site, if that is what you are looking to use.
s, I have created a custom app using frappe framework.
share your module.py code?
from __future__ import unicode_literals
from frappe import _
import frappe
def get_data():
return [
{
"label": _("Master"),
"icon": "octicon octicon-briefcase",
"items": [
{
"type": "doctype",
"name": "Projects",
"label": _("Projects"),
},
{
"type": "doctype",
"name": "Ledger",
"label": _("Ledger"),
"description": _("Ledger ."),
},
{
"type": "doctype",
"name": "Site No",
"label": _("Site No"),
"description": _("Site Information."),
},
]
},
{
"label": _("Transaction"),
"icon": "octicon octicon-briefcase",
"items": [
{
"type": "doctype",
"name": "Labour Measurement Entry",
"label": _("Labour Measurement Entry"),
"icon": "octicon octicon-briefcase",
"description": _("Information about labour work."),
},
]
},
{
"label": _("Report"),
"icon": "octicon octicon-briefcase",
"items": [
{
"type": "report",
"is_query_report": True,
"name": "Labour Measurement Register",
"reference_doctype": "Labour Measurement Entry"
},
]
}
]
Try this format instead
from future import unicode_literals
from frappe import _
import frappe
def get_data():
config = [
{
"label": _("Master"),
"icon": "octicon octicon-briefcase",
"items": [
{
"type": "doctype",
"name": "Projects",
"label": _("Projects"),
},
{
"type": "doctype",
"name": "Ledger",
"label": _("Ledger"),
"description": _("Ledger ."),
},
{
"type": "doctype",
"name": "Site No",
"label": _("Site No"),
"description": _("Site Information."),
},
]
},
{
"label": _("Transaction"),
"icon": "octicon octicon-briefcase",
"items": [
{
"type": "doctype",
"name": "Labour Measurement Entry",
"label": _("Labour Measurement Entry"),
"icon": "octicon octicon-briefcase",
"description": _("Information about labour work."),
},
]
},
{
"label": _("Report"),
"icon": "octicon octicon-briefcase",
"items": [
{
"type": "report",
"is_query_report": True,
"name": "Labour Measurement Register",
"reference_doctype": "Labour Measurement Entry"
},
]
}
]
return config
Cheers
I tried this code, Report link is appearing, doctype link is not appearing.
How about this?
from future import unicode_literals
from frappe import _
import frappe
def get_data():
config = [
{
"label": _("Master"),
"icon": "octicon octicon-briefcase",
"items": [
{
"type": "doctype",
"name": "Projects",
},
{
"type": "doctype",
"name": "Ledger",
"description": _("Ledger"),
},
{
"type": "doctype",
"name": "Site No",
"description": _("Site Information"),
},
]
},
{
"label": _("Transaction"),
"icon": "octicon octicon-briefcase",
"items": [
{
"type": "doctype",
"name": "Labour Measurement Entry",
"icon": "octicon octicon-briefcase",
"description": _("Information about labour work"),
},
]
},
{
"label": _("Report"),
"icon": "octicon octicon-briefcase",
"items": [
{
"type": "report",
"is_query_report": True,
"name": "Labour Measurement Register",
"reference_doctype": "Labour Measurement Entry"
},
]
}
]
return config
I have changed
frappe/frappe/desk/ moduleview.py
def filter_by_restrict_to_domain(data):
""" filter Pages and DocType depending on the Active Module(s) """
mapper = {
"page": "Page",
"doctype": "DocType"
}
active_domains = frappe.get_active_domains()
for d in data:
_items = []
for item in d.get("items", []):
doctype = mapper.get(item.get("type"))
doctype_domain = frappe.db.get_value(doctype, item.get("name"), "restrict_to_domain") or ''
if not doctype_domain or (doctype_domain in active_domains):
_items.append(item)
d.update({ "items": _items })
return data
Now Working
This must be co-incidental.
The problem is the cache is not reloading
I have seen that below commands always help:
bench console
In [1]: from frappe.cache_manager import build_domain_restriced_doctype_cache
In [2]: build_domain_restriced_doctype_cache()
Thank u for your reply, problem solved