mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Added example for barcode plugin (#5670)
* Added example for barcode plugin * Add some words in stock location reports * Correct error in link * Correct error in link * Typo in link * Style in code example
This commit is contained in:
parent
d98b1bb2c7
commit
f409cd6894
@ -23,3 +23,35 @@ POST {
|
||||
barcode_data: "[(>someBarcodeDataWhichThePluginKnowsHowToDealWith"
|
||||
}
|
||||
```
|
||||
|
||||
### Example
|
||||
Please find below a very simple example that is executed each time a barcode is scanned.
|
||||
|
||||
```python
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from InvenTree.models import InvenTreeBarcodeMixin
|
||||
from plugin import InvenTreePlugin
|
||||
from plugin.mixins import BarcodeMixin
|
||||
|
||||
class InvenTreeBarcodePlugin(BarcodeMixin, InvenTreePlugin):
|
||||
|
||||
NAME = "MyBarcode"
|
||||
TITLE = "My Barcodes"
|
||||
DESCRIPTION = "support for barcodes"
|
||||
VERSION = "0.0.1"
|
||||
AUTHOR = "Michael"
|
||||
|
||||
status = 0
|
||||
|
||||
def scan(self, barcode_data):
|
||||
|
||||
self.status = self.status+1
|
||||
print('Started barcode plugin', self.status)
|
||||
print(barcode_data)
|
||||
response = {}
|
||||
return response
|
||||
|
||||
```
|
||||
|
||||
To try it just copy the file to src/InvenTree/plugins and restart the server. Open the scan barcode window and start to scan codes or type in text manually. Each time the timeout is hit the plugin will execute and printout the result. The timeout can be changed in settings->Barcode Support->Barcode Input Delay.
|
||||
|
@ -148,6 +148,7 @@ InvenTree supports the following reporting functionality:
|
||||
| [Purchase Order Report](./purchase_order.md) | Format a purchase order report |
|
||||
| [Sales Order Report](./sales_order.md) | Format a sales order report |
|
||||
| [Return Order Report](./return_order.md) | Format a return order report |
|
||||
| [Stock Location Report](./stock_location.md) | Format a stock location report |
|
||||
|
||||
### Default Reports
|
||||
|
||||
|
16
docs/docs/report/stock_location.md
Normal file
16
docs/docs/report/stock_location.md
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
title: Stock Location Reports
|
||||
---
|
||||
|
||||
## Stock location Reports
|
||||
|
||||
You can print a formatted report of a stock location. This makes sense if you have several parts inside one location, e.g. a box that is sent out to a manufacturing partner. Whit a report you can create a box content list.
|
||||
|
||||
### Context Variables
|
||||
You can use all content variables from the [StockLocation](./context_variables.md#stocklocation) object.
|
||||
|
||||
### Default Report Template
|
||||
|
||||
A default report template is provided out of the box, which can be used as a starting point for developing custom return order report templates.
|
||||
|
||||
View the [source code](https://github.com/inventree/InvenTree/blob/master/InvenTree/report/templates/report/inventree_slr_report.html) for the default stock location report template.
|
@ -140,6 +140,7 @@ nav:
|
||||
- Sales Order: report/sales_order.md
|
||||
- Return Order: report/return_order.md
|
||||
- BOM: report/bom.md
|
||||
- Stock Location: report/stock_location.md
|
||||
- Labels:
|
||||
- Custom Labels: report/labels.md
|
||||
- Part Labels: report/labels/part_labels.md
|
||||
|
Loading…
Reference in New Issue
Block a user