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


Python PaymentMethod.get_by_account方法代码示例

本文整理汇总了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())
开发者ID:romaia,项目名称:stoq,代码行数:11,代码来源:test_payment_method.py

示例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)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:34,代码来源:financial.py


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