本文整理汇总了Python中the_tale.finances.bank.prototypes.InvoicePrototype.get_unprocessed_invoice方法的典型用法代码示例。如果您正苦于以下问题:Python InvoicePrototype.get_unprocessed_invoice方法的具体用法?Python InvoicePrototype.get_unprocessed_invoice怎么用?Python InvoicePrototype.get_unprocessed_invoice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.finances.bank.prototypes.InvoicePrototype
的用法示例。
在下文中一共展示了InvoicePrototype.get_unprocessed_invoice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_unprocessed_invoice__no_invoice
# 需要导入模块: from the_tale.finances.bank.prototypes import InvoicePrototype [as 别名]
# 或者: from the_tale.finances.bank.prototypes.InvoicePrototype import get_unprocessed_invoice [as 别名]
def test_get_unprocessed_invoice__no_invoice(self):
for state in INVOICE_STATE.records:
if state.is_REQUESTED or state.is_FORCED:
continue
self.create_invoice(state=state)
self.assertEqual(InvoicePrototype.get_unprocessed_invoice(), None)
示例2: test_get_unprocessed_invoice_success
# 需要导入模块: from the_tale.finances.bank.prototypes import InvoicePrototype [as 别名]
# 或者: from the_tale.finances.bank.prototypes.InvoicePrototype import get_unprocessed_invoice [as 别名]
def test_get_unprocessed_invoice_success(self):
for state in INVOICE_STATE.records:
if not (state.is_REQUESTED or state.is_FORCED):
continue
invoice = self.create_invoice(state=state)
self.assertEqual(InvoicePrototype.get_unprocessed_invoice().id, invoice.id)
InvoicePrototype._db_all().delete()
示例3: process_init_invoice
# 需要导入模块: from the_tale.finances.bank.prototypes import InvoicePrototype [as 别名]
# 或者: from the_tale.finances.bank.prototypes.InvoicePrototype import get_unprocessed_invoice [as 别名]
def process_init_invoice(self):
invoice = InvoicePrototype.get_unprocessed_invoice()
if invoice is None:
return
if (not bank_settings.ENABLE_BANK or
settings.get(bank_settings.SETTINGS_ALLOWED_KEY) is None):
self.logger.info('postpone invoice %d' % invoice.id)
return
self.logger.info('process invoice %s' % invoice.id)
if invoice.state.is_REQUESTED:
invoice.freeze()
elif invoice.state.is_FORCED:
invoice.force()
else:
raise BankException('unknown invoice %d state %s' % (invoice.id, invoice.state))
self.logger.info('invoice %s status %s' % (invoice.id, invoice.state))