当前位置: 首页>>代码示例>>Python>>正文


Python Invoice.bill_to_user方法代码示例

本文整理汇总了Python中tendenci.apps.invoices.models.Invoice.bill_to_user方法的典型用法代码示例。如果您正苦于以下问题:Python Invoice.bill_to_user方法的具体用法?Python Invoice.bill_to_user怎么用?Python Invoice.bill_to_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tendenci.apps.invoices.models.Invoice的用法示例。


在下文中一共展示了Invoice.bill_to_user方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: directory_set_inv_payment

# 需要导入模块: from tendenci.apps.invoices.models import Invoice [as 别名]
# 或者: from tendenci.apps.invoices.models.Invoice import bill_to_user [as 别名]
def directory_set_inv_payment(user, directory, pricing):
    if get_setting('module', 'directories', 'directoriesrequirespayment'):
        if not directory.invoice:
            inv = Invoice()
            inv.object_type = ContentType.objects.get(app_label=directory._meta.app_label,
                                              model=directory._meta.model_name)
            inv.object_id = directory.id
            inv.title = "Directory Add Invoice"
            inv.bill_to_user(user)
            inv.ship_to_user(user)

            inv.terms = "Due on Receipt"
            inv.due_date = datetime.now()
            inv.ship_date = datetime.now()
            inv.message = 'Thank You.'
            inv.status = True

            inv.total = get_directory_price(user, directory, pricing)
            inv.subtotal = inv.total
            inv.balance = inv.total
            inv.estimate = True
            inv.status_detail = 'estimate'

            if user and not user.is_anonymous:
                inv.set_creator(user)
                inv.set_owner(user)

            inv.save(user)

            # tender the invoice
            inv.tender(user)

            # update job
            directory.invoice = inv
            directory.save()

            if user.profile.is_superuser:
                if directory.payment_method in ['paid - cc', 'paid - check', 'paid - wire transfer']:
                    inv.tender(user)

                    # payment
                    payment = Payment()
                    payment.payments_pop_by_invoice_user(user, inv, inv.guid)
                    payment.mark_as_paid()
                    payment.method = directory.payment_method
                    payment.save(user)

                    # this will make accounting entry
                    inv.make_payment(user, payment.amount)
开发者ID:tendenci,项目名称:tendenci,代码行数:51,代码来源:utils.py


注:本文中的tendenci.apps.invoices.models.Invoice.bill_to_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。