more abstraction

This commit is contained in:
Matthias 2022-03-11 00:21:33 +01:00
parent 72d565d17a
commit c6d0c03adf
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -873,6 +873,35 @@ class OrderLineItem(models.Model):
)
class OrderAdditionalLineItem(OrderLineItem):
"""
Abstract Model for a single AdditionalLineItem in a Order
Attributes:
sale_price: The unit sale price for this OrderLineItem
"""
class Meta:
abstract = True
sale_price = InvenTreeModelMoneyField(
max_digits=19,
decimal_places=4,
null=True, blank=True,
verbose_name=_('Sale Price'),
help_text=_('Unit sale price'),
)
def sale_price_converted(self):
return convert_money(self.sale_price, currency_code_default())
def sale_price_converted_currency(self):
return currency_code_default()
class Meta:
unique_together = [
]
class PurchaseOrderLineItem(OrderLineItem):
""" Model for a purchase order line item.
@ -1185,7 +1214,7 @@ class SalesOrderShipment(models.Model):
trigger_event('salesordershipment.completed', id=self.pk)
class SalesOrderAdditionalLineItem(OrderLineItem):
class SalesOrderAdditionalLineItem(OrderAdditionalLineItem):
"""
Model for a single AdditionalLineItem in a SalesOrder
Attributes:
@ -1199,23 +1228,6 @@ class SalesOrderAdditionalLineItem(OrderLineItem):
order = models.ForeignKey(SalesOrder, on_delete=models.CASCADE, related_name='additional_lines', verbose_name=_('Order'), help_text=_('Sales Order'))
sale_price = InvenTreeModelMoneyField(
max_digits=19,
decimal_places=4,
null=True, blank=True,
verbose_name=_('Sale Price'),
help_text=_('Unit sale price'),
)
def sale_price_converted(self):
return convert_money(self.sale_price, currency_code_default())
def sale_price_converted_currency(self):
return currency_code_default()
class Meta:
unique_together = [
]
class SalesOrderAllocation(models.Model):