mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add a button to create a new part if necessary
This commit is contained in:
parent
a6da3ed4a4
commit
ff5af8f217
@ -685,7 +685,7 @@ class Part(models.Model):
|
||||
- Exclude parts which this part is in the BOM for
|
||||
"""
|
||||
|
||||
parts = Part.objects.filter(component=True)
|
||||
parts = Part.objects.filter(component=True).exclude(id=self.id)
|
||||
parts = parts.exclude(id__in=[part.id for part in self.used_in.all()])
|
||||
|
||||
return parts
|
||||
|
@ -47,6 +47,10 @@
|
||||
{% for item in row.data %}
|
||||
<td>
|
||||
{% if item.column.guess == 'Part' %}
|
||||
<button class='btn btn-default btn-create' id='new_part_row_{{ row.index }}' title='Create new part' type='button'>
|
||||
<span row_id='{{ row.index }}' class='glyphicon glyphicon-small glyphicon-plus' onClick='newPartFromBomWizard()'/>
|
||||
</button>
|
||||
|
||||
<select class='select bomselect' id='id_part_{{ row.index }}' name='part_select_{{ row.index }}'>
|
||||
<option value=''>---------</option>
|
||||
{% for part in row.part_options %}
|
||||
|
@ -62,6 +62,21 @@ function removeColFromBomWizard(e) {
|
||||
}
|
||||
|
||||
|
||||
function newPartFromBomWizard(e) {
|
||||
/* Create a new part directly from the BOM wizard.
|
||||
*/
|
||||
|
||||
e = e || window.event;
|
||||
|
||||
var src = e.target || e.srcElement;
|
||||
|
||||
launchModalForm('/part/new/', {
|
||||
success: function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function loadBomTable(table, options) {
|
||||
/* Load a BOM table with some configurable options.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user