def _check_single_paidtask(invoice, amount):
local_now = timezone.localtime(invoice.now)
current_month_start = local_now.replace(day=1, hour=0, minute=0, second=0)
PaidTask.objects.get(
task_type=PaidTaskTypes.CORRECTION,
amount=(-1) * amount,
datetime=invoice.month_end,
description='Carryover to the next month',
user=invoice.user,
)
PaidTask.objects.get(
task_type=PaidTaskTypes.CORRECTION,
amount=amount,
datetime=current_month_start,
description='Carryover from the previous month',
user=invoice.user,
)
assert PaidTask.objects.filter(task_type=PaidTaskTypes.CORRECTION).count() == 2
评论列表
文章目录