本文整理汇总了Python中stoqlib.domain.payment.method.PaymentMethod.get_by_account方法的典型用法代码示例。如果您正苦于以下问题:Python PaymentMethod.get_by_account方法的具体用法?Python PaymentMethod.get_by_account怎么用?Python PaymentMethod.get_by_account使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.payment.method.PaymentMethod
的用法示例。
在下文中一共展示了PaymentMethod.get_by_account方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGetByAccount
# 需要导入模块: from stoqlib.domain.payment.method import PaymentMethod [as 别名]
# 或者: from stoqlib.domain.payment.method.PaymentMethod import get_by_account [as 别名]
def testGetByAccount(self):
account = self.create_account()
methods = PaymentMethod.get_by_account(self.store, account)
self.assertTrue(methods.is_empty())
PaymentMethod(store=self.store,
method_name=u'test',
destination_account=account)
methods = PaymentMethod.get_by_account(self.store, account)
self.assertFalse(methods.is_empty())
示例2: _delete_account
# 需要导入模块: from stoqlib.domain.payment.method import PaymentMethod [as 别名]
# 或者: from stoqlib.domain.payment.method.PaymentMethod import get_by_account [as 别名]
def _delete_account(self, account_view):
store = api.new_store()
account = store.fetch(account_view.account)
methods = PaymentMethod.get_by_account(store, account)
if methods.count() > 0:
if not yesno(
_('This account is used in at least one payment method.\n'
'To be able to delete it the payment methods needs to be'
're-configured first'), gtk.RESPONSE_NO,
_("Configure payment methods"), _("Keep account")):
store.close()
return
elif not yesno(
_('Are you sure you want to remove account "%s" ?') % (
(account_view.description, )), gtk.RESPONSE_NO,
_("Remove account"), _("Keep account")):
store.close()
return
if account_view.id in self._pages:
account_page = self._pages[account_view.id]
self._close_page(account_page)
self.accounts.remove(account_view)
self.accounts.flush()
imbalance = api.sysparam(store).IMBALANCE_ACCOUNT
for method in methods:
method.destination_account = imbalance
account.remove(store)
store.commit(close=True)