mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	fix trailing
This commit is contained in:
		| @@ -65,7 +65,7 @@ def reverse_association(apps, schema_editor):  # pragma: no cover | ||||
|  | ||||
|         # Now extract the "name" for the manufacturer | ||||
|         response = cursor.execute(f"SELECT name from company_company where id={manufacturer_id};") | ||||
|          | ||||
|  | ||||
|         row = cursor.fetchone() | ||||
|  | ||||
|         name = row[0] | ||||
| @@ -77,7 +77,7 @@ def reverse_association(apps, schema_editor):  # pragma: no cover | ||||
| def associate_manufacturers(apps, schema_editor): | ||||
|     """ | ||||
|     This migration is the "middle step" in migration of the "manufacturer" field for the SupplierPart model. | ||||
|      | ||||
|  | ||||
|     Previously the "manufacturer" field was a simple text field with the manufacturer name. | ||||
|     This is quite insufficient. | ||||
|     The new "manufacturer" field is a link to Company object which has the "is_manufacturer" parameter set to True | ||||
| @@ -87,7 +87,7 @@ def associate_manufacturers(apps, schema_editor): | ||||
|  | ||||
|     It uses fuzzy pattern matching to help the user out as much as possible. | ||||
|     """ | ||||
|      | ||||
|  | ||||
|     def get_manufacturer_name(part_id): | ||||
|         """ | ||||
|         THIS IS CRITICAL! | ||||
| @@ -149,7 +149,7 @@ def associate_manufacturers(apps, schema_editor): | ||||
|  | ||||
|             return True | ||||
|  | ||||
|         # Have we already mapped this  | ||||
|         # Have we already mapped this | ||||
|         if name in links.keys():  # pragma: no cover | ||||
|             print(" - Part[{pk}]: Mapped '{n}' - manufacturer <{c}>".format(pk=part_id, n=name, c=links[name])) | ||||
|  | ||||
| @@ -178,7 +178,7 @@ def associate_manufacturers(apps, schema_editor): | ||||
|         links[company_name] = manufacturer.pk | ||||
|  | ||||
|         companies[company_name] = manufacturer.pk | ||||
|          | ||||
|  | ||||
|         print(" - Part[{pk}]: Created new manufacturer: '{name}'".format(pk=part_id, name=company_name)) | ||||
|  | ||||
|         # Update SupplierPart object in the database | ||||
| @@ -228,9 +228,9 @@ def associate_manufacturers(apps, schema_editor): | ||||
|         # Present a list of options | ||||
|         if not TESTING:  # pragma: no cover | ||||
|             print("----------------------------------") | ||||
|      | ||||
|  | ||||
|         print("Checking part [{pk}] ({idx} of {total})".format(pk=part_id, idx=idx+1, total=total)) | ||||
|      | ||||
|  | ||||
|         if not TESTING:  # pragma: no cover | ||||
|             print("Manufacturer name: '{n}'".format(n=name)) | ||||
|             print("----------------------------------") | ||||
| @@ -293,7 +293,7 @@ def associate_manufacturers(apps, schema_editor): | ||||
|                 if not response or len(response) == 0: | ||||
|                     # Response cannot be empty! | ||||
|                     print("Please select an option") | ||||
|                  | ||||
|  | ||||
|                 # Double-check if the typed name corresponds to an existing item | ||||
|                 elif response in companies.keys(): | ||||
|                     link_part(part, companies[response]) | ||||
| @@ -334,7 +334,7 @@ def associate_manufacturers(apps, schema_editor): | ||||
|     results = cursor.fetchall() | ||||
|  | ||||
|     part_count = len(results) | ||||
|      | ||||
|  | ||||
|     # Create a unique set of manufacturer names | ||||
|     for index, row in enumerate(results): | ||||
|         pk, MPN, SKU, manufacturer_id, manufacturer_name = row | ||||
|   | ||||
| @@ -32,7 +32,7 @@ def migrate_currencies(apps, schema_editor): | ||||
|  | ||||
|     # The 'suffix' field denotes the currency code | ||||
|     response = cursor.execute('SELECT id, suffix, description from common_currency;') | ||||
|      | ||||
|  | ||||
|     results = cursor.fetchall() | ||||
|  | ||||
|     remap = {} | ||||
| @@ -56,7 +56,7 @@ def migrate_currencies(apps, schema_editor): | ||||
|  | ||||
|     # Now iterate through each SupplierPriceBreak and update the rows | ||||
|     response = cursor.execute('SELECT id, cost, currency_id, price, price_currency from part_supplierpricebreak;') | ||||
|      | ||||
|  | ||||
|     results = cursor.fetchall() | ||||
|  | ||||
|     count = 0 | ||||
| @@ -92,7 +92,7 @@ def reverse_currencies(apps, schema_editor):  # pragma: no cover | ||||
|  | ||||
|     # Extract a list of currency codes which are in use | ||||
|     response = cursor.execute(f'SELECT id, price, price_currency from part_supplierpricebreak;') | ||||
|      | ||||
|  | ||||
|     results = cursor.fetchall() | ||||
|  | ||||
|     codes_in_use = set() | ||||
| @@ -123,7 +123,7 @@ def reverse_currencies(apps, schema_editor):  # pragma: no cover | ||||
|  | ||||
|             # Create a new object in the database | ||||
|             print(f"Creating new Currency object for {code}") | ||||
|          | ||||
|  | ||||
|             # Construct a query to create a new Currency object | ||||
|             query = f'INSERT into common_currency (symbol, suffix, description, value, base) VALUES ("$", "{code}", "{description}", 1.0, False);' | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ def supplierpart_make_manufacturer_parts(apps, schema_editor): | ||||
|     SupplierPart = apps.get_model('company', 'SupplierPart') | ||||
|  | ||||
|     supplier_parts = SupplierPart.objects.all() | ||||
|      | ||||
|  | ||||
|     if supplier_parts: | ||||
|         print(f'\nCreating ManufacturerPart Objects\n{"-"*10}') | ||||
|         for supplier_part in supplier_parts: | ||||
| @@ -23,7 +23,7 @@ def supplierpart_make_manufacturer_parts(apps, schema_editor): | ||||
|             if not part:  # pragma: no cover | ||||
|                 print(f'[ERROR: SUPPLIER PART IS NOT CONNECTED TO PART]') | ||||
|                 continue | ||||
|              | ||||
|  | ||||
|             manufacturer = supplier_part.manufacturer | ||||
|             MPN = supplier_part.MPN | ||||
|             link = supplier_part.link | ||||
| @@ -31,7 +31,7 @@ def supplierpart_make_manufacturer_parts(apps, schema_editor): | ||||
|  | ||||
|             if manufacturer or MPN: | ||||
|                 print(f' | {part.name[:15].ljust(15)}', end='') | ||||
|                  | ||||
|  | ||||
|                 try: | ||||
|                     print(f' | {manufacturer.name[:15].ljust(15)}', end='') | ||||
|                 except AttributeError: | ||||
| @@ -73,12 +73,12 @@ def supplierpart_populate_manufacturer_info(apps, schema_editor):  # pragma: no | ||||
|     SupplierPart = apps.get_model('company', 'SupplierPart') | ||||
|  | ||||
|     supplier_parts = SupplierPart.objects.all() | ||||
|      | ||||
|  | ||||
|     if supplier_parts: | ||||
|         print(f'\nSupplierPart: Populating Manufacturer Information\n{"-"*10}') | ||||
|         for supplier_part in supplier_parts: | ||||
|             print(f'{supplier_part.supplier.name[:15].ljust(15)} | {supplier_part.SKU[:15].ljust(15)}\t', end='') | ||||
|              | ||||
|  | ||||
|             manufacturer_part = supplier_part.manufacturer_part | ||||
|  | ||||
|             if manufacturer_part: | ||||
| @@ -89,13 +89,13 @@ def supplierpart_populate_manufacturer_info(apps, schema_editor):  # pragma: no | ||||
|                     supplier_part.MPN = manufacturer_part.MPN | ||||
|  | ||||
|                 supplier_part.save() | ||||
|                  | ||||
|  | ||||
|                 print(f'[SUCCESS: UPDATED MANUFACTURER INFO]') | ||||
|             else: | ||||
|                 print(f'[IGNORED: NO MANUFACTURER PART]') | ||||
|  | ||||
|         print(f'{"-"*10}\nDone\n') | ||||
|                  | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|   | ||||
| @@ -90,7 +90,7 @@ | ||||
|                             </a></li> | ||||
|                             {% endif %} | ||||
|                         </ul> | ||||
|                     </div>  | ||||
|                     </div> | ||||
|                     {% include "filter_list.html" with id="manufacturer-part" %} | ||||
|                 </div> | ||||
|             </div> | ||||
| @@ -172,9 +172,9 @@ | ||||
|                 {% include "filter_list.html" with id="customerstock" %} | ||||
|             </div> | ||||
|         </div> | ||||
|          | ||||
|  | ||||
|         <table class='table table-striped table-condensed' id='assigned-stock-table' data-toolbar='#assigned-stock-button-toolbar'></table> | ||||
|          | ||||
|  | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| @@ -313,7 +313,7 @@ | ||||
|         var selections = $("#manufacturer-part-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|         deleteManufacturerParts(selections, { | ||||
|             onSuccess: function() {  | ||||
|             onSuccess: function() { | ||||
|                 $("#manufacturer-part-table").bootstrapTable("refresh"); | ||||
|             } | ||||
|         }); | ||||
| @@ -378,10 +378,10 @@ | ||||
|                 accept: function() { | ||||
|                     selections.forEach(function(part) { | ||||
|                         var url = `/api/company/part/${part.pk}/`; | ||||
|              | ||||
|  | ||||
|                         requests.push(inventreeDelete(url)); | ||||
|                     }); | ||||
|              | ||||
|  | ||||
|                     $.when.apply($, requests).done(function() { | ||||
|                         $('#supplier-part-table').bootstrapTable('refresh'); | ||||
|                     }); | ||||
| @@ -412,4 +412,4 @@ | ||||
|  | ||||
|     enableSidebar('company'); | ||||
|  | ||||
| {% endblock %} | ||||
| {% endblock %} | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| {% load inventree_extras %} | ||||
|  | ||||
| {% block page_title %} | ||||
| {% inventree_title %} | {% trans "Supplier List" %}  | ||||
| {% inventree_title %} | {% trans "Supplier List" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| @@ -23,11 +23,11 @@ | ||||
| {% block page_info %} | ||||
|  | ||||
| <div class='panel-content'> | ||||
|      | ||||
|  | ||||
|     <div id='button-toolbar'> | ||||
|         {% include "filter_list.html" with id='company' %} | ||||
|     </div> | ||||
|      | ||||
|  | ||||
|     <table class='table table-striped table-condensed' id='company-table' data-toolbar='#button-toolbar'> | ||||
|     </table> | ||||
| </div> | ||||
| @@ -59,4 +59,4 @@ | ||||
|         } | ||||
|     ); | ||||
|  | ||||
| {% endblock %} | ||||
| {% endblock %} | ||||
|   | ||||
| @@ -137,7 +137,7 @@ src="{% static 'img/blank_image.png' %}" | ||||
|                 {% include "filter_list.html" with id='supplier-part' %} | ||||
|             </div> | ||||
|         </div> | ||||
|          | ||||
|  | ||||
|         <table class="table table-striped table-condensed" id='supplier-table' data-toolbar='#supplier-button-toolbar'> | ||||
|         </table> | ||||
|     </div> | ||||
| @@ -267,10 +267,10 @@ $("#supplier-part-delete").click(function() { | ||||
|             accept: function() { | ||||
|                 selections.forEach(function(part) { | ||||
|                     var url = `/api/company/part/${part.pk}/`; | ||||
|          | ||||
|  | ||||
|                     requests.push(inventreeDelete(url)); | ||||
|                 }); | ||||
|          | ||||
|  | ||||
|                 $.when.apply($, requests).done(function() { | ||||
|                     reloadSupplierPartTable(); | ||||
|                 }); | ||||
| @@ -295,7 +295,7 @@ $("#multi-parameter-delete").click(function() { | ||||
|     text += ` | ||||
|         </ul> | ||||
|     </div>`; | ||||
|      | ||||
|  | ||||
|     showQuestionDialog( | ||||
|         '{% trans "Delete Parameters" %}', | ||||
|         text, | ||||
| @@ -353,7 +353,7 @@ $('#order-part, #order-part2').click(function() { | ||||
|         '{% url "api-part-detail" part.part.pk %}', {}, | ||||
|         { | ||||
|             success: function(response) { | ||||
|                  | ||||
|  | ||||
|                 orderParts([response], { | ||||
|                     manufacturer_part: {{ part.pk }}, | ||||
|                     {% if part.manufacturer %} | ||||
| @@ -389,4 +389,4 @@ $('#delete-part').click(function() { | ||||
|  | ||||
| enableSidebar('manufacturerpart'); | ||||
|  | ||||
| {% endblock %} | ||||
| {% endblock %} | ||||
|   | ||||
| @@ -165,7 +165,7 @@ src="{% static 'img/blank_image.png' %}" | ||||
|                 <button class='btn btn-primary' type='button' id='order-part2' title='{% trans "Order part" %}'> | ||||
|                     <span class='fas fa-shopping-cart'></span> {% trans "Order Part" %} | ||||
|                 </button> | ||||
|                 {% endif %}         | ||||
|                 {% endif %} | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
| @@ -198,7 +198,7 @@ src="{% static 'img/blank_image.png' %}" | ||||
|         <div id='price-break-toolbar' class='btn-group'> | ||||
|         </div> | ||||
|  | ||||
|         <table class='table table-striped table-condensed' id='price-break-table' data-toolbar='#price-break-toolbar'>     | ||||
|         <table class='table table-striped table-condensed' id='price-break-table' data-toolbar='#price-break-toolbar'> | ||||
|         </table> | ||||
|     </div> | ||||
| </div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user