2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 20:46:47 +00:00
InvenTree/docs/docs/report/purchase_order.md
Oliver e2c3b28640
Company docs updates (#4710)
* Refactor order documentation into simpler consolidated pages

* Reorganize images

* Add documentation on "Contact"

* Add imgae
2023-04-27 22:27:21 +10:00

2.8 KiB

title
title
Purchase Order Report

Purchase Order Reports

Custom purchase order reports may be generated against any given Purchase Order. For example, purchase order reports could be used to generate a pdf of the order to send to a supplier.

Purchase Order Filters

The report template can be filtered against available Purchase Order instances.

Context Variables

In addition to the default report context variables, the following variables are made available to the purchase order report template for rendering:

Variable Description
order The specific Purchase Order object
reference The order reference field (can also be accessed as {% raw %}{{ order.reference }}{% endraw %})
description The order description field
supplier The supplier associated with this purchase order
lines A list of available 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
order.currency The currency code associated with this order, e.g. 'AUD'

Lines

Each line item have sub variables, as follows:

Variable Description
quantity The quantity of the part to be ordered
part The supplier part to be ordered
part The 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 unit price the line item
total_line_price The total price for this line item, calculated from the unit price and quantity
destination The stock location where the part will be stored

A simple example below shows how to use the context variables for line items:

{% raw %}
{% for line in order.lines %}
Price: {% render_currency line.total_line_price %}
{% endfor %}
{% endraw %}

Default Report Template

A default Purchase Order Report template is provided out of the box, which is useful for generating simple test reports. Furthermore, it may be used as a starting point for developing custom BOM reports:

View the source code for the default purchase order report template.