From 7e7ac60a1a4c6e0222cadb115997bce18a8e0399 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 30 Apr 2019 20:55:28 +1000 Subject: [PATCH] Tweaks - Can't edit build status directly - Refresh BOM table on reload - Hide Company tabs that are not yet functional --- InvenTree/build/forms.py | 2 - InvenTree/company/templates/company/tabs.html | 4 +- InvenTree/part/templates/part/bom.html | 9 +++- InvenTree/static/script/inventree/bom.js | 46 +++++++++---------- 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/InvenTree/build/forms.py b/InvenTree/build/forms.py index cf30b3eaf9..87116c8646 100644 --- a/InvenTree/build/forms.py +++ b/InvenTree/build/forms.py @@ -23,8 +23,6 @@ class EditBuildForm(HelperForm): 'batch', 'URL', 'notes', - 'status', - # 'completion_date', ] diff --git a/InvenTree/company/templates/company/tabs.html b/InvenTree/company/templates/company/tabs.html index 4eaab521ba..4ad14f6b98 100644 --- a/InvenTree/company/templates/company/tabs.html +++ b/InvenTree/company/templates/company/tabs.html @@ -6,11 +6,13 @@ Supplier Parts {{ company.part_count }} + {% if 0 %} Purchase Orders {% endif %} - {% if company.is_customer %} + {% endif %} + {% if company.is_customer and 0 %} Sales Orders diff --git a/InvenTree/part/templates/part/bom.html b/InvenTree/part/templates/part/bom.html index 805f501dcd..c178ef455c 100644 --- a/InvenTree/part/templates/part/bom.html +++ b/InvenTree/part/templates/part/bom.html @@ -60,7 +60,14 @@ }); $("#bom-item-new").click(function () { - launchModalForm("{% url 'bom-item-create' %}?parent={{ part.id }}", {}); + launchModalForm( + "{% url 'bom-item-create' %}?parent={{ part.id }}", + { + success: function() { + $("#bom-table").bootstrapTable('refresh'); + } + } + ); }); {% else %} diff --git a/InvenTree/static/script/inventree/bom.js b/InvenTree/static/script/inventree/bom.js index cc533f5201..1107c5986a 100644 --- a/InvenTree/static/script/inventree/bom.js +++ b/InvenTree/static/script/inventree/bom.js @@ -114,22 +114,12 @@ function loadBomTable(table, options) { } ); - // Part notes - cols.push( - { - field: 'note', - title: 'Notes', - searchable: true, - sortable: false, - } - ); - if (options.editable) { cols.push({ formatter: function(value, row, index, field) { var bEdit = ""; var bDelt = ""; - + return "
" + bEdit + bDelt + "
"; } }); @@ -143,7 +133,7 @@ function loadBomTable(table, options) { sortable: true, formatter: function(value, row, index, field) { var text = ""; - + if (row.quantity < row.sub_part_detail.available_stock) { text = "" + value + ""; @@ -152,22 +142,32 @@ function loadBomTable(table, options) { { text = "" + value + ""; } - + return renderLink(text, row.sub_part.url + "stock/"); } } + ); + } + + // Part notes + cols.push( + { + field: 'note', + title: 'Notes', + searchable: true, + sortable: false, + } ); - } - // Configure the table (bootstrap-table) - - table.bootstrapTable({ - sortable: true, - search: true, - clickToSelect: true, - queryParams: function(p) { - return { - part: options.parent_id, + // Configure the table (bootstrap-table) + + table.bootstrapTable({ + sortable: true, + search: true, + clickToSelect: true, + queryParams: function(p) { + return { + part: options.parent_id, } }, columns: cols,