PEP style fixes

This commit is contained in:
Oliver Walters 2020-04-21 22:37:35 +10:00
parent b75c343236
commit 09ccd6c5e2
4 changed files with 5 additions and 6 deletions

View File

@ -90,7 +90,6 @@ class EditSalesOrderForm(HelperForm):
]
class EditPurchaseOrderAttachmentForm(HelperForm):
""" Form for editing a PurchaseOrderAttachment object """

View File

@ -19,6 +19,7 @@ import os
from datetime import datetime
from decimal import Decimal
from stock import models as stock_models
from company.models import Company, SupplierPart
from InvenTree.fields import RoundingDecimalField
@ -223,7 +224,7 @@ class PurchaseOrder(Order):
# Create a new stock item
if line.part:
stock = StockItem(
stock = stock_models.StockItem(
part=line.part.part,
supplier_part=line.part,
location=location,
@ -264,7 +265,8 @@ class SalesOrder(Order):
def get_absolute_url(self):
return reverse('so-detail', kwargs={'pk': self.id})
customer = models.ForeignKey(Company,
customer = models.ForeignKey(
Company,
on_delete=models.SET_NULL,
null=True,
limit_choices_to={'is_customer': True},

View File

@ -358,8 +358,6 @@ class SalesOrderEdit(AjaxUpdateView):
def get_form(self):
form = super().get_form()
order = self.get_object()
# Prevent user from editing customer
form.fields['customer'].widget = HiddenInput()

View File

@ -268,7 +268,7 @@ class StockItem(MPTTModel):
# the "Part" that the line item references is the same as the part that THIS references
if self.sales_order_line is not None:
if self.sales_order_line.part == None:
if self.sales_order_line.part is None:
raise ValidationError({'sales_order_line': _('Stock item cannot be assigned to a LineItem which does not reference a part')})
if not self.sales_order_line.part == self.part: