2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Add "brief" version of QR codes

- Use this to render to labels (as it contains much less information)
This commit is contained in:
Oliver Walters
2020-08-16 13:29:38 +10:00
parent 2f5e3efada
commit 2bbc65cc59
4 changed files with 37 additions and 25 deletions

View File

@ -283,7 +283,7 @@ class StockItem(MPTTModel):
def get_part_name(self):
return self.part.full_name
def format_barcode(self):
def format_barcode(self, **kwargs):
""" Return a JSON string for formatting a barcode for this StockItem.
Can be used to perform lookup of a stockitem using barcode
@ -296,19 +296,14 @@ class StockItem(MPTTModel):
return helpers.MakeBarcode(
"stockitem",
self.id,
{
"id": self.id,
"url": reverse('api-stock-detail', kwargs={'pk': self.id}),
}
},
**kwargs
)
def format_short_barcode(self):
"""
Return a short barcode
"""
return "stockid={pk}".format(pk=self.pk)
uid = models.CharField(blank=True, max_length=128, help_text=("Unique identifier field"))
parent = TreeForeignKey(