In between commit

This commit is contained in:
Nico Schottelius 2020-05-07 20:22:42 +02:00
commit 41a2f18453
4 changed files with 71 additions and 13 deletions

View file

@ -492,6 +492,18 @@ class VATRate(models.Model):
logger.debug("Did not find VAT rate for %s, returning 0" % country_code)
return 0
class BillNico(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.ForeignKey(get_user_model(),
on_delete=models.CASCADE)
creation_date = models.DateTimeField(auto_now_add=True)
starting_date = models.DateTimeField()
ending_date = models.DateTimeField()
due_date = models.DateField()
valid = models.BooleanField(default=True)
class Bill(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.ForeignKey(get_user_model(),
@ -996,9 +1008,11 @@ class Product(UncloudModel):
if not billing_address:
raise ValidationError("Cannot order without a billing address")
# FIXME: allow user to choose recurring_period
self.order = Order.objects.create(owner=self.owner,
billing_address=billing_address,
one_time_price=self.one_time_price,
recurring_period=self.default_recurring_period,
recurring_price=self.recurring_price)
super().save(*args, **kwargs)
@ -1019,10 +1033,6 @@ class Product(UncloudModel):
def one_time_price(self):
return 0
@property
def recurring_period(self):
return self.order.recurring_period
@property
def billing_address(self):
return self.order.billing_address