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


Python Payment.create_repeated方法代码示例

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


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

示例1: on_confirm

# 需要导入模块: from stoqlib.domain.payment.payment import Payment [as 别名]
# 或者: from stoqlib.domain.payment.payment.Payment import create_repeated [as 别名]
    def on_confirm(self):
        self.model.base_value = self.model.value
        facet = self.person.read()
        if facet and facet is not ValueUnset:
            setattr(self.model.group,
                    self.person_attribute,
                    facet.person)

        self.model.attachment = self.fields['attachment'].attachment

        # We can only change the identifier if the object is branch new (not edit_mode). If the
        # object is being edited and the identifier is not temporary, it has already being synced
        # with the destination branch and the identifier should no longer change.
        # XXX: We can probably remove the temporary identifiers now that we have the station_id as
        # part of the key in the identifiable domain.
        other_branch = self._is_for_another_branch()
        if other_branch and not self.edit_mode:
            self.model.identifier = Payment.get_temporary_identifier(self.store)

        self.store.add(self.model.group)
        self.store.add(self.model)

        if self.repeat.get_selected() != _ONCE:
            Payment.create_repeated(self.store, self.model,
                                    self.repeat.get_selected(),
                                    self.model.due_date.date(),
                                    self.end_date.get_date(),
                                    temporary_identifiers=other_branch)
开发者ID:hackedbellini,项目名称:stoq,代码行数:30,代码来源:paymenteditor.py

示例2: on_confirm

# 需要导入模块: from stoqlib.domain.payment.payment import Payment [as 别名]
# 或者: from stoqlib.domain.payment.payment.Payment import create_repeated [as 别名]
    def on_confirm(self):
        self.model.base_value = self.model.value
        facet = self.person.read()
        if facet and facet is not ValueUnset:
            setattr(self.model.group,
                    self.person_attribute,
                    facet.person)

        self.model.attachment = self.fields['attachment'].attachment

        self.store.add(self.model.group)
        self.store.add(self.model)

        if self.repeat.get_selected() != _ONCE:
            Payment.create_repeated(self.store, self.model,
                                    self.repeat.get_selected(),
                                    self.model.due_date.date(),
                                    self.end_date.get_date())
开发者ID:Guillon88,项目名称:stoq,代码行数:20,代码来源:paymenteditor.py

示例3: test_create_repeated_with_temporary_identifier

# 需要导入模块: from stoqlib.domain.payment.payment import Payment [as 别名]
# 或者: from stoqlib.domain.payment.payment.Payment import create_repeated [as 别名]
 def test_create_repeated_with_temporary_identifier(self):
     payment = self.create_payment()
     payment.description = u'temporary'
     payments = Payment.create_repeated(self.store, payment,
                                        INTERVALTYPE_MONTH,
                                        localdate(2012, 1, 1).date(),
                                        localdate(2012, 3, 1).date(),
                                        temporary_identifiers=True)
     (self.assertTrue(p.identifier < 0) for p in payments)
开发者ID:hackedbellini,项目名称:stoq,代码行数:11,代码来源:test_payment.py

示例4: test_create_repeated_month

# 需要导入模块: from stoqlib.domain.payment.payment import Payment [as 别名]
# 或者: from stoqlib.domain.payment.payment.Payment import create_repeated [as 别名]
    def test_create_repeated_month(self):
        p = self.create_payment()
        p.description = u"Rent"
        p.category = self.create_payment_category()
        with self.assertRaises(AssertionError):
            Payment.create_repeated(
                self.store, p, INTERVALTYPE_MONTH, localdate(2012, 1, 1).date(), localdate(2012, 1, 1).date()
            )
        payments = Payment.create_repeated(
            self.store, p, INTERVALTYPE_MONTH, localdate(2012, 1, 1).date(), localdate(2012, 12, 31).date()
        )
        self.assertEquals(len(payments), 11)
        self.assertEquals(p.due_date, localdatetime(2012, 1, 1))
        self.assertEquals(p.description, u"1/12 Rent")

        self.assertEquals(payments[0].due_date, localdatetime(2012, 2, 1))
        self.assertEquals(payments[1].due_date, localdatetime(2012, 3, 1))
        self.assertEquals(payments[10].due_date, localdatetime(2012, 12, 1))

        self.assertEquals(payments[0].description, u"2/12 Rent")
        self.assertEquals(payments[10].description, u"12/12 Rent")
