Tab system: New tab does not appear in the expected place

Hello,

I have a problem with the tab system in Dolibarr.
If I want to insert a new tab in the production orders module (MRP), it always appears in the MRP module settings (see screenshot mrp-module-settings.png) and not where it should actually be (see screenshot mrp-module.png):

$this->tabs = array(
            'mrp:+element:ProjectOverview:@mymodule:/custom/mymodule/projet/element.php?id=__ID__'
        );

Am I perhaps making a mistake? With all other modules I can insert or replace a tab at the desired position. Only with the MRP module is the tab displayed in the settings. And not in the actual module.
Can someone help me?

Thanks
Marvin

1 Like

"+element"should be the name of your custom module.

For example, if the module name is somemodule, the above code should be:

$this->tabs[] = array('data' => 'mrp:+somemodule:String for translation of the tab title:somemodule@somemodule:$user->rights->mrp->write:/somemodule/path_to_php_file?id=__ID__');  

Thanks for your answer. but the documentation says that the “+element” is the name of the tab to add and not the module name.

Adding a new tab is possible. it’s just added in the wrong place.

When I add a tab, it is not added in the MRP module but in the MRP module settings.

I have found the solution. The object type of the production orders is not mrp but mo@mrp.

so the code looks like this:

$this->tabs[] = array('data'=>'mo@mrp:-note');

anyone who wants to find out the tabname or objecttype simply has to search for “complete_head_from_modules” in the htdocs folder. there you will find in all the lib files the tab names after "$head[$h][2] = " and after the tabnames comes the object type.