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


Python BillingAccount.save方法代码示例

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


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

示例1: billing_account

# 需要导入模块: from corehq.apps.accounting.models import BillingAccount [as 别名]
# 或者: from corehq.apps.accounting.models.BillingAccount import save [as 别名]
def billing_account(web_user_creator, web_user_contact, currency=None, save=True):
    account_name = data_gen.arbitrary_unique_name(prefix="BA")[:40]
    currency = currency or Currency.objects.get(code=settings.DEFAULT_CURRENCY)
    billing_account = BillingAccount(
        name=account_name,
        created_by=web_user_creator.username,
        currency=currency,
    )
    if save:
        billing_account.save()
        billing_contact = BillingContactInfo(
            account=billing_account,
            first_name=data_gen.arbitrary_firstname(),
            last_name=data_gen.arbitrary_lastname(),
            emails=web_user_creator.username,
            phone_number="+15555555",
            company_name="Company Name",
            first_line="585 Mass Ave",
            city="Cambridge",
            state_province_region="MA",
            postal_code="02139",
            country="US",
        )
        billing_contact.save()
        billing_account.billing_admins =\
            [BillingAccountAdmin.objects.get_or_create(web_user=web_user_contact.username)[0]]
        billing_account.save()

    return billing_account
开发者ID:pawelreise,项目名称:commcare-hq,代码行数:31,代码来源:generator.py

示例2: create_account

# 需要导入模块: from corehq.apps.accounting.models import BillingAccount [as 别名]
# 或者: from corehq.apps.accounting.models.BillingAccount import save [as 别名]
 def create_account(self):
     name = self.cleaned_data['name']
     salesforce_account_id = self.cleaned_data['salesforce_account_id']
     currency, _ = Currency.objects.get_or_create(code=self.cleaned_data['currency'])
     account = BillingAccount(name=name,
                              salesforce_account_id=salesforce_account_id,
                              currency=currency)
     account.save()
     return account
开发者ID:dszafranek,项目名称:commcare-hq,代码行数:11,代码来源:forms.py

示例3: billing_account

# 需要导入模块: from corehq.apps.accounting.models import BillingAccount [as 别名]
# 或者: from corehq.apps.accounting.models.BillingAccount import save [as 别名]
def billing_account(web_user_creator, web_user_contact, currency=None, save=True):
    account_name = data_gen.arbitrary_unique_name(prefix="BA")[:40]
    currency = currency or Currency.objects.get(code=settings.DEFAULT_CURRENCY)
    billing_account = BillingAccount(name=account_name, created_by=web_user_creator.username, currency=currency)
    if save:
        billing_account.save()
        billing_contact = arbitrary_contact_info(billing_account, web_user_contact)
        billing_contact.save()
    return billing_account
开发者ID:nnestle,项目名称:commcare-hq,代码行数:11,代码来源:generator.py

示例4: create_account

# 需要导入模块: from corehq.apps.accounting.models import BillingAccount [as 别名]
# 或者: from corehq.apps.accounting.models.BillingAccount import save [as 别名]
    def create_account(self):
        name = self.cleaned_data["name"]
        salesforce_account_id = self.cleaned_data["salesforce_account_id"]
        currency, _ = Currency.objects.get_or_create(code=self.cleaned_data["currency"])
        account = BillingAccount(name=name, salesforce_account_id=salesforce_account_id, currency=currency)
        account.save()

        contact_info, _ = BillingContactInfo.objects.get_or_create(account=account)
        contact_info.emails = self.cleaned_data["contact_emails"]
        contact_info.save()

        return account
开发者ID:pawelreise,项目名称:commcare-hq,代码行数:14,代码来源:forms.py


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