If you see a filename starting with ‘q’, that most likely indicates a Qt class available to xTuple ERP scripts. PS: You can find out what pieces of Qt we’ve exposed to scripting by looking at the xTuple ERP Programmer Reference, picking the xTuple ERP version you’re interested in, then following these links: Directories -> scriptapi. Tmpaction.objectName = "ms.dspBreederDistributionVariance" Tmpaction.enabled = privileges.value("ViewBreederVariances") Tmpaction = manufacturingReportsMenu.addAction(qsTranslate("menuManufacture", "Breeder &Distribution Variance")) If you want to add something to the end of an existing menu, you can skip the explicit QAction constructor and use QMenu’s addAction directly (saving only one line of typing:-): insertAction adds tmpaction to the reports menu just above the history menu, not after it manufacturingReportsHistoryMenu is a submenu of the manufacturingReportsMenu and was also set earlier in the script manufacturingReportsMenu is a QMenu object that the script set set earlier with a findChild() call the setData() call stores the privilege names so rescanning privileges will work correctly qsTranslate lets a translator change the label on the menu item (2nd argument) and gives the translator a context hint (1st argument) This creates a new action with the label “Operation Buffer Status…” and “f” as the shortcut key, sets various properties on it, connects its triggered signal to a script function, and inserts it into an existing menu. ManufacturingReportsMenu.insertAction(nuAction(), Some menu features arent readily apparent, although they work well once fully understood. Tmpaction.objectName = "wo.dspWoOperationBufrStsByWorkCenter" tData("MaintainWoOperations ViewWoOperations")
Our ERP helps manufacturing and inventory-centric companies use software tools to grow.
Tmpaction.enabled = privileges.value("MaintainWoOperations") || privileges.value("ViewWoOperations") xTuples cloud-based ERP is designed specifically for manufacturers.
Here is an excerpt from an initMenu script in one of our extension packages (xtmfg): tmpaction = new QAction(qsTranslate("menuManufacture", "Operation Buf&fer Status."), mainwindow) See Qt’s documentation for complete information on using QAction and QMenu. No, you’re not missing anything simple… You can’t do this with the Script Toolbox.įor 3.4.0 and beyond, we exposed Qt’s QAction and QMenu classes to scripting directly so we could insert menu items in appropriate places.