From e746ca6e0a2f8f1c47fce6b05251548faad7eb62 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 7 May 2018 18:16:05 +1000 Subject: [PATCH] Paginate company page --- InvenTree/company/templates/company/index.html | 1 + InvenTree/stock/models.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html index 55ce09c72d..0409d13c73 100644 --- a/InvenTree/company/templates/company/index.html +++ b/InvenTree/company/templates/company/index.html @@ -34,6 +34,7 @@ $("#company-table").bootstrapTable({ sortable: true, search: true, + pagination: true, columns: [ { field: 'pk', diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 0ca86315f9..0c55f452c7 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -79,6 +79,11 @@ class StockItem(models.Model): # TODO - Find a test than can be perfomed... pass + if self.belongs_to and self.belongs_to.pk == self.pk: + raise ValidationError({ + 'belongs_to': _('Item cannot belong to itself') + }) + # Serial number cannot be set for items with quantity greater than 1 if not self.quantity == 1 and self.serial: raise ValidationError({