开发者ID:,项目名称:,代码行数:23,代码来源:

示例5: on_confirm

# 需要导入模块: from stoqlib.domain.payment.payment import Payment [as 别名]
# 或者: from stoqlib.domain.payment.payment.Payment import create_repeated [as 别名]
    def on_confirm(self):
        self.model.base_value = self.model.value
        person = self.person.get_selected_data()
        if (person is not None and person is not ValueUnset and
            # FIXME: PersonField should never let get_selected_data()
            #        return anything different from None and the model.
            person != ""):
            setattr(self.model.group,
                    self.person_attribute,
                    self.store.fetch(person.person))

        self.model.attachment = self.fields['attachment'].attachment

        self.store.add(self.model.group)
        self.store.add(self.model)

        if self.repeat.get_selected() != _ONCE:
            Payment.create_repeated(self.store, self.model,
                                    self.repeat.get_selected(),
                                    self.model.due_date.date(),
                                    self.end_date.get_date())
开发者ID:LeonamSilva,项目名称:stoq,代码行数:23,代码来源:paymenteditor.py

示例6: testCreateRepeatedMonth

# 需要导入模块: from stoqlib.domain.payment.payment import Payment [as 别名]
# 或者: from stoqlib.domain.payment.payment.Payment import create_repeated [as 别名]
    def testCreateRepeatedMonth(self):
        p = self.create_payment()
        p.description = u"Rent"
        p.category = self.create_payment_category()
        payments = Payment.create_repeated(
            self.store, p, INTERVALTYPE_MONTH, datetime.date(2012, 1, 1), datetime.date(2012, 12, 31)
        )
        self.assertEquals(len(payments), 11)
        self.assertEquals(p.due_date, datetime.datetime(2012, 1, 1))
        self.assertEquals(p.description, u"1/12 Rent")

        self.assertEquals(payments[0].due_date, datetime.datetime(2012, 2, 1))
        self.assertEquals(payments[1].due_date, datetime.datetime(2012, 3, 1))
        self.assertEquals(payments[10].due_date, datetime.datetime(2012, 12, 1))

        self.assertEquals(payments[0].description, u"2/12 Rent")
        self.assertEquals(payments[10].description, u"12/12 Rent")
开发者ID:romaia,项目名称:stoq,代码行数:19,代码来源:test_payment.py

示例7: test_create_repeated_month

# 需要导入模块: from stoqlib.domain.payment.payment import Payment [as 别名]
# 或者: from stoqlib.domain.payment.payment.Payment import create_repeated [as 别名]
    def test_create_repeated_month(self):
        p = self.create_payment()
        p.description = u'Rent'
        p.category = self.create_payment_category()
        payments = Payment.create_repeated(self.store, p,
                                           INTERVALTYPE_MONTH,
                                           localdate(2012, 1, 1).date(),
                                           localdate(2012, 12, 31).date())
        self.assertEquals(len(payments), 11)
        self.assertEquals(p.due_date, localdatetime(2012, 1, 1))
        self.assertEquals(p.description, u'1/12 Rent')

        self.assertEquals(payments[0].due_date, localdatetime(2012, 2, 1))
        self.assertEquals(payments[1].due_date, localdatetime(2012, 3, 1))
        self.assertEquals(payments[10].due_date, localdatetime(2012, 12, 1))

        self.assertEquals(payments[0].description, u'2/12 Rent')
        self.assertEquals(payments[10].description, u'12/12 Rent')
开发者ID:rosalin,项目名称:stoq,代码行数:20,代码来源:test_payment.py


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