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


Python Event.log方法代码示例

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


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

示例1: test_system_event

# 需要导入模块: from stoqlib.domain.event import Event [as 别名]
# 或者: from stoqlib.domain.event.Event import log [as 别名]
 def test_system_event(self):
     Event.log(self.store, Event.TYPE_SYSTEM, u"foo")
     events = list(self.store.find(Event))
     events = [event for event in events if event.description == u'foo']
     self.failUnless(events)
     self.assertEquals(events[0].description, u"foo")
     self.assertEquals(events[0].event_type, Event.TYPE_SYSTEM)
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:9,代码来源:test_event.py

示例2: confirm

# 需要导入模块: from stoqlib.domain.event import Event [as 别名]
# 或者: from stoqlib.domain.event.Event import log [as 别名]
    def confirm(self, confirm_date=None):
        """Confirms the purchase order

        :param confirm_data: optional, datetime
        """
        if confirm_date is None:
            confirm_date = TransactionTimestamp()

        if self.status not in [PurchaseOrder.ORDER_PENDING,
                               PurchaseOrder.ORDER_CONSIGNED]:
            fmt = _(u'Invalid order status, it should be '
                    u'ORDER_PENDING or ORDER_CONSIGNED, got %s')
            raise ValueError(fmt % (self.status_str, ))

        # In consigned purchases there is no payments at this point.
        if self.status != PurchaseOrder.ORDER_CONSIGNED:
            for payment in self.payments:
                payment.set_pending()

        if self.supplier:
            self.group.recipient = self.supplier.person

        self.responsible = get_current_user(self.store)
        self.status = PurchaseOrder.ORDER_CONFIRMED
        self.confirm_date = confirm_date

        Event.log(self.store, Event.TYPE_ORDER,
                  _(u"Order %s, total value %2.2f, supplier '%s' "
                    u"is now confirmed") % (self.identifier,
                                            self.purchase_total,
                                            self.supplier.person.name))
开发者ID:Guillon88,项目名称:stoq,代码行数:33,代码来源:purchase.py

示例3: cancel

# 需要导入模块: from stoqlib.domain.event import Event [as 别名]
# 或者: from stoqlib.domain.event.Event import log [as 别名]
    def cancel(self, change_entry=None):
        """Cancel the payment, set it's status to :obj:`.STATUS_CANCELLED`
        """
        # TODO Check for till entries here and call cancel_till_entry if
        # it's possible. Bug 2598
        if self.status not in [Payment.STATUS_PREVIEW, Payment.STATUS_PENDING,
                               Payment.STATUS_PAID]:
            raise StoqlibError(_(u"Invalid status for cancel operation, "
                                 u"got %s") % self.get_status_str())

        if self.transaction:
            self.transaction.create_reverse()

        old_status = self.status
        self.status = self.STATUS_CANCELLED
        self.cancel_date = TransactionTimestamp()

        if change_entry is not None:
            change_entry.last_status = old_status
            change_entry.new_status = self.status

        msg = _(u"{method} payment with value {value:.2f} was cancelled").format(
                method=self.method.method_name,
                value=self.value)
        Event.log(Event.TYPE_PAYMENT, msg.capitalize())
开发者ID:romaia,项目名称:stoq,代码行数:27,代码来源:payment.py

示例4: pay

# 需要导入模块: from stoqlib.domain.event import Event [as 别名]
# 或者: from stoqlib.domain.event.Event import log [as 别名]
    def pay(self, paid_date=None, paid_value=None, account=None):
        """Pay the current payment set its status as :obj:`.STATUS_PAID`"""
        if self.status != Payment.STATUS_PENDING:
            raise ValueError(_(u"This payment is already paid."))
        self._check_status(self.STATUS_PENDING, u'pay')

        paid_value = paid_value or (self.value - self.discount +
                                    self.interest)
        self.paid_value = paid_value
        self.paid_date = paid_date or TransactionTimestamp()
        self.status = self.STATUS_PAID

        if (self.is_separate_payment() or
            self.method.operation.create_transaction()):
            AccountTransaction.create_from_payment(self, account)

        sale = self.group and self.group.sale
        if sale:
            transaction = IPaymentTransaction(sale)
            transaction.create_commission(self)

        if self.value == self.paid_value:
            msg = _(u"{method} payment with value {value:.2f} was paid").format(
                    method=self.method.method_name,
                    value=self.value)
        else:
            msg = _(u"{method} payment with value original value "
                    u"{original_value:.2f} was paid with value "
                    u"{value:.2f}").format(
                    method=self.method.method_name,
                    original_value=self.value,
                    value=self.paid_value)
        Event.log(Event.TYPE_PAYMENT, msg.capitalize())
