mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 11:10:54 +00:00
Forms actions fix (#6493)
* Handle case where OPTIONS.actions is not present * Specify stock.change permission * Hide table button based on user permission * Fix for permission check class
This commit is contained in:
@ -346,7 +346,11 @@ function constructForm(url, options={}) {
|
||||
getApiEndpointOptions(url, function(OPTIONS) {
|
||||
|
||||
// Copy across entire actions struct
|
||||
options.actions = OPTIONS.actions.POST || OPTIONS.actions.PUT || OPTIONS.actions.PATCH || OPTIONS.actions.DELETE || {};
|
||||
if (OPTIONS && OPTIONS.actions) {
|
||||
options.actions = OPTIONS.actions.POST || OPTIONS.actions.PUT || OPTIONS.actions.PATCH || OPTIONS.actions.DELETE || {};
|
||||
} else {
|
||||
options.actions = {};
|
||||
}
|
||||
|
||||
// Extract any custom 'context' information from the OPTIONS data
|
||||
options.context = OPTIONS.context || {};
|
||||
|
@ -3101,11 +3101,14 @@ function loadInstalledInTable(table, options) {
|
||||
field: 'buttons',
|
||||
title: '',
|
||||
switchable: false,
|
||||
visible: options.can_edit,
|
||||
formatter: function(value, row) {
|
||||
let pk = row.pk;
|
||||
let html = '';
|
||||
|
||||
html += makeIconButton('fa-unlink', 'button-uninstall', pk, '{% trans "Uninstall Stock Item" %}');
|
||||
if (options.can_edit) {
|
||||
html += makeIconButton('fa-unlink', 'button-uninstall', pk, '{% trans "Uninstall Stock Item" %}');
|
||||
}
|
||||
|
||||
return wrapButtons(html);
|
||||
}
|
||||
|
Reference in New Issue
Block a user