本文整理汇总了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
示例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
示例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
示例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