Try ERPNext Buy Support Partners Foundation

Adding new menu link in module

I am writing my own module right now.
I have seen that If i want to overwrite the original “page-menu” on the left side, i have to do it in the config folder f.e. like in apps/erpnext/erpnext/config/selling.py
I only want to add one additional Menu-Link.
Do I have to overwrite everything like in selling.py ?
and when yes, is it possible to read out or export the original already generated Menu-List ?

Thank you
tobias

Yes, you have to write a complete file. AFAIK, there is no way to read out existing structure.

In your app, create selling.py and add your link. Your links will be appended to the selling menu page.

1 Like

Is it possible not to append but to replace the whole menu ?

Also trying to do this

@rmehta, Does this method still work?

I see there was an issue with the approach here - How to custom doctype in Link Cards of core Modules

There should be a hook to redirect config file to a custom one :slight_smile:

1 Like

I’ve found the solution after a short bit trial and error.

I copied Accounts.py to my app and only retained the columns and specific doctype links I wanted to add. To ensure I linked the right doctypes, I had to add the link argument as well. Here’s my final Accounts.py in my custom app:

from __future__ import unicode_literals
from frappe import _

import frappe

def get_data():
    config = [
        {

            "label": _("General Ledger"),

            "items": [
                {
                    "type": "doctype",
                    "name": "Expense Entry",
                    "description": _("Capture Expenses"),
                    "link": "List/Expense Entry/Link"
                }
            ]
        },

        {

            "label": _("Reports"),
            "items": [
                {
                    "type": "report",
                    "is_query_report": True,
                    "name": "Expenses Register",
                    "doctype": "Expense Entry",
                    "link": "List/Expense Entry/Report/Expenses Register"
                }
            ]
        }

    ]

    return config

This gave me these links in the Accounting Module:

1 Like

Yes, that was how to append the custom menu to standard ones.

But to replace…??