mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Annotate models with their API list view
- It will make sense, trust me
This commit is contained in:
@ -136,6 +136,10 @@ class PurchaseOrder(Order):
|
||||
target_date: Expected delivery target date for PurchaseOrder completion (optional)
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_api_url():
|
||||
return reverse('api-po-list')
|
||||
|
||||
OVERDUE_FILTER = Q(status__in=PurchaseOrderStatus.OPEN) & ~Q(target_date=None) & Q(target_date__lte=datetime.now().date())
|
||||
|
||||
@staticmethod
|
||||
@ -407,6 +411,10 @@ class SalesOrder(Order):
|
||||
target_date: Target date for SalesOrder completion (optional)
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_api_url():
|
||||
return reverse('api-so-list')
|
||||
|
||||
OVERDUE_FILTER = Q(status__in=SalesOrderStatus.OPEN) & ~Q(target_date=None) & Q(target_date__lte=datetime.now().date())
|
||||
|
||||
@staticmethod
|
||||
@ -585,6 +593,10 @@ class PurchaseOrderAttachment(InvenTreeAttachment):
|
||||
Model for storing file attachments against a PurchaseOrder object
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_api_url():
|
||||
return reverse('api-po-attachment-list')
|
||||
|
||||
def getSubdir(self):
|
||||
return os.path.join("po_files", str(self.order.id))
|
||||
|
||||
@ -596,6 +608,10 @@ class SalesOrderAttachment(InvenTreeAttachment):
|
||||
Model for storing file attachments against a SalesOrder object
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_api_url():
|
||||
return reverse('api-so-attachment-list')
|
||||
|
||||
def getSubdir(self):
|
||||
return os.path.join("so_files", str(self.order.id))
|
||||
|
||||
@ -629,6 +645,11 @@ class PurchaseOrderLineItem(OrderLineItem):
|
||||
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_api_url():
|
||||
return reverse('api-po-line-list')
|
||||
|
||||
|
||||
class Meta:
|
||||
unique_together = (
|
||||
('order', 'part')
|
||||
@ -712,6 +733,10 @@ class SalesOrderLineItem(OrderLineItem):
|
||||
sale_price: The unit sale price for this OrderLineItem
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_api_url():
|
||||
return reverse('api-so-line-list')
|
||||
|
||||
order = models.ForeignKey(SalesOrder, on_delete=models.CASCADE, related_name='lines', verbose_name=_('Order'), help_text=_('Sales Order'))
|
||||
|
||||
part = models.ForeignKey('part.Part', on_delete=models.SET_NULL, related_name='sales_order_line_items', null=True, verbose_name=_('Part'), help_text=_('Part'), limit_choices_to={'salable': True})
|
||||
@ -774,6 +799,10 @@ class SalesOrderAllocation(models.Model):
|
||||
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_api_url():
|
||||
return reverse('api-so-allocation-list')
|
||||
|
||||
class Meta:
|
||||
unique_together = [
|
||||
# Cannot allocate any given StockItem to the same line more than once
|
||||
|
Reference in New Issue
Block a user