开发者ID:romaia,项目名称:stoq,代码行数:35,代码来源:payment.py

示例5: confirm

# 需要导入模块: from stoqlib.domain.event import Event [as 别名]
# 或者: from stoqlib.domain.event.Event import log [as 别名]
    def confirm(self, confirm_date=None):
        """Confirms the purchase order

        :param confirm_data: optional, datetime
        """
        if confirm_date is None:
            confirm_date = TransactionTimestamp()

        if self.status not in [PurchaseOrder.ORDER_PENDING,
                               PurchaseOrder.ORDER_CONSIGNED]:
            raise ValueError(
                _(u'Invalid order status, it should be '
                  u'ORDER_PENDING or ORDER_CONSIGNED, got %s') % (
                      self.get_status_str(), ))

        transaction = IPaymentTransaction(self)
        transaction.confirm()

        if self.supplier:
            self.group.recipient = self.supplier.person

        self.responsible = get_current_user(self.store)
        self.status = PurchaseOrder.ORDER_CONFIRMED
        self.confirm_date = confirm_date

        Event.log(self.store, Event.TYPE_ORDER,
                  _(u"Order %s, total value %2.2f, supplier '%s' "
                    u"is now confirmed") % (self.identifier,
                                            self.get_purchase_total(),
                                            self.supplier.person.name))
开发者ID:leandrorchaves,项目名称:stoq,代码行数:32,代码来源:purchase.py

示例6: on_create

# 需要导入模块: from stoqlib.domain.event import Event [as 别名]
# 或者: from stoqlib.domain.event.Event import log [as 别名]
 def on_create(self):
     # Should be done after_create()
     return
     Event.log(self.store,
               Event.TYPE_SYSTEM,
               _(u"Created computer '%s' for branch '%s'") % (
               self.name, self.branch.person.name))
开发者ID:leandrorchaves,项目名称:stoq,代码行数:9,代码来源:station.py

示例7: close

# 需要导入模块: from stoqlib.domain.event import Event [as 别名]
# 或者: from stoqlib.domain.event.Event import log [as 别名]
    def close(self):
        """Closes the purchase order
        """
        if self.status != PurchaseOrder.ORDER_CONFIRMED:
            raise ValueError(_(u'Invalid status, it should be confirmed '
                               u'got %s instead') % self.status_str)
        self.status = self.ORDER_CLOSED

        Event.log(self.store, Event.TYPE_ORDER,
                  _(u"Order %s, total value %2.2f, supplier '%s' "
                    u"is now closed") % (self.identifier,
                                         self.purchase_total,
                                         self.supplier.person.name))
开发者ID:Guillon88,项目名称:stoq,代码行数:15,代码来源:purchase.py

示例8: pay

# 需要导入模块: from stoqlib.domain.event import Event [as 别名]
# 或者: from stoqlib.domain.event.Event import log [as 别名]
    def pay(self, paid_date=None, paid_value=None,
            source_account=None, destination_account=None,
            account_transaction_number=None):
        """Pay the current payment set its status as :obj:`.STATUS_PAID`

        If this payment belongs to a sale, and all other payments from the sale
        are paid then the sale will be set as paid.
        """
        if self.status != Payment.STATUS_PENDING:
            raise ValueError(_(u"This payment is already paid."))
        self._check_status(self.STATUS_PENDING, u'pay')

        paid_value = paid_value or (self.value - self.discount +
                                    self.interest)
        self.paid_value = paid_value
        self.paid_date = paid_date or TransactionTimestamp()
        self.status = self.STATUS_PAID

        if (self.is_separate_payment() or
                self.method.operation.create_transaction()):
            AccountTransaction.create_from_payment(
                self,
                code=account_transaction_number,
                source_account=source_account,
                destination_account=destination_account)

        sale = self.group and self.group.sale
        if sale:
            sale.create_commission(self)

            # When paying payments of a sale, check if the other payments are
            # paid. If they are, this means you can change the sale status to
            # paid as well.
            if sale.can_set_paid():
                sale.set_paid()

        if self.value == self.paid_value:
            msg = _(u"{method} payment with value {value:.2f} was paid").format(
                method=self.method.method_name,
                value=self.value)
        else:
            msg = _(u"{method} payment with value original value "
                    u"{original_value:.2f} was paid with value "
                    u"{value:.2f}").format(method=self.method.method_name,
                                           original_value=self.value,
                                           value=self.paid_value)
        Event.log(self.store, Event.TYPE_PAYMENT, msg.capitalize())
开发者ID:hackedbellini,项目名称:stoq,代码行数:49,代码来源:payment.py


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