Selective display of sales order ilne buttons

This commit is contained in:
Oliver Walters 2020-04-24 17:18:18 +10:00
parent 429bb688d0
commit 41a4033427

View File

@ -85,12 +85,14 @@ $("#so-lines-table").inventreeTable({
field: 'buttons',
title: 'Actions',
formatter: function(value, row, index, field) {
var html = "<div class='btn-group float-right' role='group'>";
var pk = row.pk;
{% if order.status == SalesOrderStatus.PENDING %}
html += makeIconButton('fa-edit', 'button-allocation-edit', pk, '{% trans "Edit stock allocation" %}');
html += makeIconButton('fa-trash-alt', 'button-allocation-delete', pk, '{% trans "Delete stock allocation" %}');
{% endif %}
html += "</div>";
@ -177,7 +179,8 @@ $("#so-lines-table").inventreeTable({
var html = `<div class='btn-group float-right' role='group'>`;
var pk = row.pk;
{% if order.status == SalesOrderStatus.PENDING %}
if (row.part) {
var part = row.part_detail;
@ -189,13 +192,14 @@ $("#so-lines-table").inventreeTable({
html += makeIconButton('fa-tools', 'button-build', row.part, '{% trans "Build parts" %}');
}
html += makeIconButton('fa-plus', 'button-add', pk, '{% trans "Allocate parts" %}');
html += makeIconButton('fa-plus', 'button-add', pk, '{% trans "Allocate parts" %}');
}
html += makeIconButton('fa-edit', 'button-edit', pk, '{% trans "Edit line item" %}');
html += makeIconButton('fa-trash-alt', 'button-delete', pk, '{% trans "Delete line item " %}');
{% endif %}
html += `</div>`;
return html;