mirror of
				https://github.com/inventree/inventree-docs.git
				synced 2025-11-03 22:15:40 +00:00 
			
		
		
		
	Added context variables for purchase orders (#471)
* Changed IDs of pictures * Added context variables for pruchase order * Name change * Removed PO variables from context_variables because of double * Typo
This commit is contained in:
		@@ -55,7 +55,7 @@ class PluginWithSettings(SettingsMixin, InvenTreePlugin):
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This mixin defines the helper functions `plugin.get_setting` and `plugin.set_seting` to access all plugin specific settings:
 | 
					This mixin defines the helper functions `plugin.get_setting` and `plugin.set_setting` to access all plugin specific settings:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```python
 | 
					```python
 | 
				
			||||||
api_url = self.get_setting('API_URL', cache = False)
 | 
					api_url = self.get_setting('API_URL', cache = False)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,7 +53,7 @@ The following variables are accessed by build.variable
 | 
				
			|||||||
| target_date | Date the build will be overdue |
 | 
					| target_date | Date the build will be overdue |
 | 
				
			||||||
| take_from | [StockLocation](./context_variables.md#stocklocation) to take stock from to make this build (if blank, can take from anywhere) |
 | 
					| take_from | [StockLocation](./context_variables.md#stocklocation) to take stock from to make this build (if blank, can take from anywhere) |
 | 
				
			||||||
| title | The full name of the build |
 | 
					| title | The full name of the build |
 | 
				
			||||||
| title | The description of the build |
 | 
					| description | The description of the build |
 | 
				
			||||||
| allocated_stock.all | A query set with all allocated stock items for the build |
 | 
					| allocated_stock.all | A query set with all allocated stock items for the build |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
As usual items in a query sets can be selected by adding a .n to the set e.g. build.required_parts.0
 | 
					As usual items in a query sets can be selected by adding a .n to the set e.g. build.required_parts.0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -220,16 +220,7 @@ Each part object has access to a lot of context variables about the part. The fo
 | 
				
			|||||||
!!! incomplete "TODO"
 | 
					!!! incomplete "TODO"
 | 
				
			||||||
    This section requires further work
 | 
					    This section requires further work
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Purchase Order
 | 
					The [Purchase Order](../buy/po.md) context variables are described in the [Purchase Order](purchase_order.md) section.
 | 
				
			||||||
 | 
					 | 
				
			||||||
A [Purchase Order](../buy/po.md) object has the following context variables available.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| Variable | Description |
 | 
					 | 
				
			||||||
|----------|-------------|
 | 
					 | 
				
			||||||
| description | The order description |
 | 
					 | 
				
			||||||
| lines | The lines in the Purchase Order |
 | 
					 | 
				
			||||||
| reference | The reference number |
 | 
					 | 
				
			||||||
| supplier | The supplier for this Purchase Order |
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### SalesOrder
 | 
					#### SalesOrder
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,11 +17,31 @@ In addition to the default report context variables, the following variables are
 | 
				
			|||||||
| Variable | Description |
 | 
					| Variable | Description |
 | 
				
			||||||
| --- | --- |
 | 
					| --- | --- |
 | 
				
			||||||
| order | The specific Purchase Order object |
 | 
					| order | The specific Purchase Order object |
 | 
				
			||||||
| reference | The order reference field (can also be accessed as `{% raw %}{{ order.description }}{% endraw %}`) |
 | 
					| reference | The order reference field (can also be accessed as `{% raw %}{{ order.reference }}{% endraw %}`) |
 | 
				
			||||||
| description | The order description field |
 | 
					| description | The order description field |
 | 
				
			||||||
| supplier | The [supplier](../buy/supplier.md) associated with this purchase order |
 | 
					| supplier | The [supplier](../buy/supplier.md) associated with this purchase order |
 | 
				
			||||||
| lines | A list of available line items for this order |
 | 
					| lines | A list of available line items for this order |
 | 
				
			||||||
| extra_lines | A list of available *extra* line items for this order | 
 | 
					| extra_lines | A list of available *extra* line items for this order | 
 | 
				
			||||||
 | 
					| order.created_by | The user who created the order | 
 | 
				
			||||||
 | 
					| order.responsible | The user or group who is responsible for the order | 
 | 
				
			||||||
 | 
					| order.creation_date | The date when the order was created | 
 | 
				
			||||||
 | 
					| order.target_date | The date when the order should arrive | 
 | 
				
			||||||
 | 
					| order.if_overdue | Boolean value that tells if the target date has passed | 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Lines
 | 
				
			||||||
 | 
					The lines have sub variables.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					| Variable | Description |
 | 
				
			||||||
 | 
					| --- | --- |
 | 
				
			||||||
 | 
					| quantity | The quantity of the part to be ordered |
 | 
				
			||||||
 | 
					| part | The supplier part to be ordered |
 | 
				
			||||||
 | 
					| part | The [supplierpart ](./context_variables.md#supplierpart) object that the build references |
 | 
				
			||||||
 | 
					| reference | The reference given in the part of the order |
 | 
				
			||||||
 | 
					| notes | The notes given in the part of the order |
 | 
				
			||||||
 | 
					| target_date | The date when the part should arrive. Each part can have an individual date |
 | 
				
			||||||
 | 
					| price | The price the part supplierpart |
 | 
				
			||||||
 | 
					| destination | The stock location where the part will be stored |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Default Report Template
 | 
					### Default Report Template
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user