invoice.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:zing 作者: evernote 项目源码 文件源码
def _add_correction(self, total_amount):
        """Adds a correction for the value of `total_amount` in the month being
        processed.
        """
        server_tz = timezone.get_default_timezone()
        local_now = timezone.localtime(self.now, server_tz)
        initial_moment = local_now.replace(day=1, hour=0, minute=0, second=0)

        PaidTask.objects.get_or_create(
            task_type=PaidTaskTypes.CORRECTION,
            amount=(-1) * total_amount,
            rate=1,
            datetime=self.month_end,
            description='Carryover to the next month',
            user=self.user,
        )
        PaidTask.objects.get_or_create(
            task_type=PaidTaskTypes.CORRECTION,
            amount=total_amount,
            rate=1,
            datetime=initial_moment,
            description='Carryover from the previous month',
            user=self.user,
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号