Add custom migration for the part_supplierpricebreak model

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

No files matched your search

+10
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 ''