2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 03:25:42 +00:00

Add custom migration for the part_supplierpricebreak model

- Copies across existing pricing data
- Yikes
This commit is contained in:
Oliver Walters
2020-11-10 22:25:05 +11:00
parent e4f2eecb3b
commit 83582ae87f
3 changed files with 175 additions and 0 deletions

View File

@ -13,6 +13,7 @@ from django.db import models
from django.conf import settings
import djmoney.settings
from djmoney.models.fields import MoneyField
from django.utils.translation import ugettext as _
from django.core.validators import MinValueValidator, MaxValueValidator
@ -536,6 +537,15 @@ class PriceBreak(models.Model):
currency = models.ForeignKey(Currency, blank=True, null=True, on_delete=models.SET_NULL)
price = MoneyField(
max_digits=19,
decimal_places=4,
default_currency='USD',
null=True,
verbose_name=_('Price'),
help_text=_('Unit price at specified quantity'),
)
@property
def symbol(self):
return self.currency.symbol if self.currency else ''