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

Report template updates (#4454)

* Update default purchase order report template

- Add line pricing data
- Add extra lines
- Add methods for returning total line item price
- Include total order price

* Similar updates for sales order reports
This commit is contained in:
Oliver
2023-03-05 23:59:54 +11:00
committed by GitHub
parent 5ba75c868d
commit ba4e264e6e
5 changed files with 305 additions and 231 deletions

View File

@ -978,6 +978,13 @@ class OrderLineItem(models.Model):
validators=[MinValueValidator(0)],
)
@property
def total_line_price(self):
"""Return the total price for this line item"""
if self.price:
return self.quantity * self.price
reference = models.CharField(max_length=100, blank=True, verbose_name=_('Reference'), help_text=_('Line item reference'))
notes = models.CharField(max_length=500, blank=True, verbose_name=_('Notes'), help_text=_('Line item notes'))
@ -1094,6 +1101,11 @@ class PurchaseOrderLineItem(OrderLineItem):
help_text=_('Unit purchase price'),
)
@property
def price(self):
"""Return the 'purchase_price' field as 'price'"""
return self.purchase_price
destination = TreeForeignKey(
'stock.StockLocation', on_delete=models.SET_NULL,
verbose_name=_('Destination'),
@ -1200,6 +1212,11 @@ class SalesOrderLineItem(OrderLineItem):
help_text=_('Unit sale price'),
)
@property
def price(self):
"""Return the 'sale_price' field as 'price'"""
return self.sale_price
shipped = RoundingDecimalField(
verbose_name=_('Shipped'),
help_text=_('Shipped quantity'),