• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python message.info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中stoqlib.lib.message.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _add_sellable

    def _add_sellable(self, sellable, batch=None):
        quantity = self._read_quantity()
        if quantity == 0:
            return

        if not sellable.is_valid_quantity(quantity):
            warning(
                _(u"You cannot sell fractions of this product. "
                  u"The '%s' unit does not allow that") %
                sellable.unit_description)
            return

        if sellable.product:
            # If the sellable has a weight unit specified and we have a scale
            # configured for this station, go and check what the scale says.
            if (sellable and sellable.unit
                    and sellable.unit.unit_index == UnitType.WEIGHT
                    and self._scale_settings):
                self._read_scale(sellable)

        storable = sellable.product_storable
        if storable is not None:
            if not self._check_available_stock(storable, sellable):
                info(
                    _("You cannot sell more items of product %s. "
                      "The available quantity is not enough.") %
                    sellable.get_description())
                self.barcode.set_text('')
                self.barcode.grab_focus()
                return

        self._update_list(sellable, batch=batch)
        self.barcode.grab_focus()
开发者ID:pkaislan,项目名称:stoq,代码行数:33,代码来源:pos.py


示例2: _change_status

    def _change_status(self, work_order, new_status):
        with api.new_store() as store:
            work_order = store.fetch(work_order)

            reason = self._ask_reason(work_order, new_status)
            if reason is False:
                store.retval = False
                return

            # FIXME Redo this logic, it wont unset if the user go further back on
            # status
            if work_order.status == new_status:
                if work_order.client_informed_date:
                    work_order.unset_client_informed(reason)
                return True

            try:
                work_order.change_status(new_status, reason)
            except InvalidStatus as e:
                info(str(e))
                store.retval = False
            except NeedReason as e:
                info(str(e), _("Make the change on the order's menu so "
                               "you can specify a reason"))
                store.retval = False

        return store.retval
开发者ID:hackedbellini,项目名称:stoq,代码行数:27,代码来源:services.py


示例3: _cancel_last_document

    def _cancel_last_document(self):
        try:
            self._validate_printer()
        except DeviceError as e:
            warning(str(e))
            return

        store = new_store()
        last_doc = self._get_last_document(store)
        if not self._confirm_last_document_cancel(last_doc):
            store.close()
            return

        if last_doc.last_till_entry:
            self._cancel_last_till_entry(last_doc, store)
        elif last_doc.last_sale:
            # Verify till balance before cancel the last sale.
            till = Till.get_current(store)
            if last_doc.last_sale.total_amount > till.get_balance():
                warning(_("You do not have this value on till."))
                store.close()
                return
            cancelled = self._printer.cancel()
            if not cancelled:
                info(_("Cancelling sale failed, nothing to cancel"))
                store.close()
                return
            else:
                self._cancel_last_sale(last_doc, store)
        store.commit()
开发者ID:LeonamSilva,项目名称:stoq,代码行数:30,代码来源:ecfui.py


示例4: apply_patch

def apply_patch(store):
    info(u'The schema update might take a long time to complete, depending '
         'the size of your database and your hardware.')

    for payment in store.find(Payment).order_by(['due_date',
                                                 'paid_date',
                                                 'cancel_date']):
        if payment.is_preview():
            continue

        if payment.due_date:
            history_date = payment.due_date.date()
        else:
            history_date = payment.open_date.date()

        PaymentFlowHistory.add_payment(store, payment, history_date)

        if payment.is_paid():
            PaymentFlowHistory.add_paid_payment(store, payment,
                                                payment.paid_date.date())
        elif payment.is_cancelled():
            if payment.paid_date:
                PaymentFlowHistory.add_paid_payment(store, payment,
                                                    payment.paid_date.date())
                PaymentFlowHistory.remove_paid_payment(store, payment,
                                                       payment.cancel_date.date())
            else:
                PaymentFlowHistory.remove_payment(store, payment,
                                                  payment.due_date.date())
开发者ID:leandrorchaves,项目名称:stoq,代码行数:29,代码来源:patch-01-35.py


示例5: finish

    def finish(self):
        for payment in self.model.group.payments:
            if payment.is_preview():
                # Set payments created on SaleReturnPaymentStep as pending
                payment.set_pending()

        SaleReturnWizardFinishEvent.emit(self.model)

        total_amount = self.model.total_amount
        # If the user chose to create credit for the client instead of returning
        # money, there is no need to display this messages.
        if not self.credit:
            if total_amount == 0:
                info(_("The client does not have a debt to this sale anymore. "
                       "Any existing unpaid installment will be cancelled."))
            elif total_amount < 0:
                info(_("A reversal payment to the client will be created. "
                       "You can see it on the Payable Application."))

        self.model.return_(method_name=u'credit' if self.credit else u'money')
        self.retval = self.model
        self.close()

        if self.credit:
            if yesno(_(u'Would you like to print the credit letter?'),
                     gtk.RESPONSE_YES, _(u"Print Letter"), _(u"Don't print")):
                print_report(ClientCreditReport, self.model.client)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:27,代码来源:salereturnwizard.py


示例6: validate_confirm

 def validate_confirm(self):
     try:
         self.model.add_lost(self.quantity.read())
     except (ValueError, AssertionError):
         info(_(u"Can not lose this quantity. Not enough materials " "allocated to this production."))
         return False
     return True
开发者ID:rg3915,项目名称:stoq,代码行数:7,代码来源:productioneditor.py


示例7: on_SalesCancel__activate

    def on_SalesCancel__activate(self, action):
        sale_view = self.results.get_selected()
        can_cancel = api.sysparam.get_bool('ALLOW_CANCEL_LAST_COUPON')
        if can_cancel and ECFIsLastSaleEvent.emit(sale_view.sale):
            info(_("That is last sale in ECF. Return using the menu "
                   "ECF - Cancel Last Document"))
            return

        store = api.new_store()
        sale = store.fetch(sale_view.sale)
        msg_text = _(u"This will cancel the sale, Are you sure?")
        model = SaleComment(store=store, sale=sale,
                            author=api.get_current_user(store))

        retval = self.run_dialog(
            NoteEditor, store, model=model, attr_name='comment',
            message_text=msg_text, label_text=_(u"Reason"),
            mandatory=True, ok_button_label=_(u"Cancel sale"),
            cancel_button_label=_(u"Don't cancel"))

        if not retval:
            store.rollback()
            return

        sale.cancel()
        store.commit(close=True)
        self.refresh()
开发者ID:dionimf,项目名称:stoq,代码行数:27,代码来源:sales.py


示例8: post_init

 def post_init(self):
     self.register_validate_function(self._validation_func)
     self.force_validation()
     missing_value = self.slave.get_missing_change_value()
     if missing_value < 0:
         info(_(u"Your payments total is greater than the sale total. Maybe"
                " you want to correct them."))
开发者ID:hackedbellini,项目名称:stoq,代码行数:7,代码来源:salequotewizard.py


示例9: print_cheques_for_payment_group

def print_cheques_for_payment_group(store, group):
    """ Given a instance that implements the PaymentGroup interface, iterate
    over all its items printing a cheque for them.
    """
    payments = group.get_valid_payments()
    printer = get_current_cheque_printer_settings(store)
    if not printer:
        return
    printer_banks = printer.get_banks()
    current_branch = get_current_branch(store)
    main_address = current_branch.person.get_main_address()
    if not main_address:
        raise ValueError("The cheque can not be printed since there is no "
                         "main address defined for the current branch.")

    max_len = printer.get_capability("cheque_city").max_len
    city = main_address.city_location.city[:max_len]
    for idx, payment in enumerate(payments):
        if payment.method.method_name == 'check':
            continue
        check_data = payment.method.operation.get_check_data_by_payment(
            payment)
        bank_id = check_data.bank_data.bank_id
        try:
            bank = printer_banks[bank_id]
        except KeyError:
            continue
        thirdparty = group.recipient
        info(_(u"Insert Cheque %d") % (idx + 1))
        max_len = printer.get_capability("cheque_thirdparty").max_len
        thirdparty = thirdparty and thirdparty.name[:max_len] or ""
        printer.print_cheque(bank, payment.value, thirdparty, city)
开发者ID:Guillon88,项目名称:stoq,代码行数:32,代码来源:cheque.py


示例10: _update_list

    def _update_list(self, sellable):
        assert isinstance(sellable, Sellable)
        try:
            sellable.check_taxes_validity()
        except TaxError as strerr:
            # If the sellable icms taxes are not valid, we cannot sell it.
            warning(strerr)
            return

        quantity = self.sellableitem_proxy.model.quantity

        is_service = sellable.service
        if is_service and quantity > 1:
            # It's not a common operation to add more than one item at
            # a time, it's also problematic since you'd have to show
            # one dialog per service item. See #3092
            info(_("It's not possible to add more than one service "
                   "at a time to an order. So, only one was added."))

        sale_item = TemporarySaleItem(sellable=sellable,
                                      quantity=quantity)
        if is_service:
            with api.trans() as store:
                rv = self.run_dialog(ServiceItemEditor, store, sale_item)
            if not rv:
                return
        self._update_added_item(sale_item)
开发者ID:romaia,项目名称:stoq,代码行数:27,代码来源:pos.py


示例11: return_sale

def return_sale(parent, sale, store):
    from stoqlib.gui.wizards.salereturnwizard import SaleReturnWizard

    cancel_last_coupon = sysparam.get_bool('ALLOW_CANCEL_LAST_COUPON')
    if cancel_last_coupon and ECFIsLastSaleEvent.emit(sale):
        info(_("That is last sale in ECF. Return using the menu "
               "ECF - Cancel Last Document"))
        return

    if sale.can_return():
        need_document = not sysparam.get_bool('ACCEPT_SALE_RETURN_WITHOUT_DOCUMENT')
        if need_document and not sale.get_client_document():
            warning(_('It is not possible to accept a returned sale from clients '
                      'without document. Please edit the client document or change '
                      'the sale client'))
            return

        returned_sale = sale.create_sale_return_adapter()
        retval = run_dialog(SaleReturnWizard, parent, store, returned_sale)
    elif sale.can_cancel():
        retval = cancel_sale(sale)
    else:
        retval = False

    return retval
开发者ID:Joaldino,项目名称:stoq,代码行数:25,代码来源:saleslave.py


示例12: validate_confirm

 def validate_confirm(self):
     try:
         self.model.allocate(self.quantity.read())
     except (ValueError, AssertionError):
         info(_(u'Can not allocate this quantity.'))
         return False
     return True
开发者ID:Guillon88,项目名称:stoq,代码行数:7,代码来源:productioneditor.py


示例13: _can_add_payment

    def _can_add_payment(self):
        if self.base_value.read() is ValueUnset:
            return False

        if self._outstanding_value <= 0:
            return False

        payments = self.model.group.get_valid_payments()
        payment_count = payments.find(
            Payment.method_id == self._method.id).count()
        if payment_count >= self._method.max_installments:
            info(_(u'You can not add more payments using the %s '
                   'payment method.') % self._method.description)
            return False

        # If we are creaing out payments (PurchaseOrder) or the Sale does not
        # have a client, assume all options available are creatable.
        if (isinstance(self.model, (PurchaseOrder, StockDecrease))
            or not self.model.client):
            return True

        method_values = {self._method: self._holder.value}
        for i, payment in enumerate(self.model.group.payments):
            method_values.setdefault(payment.method, 0)
            method_values[payment.method] += payment.value
        for method, value in method_values.items():
            try:
                self.model.client.can_purchase(method, value)
            except SellError as e:
                warning(str(e))
                return False

        return True
开发者ID:romaia,项目名称:stoq,代码行数:33,代码来源:paymentslave.py


示例14: _check_branch

    def _check_branch(self):
        from stoqlib.database.runtime import (get_default_store, new_store,
                                              get_current_station,
                                              set_current_branch_station)
        from stoqlib.domain.person import Company
        from stoqlib.lib.parameters import sysparam
        from stoqlib.lib.message import info

        default_store = get_default_store()

        compaines = default_store.find(Company)
        if (compaines.count() == 0 or
                not sysparam.has_object('MAIN_COMPANY')):
            from stoqlib.gui.base.dialogs import run_dialog
            from stoqlib.gui.dialogs.branchdialog import BranchDialog
            if self._ran_wizard:
                info(_("You need to register a company before start using Stoq"))
            else:
                info(_("Could not find a company. You'll need to register one "
                       "before start using Stoq"))
            store = new_store()
            person = run_dialog(BranchDialog, None, store)
            if not person:
                raise SystemExit
            branch = person.branch
            sysparam.set_object(store, 'MAIN_COMPANY', branch)
            current_station = get_current_station(store)
            if current_station is not None:
                current_station.branch = branch
            store.commit()
            store.close()

        set_current_branch_station(default_store, station_name=None)
开发者ID:hackedbellini,项目名称:stoq,代码行数:33,代码来源:shell.py


示例15: next_step

 def next_step(self):
     self.wizard.all_products = self.all_products.get_active()
     if self.wizard.is_for_another_branch() and self.model.identifier > 0:
         info(_('The identifier for this purchase will be defined when it '
                'is synchronized to the detination branch'))
         self.model.identifier = self.wizard.temporary_identifier
     return PurchaseItemStep(self.wizard, self, self.store, self.model)
开发者ID:Guillon88,项目名称:stoq,代码行数:7,代码来源:purchasewizard.py


示例16: _run_product_component_dialog

    def _run_product_component_dialog(self, product_component=None):
        update = True
        if product_component is None:
            update = False
            component = self.component_combo.get_selected_data()
            product_component = TemporaryProductComponent(
                product=self._product, component=component)
            # If we try to add a component which is already in tree,
            # just edit it
            for component in self.component_tree:
                if component.component == product_component.component:
                    update = True
                    product_component = component
                    break

        if not self._can_add_component(product_component):
            product_desc = self._product.sellable.get_description()
            component_desc = product_component.description
            info(_(u'You can not add this product as component, since '
                   '%s is composed by %s' % (component_desc, product_desc)))
            return

        toplevel = self.get_toplevel().get_toplevel()
        # We cant use savepoint here, since product_component
        # is not an ORM object.
        model = run_dialog(ProductComponentEditor, toplevel, self.store,
                           product_component)
        if not model:
            return

        if update:
            self.component_tree.update(model)
        else:
            self._add_to_component_tree(model)
        self._update_widgets()
开发者ID:amaurihamasu,项目名称:stoq,代码行数:35,代码来源:productslave.py


示例17: _set_done

 def _set_done(self):
     # XXX: Better text here
     info(_("Stoq.Link registration successful! You may "
            "manage your installation from there now"))
     self._done = True
     self.confirm()
     self._set_processing(False)
开发者ID:hackedbellini,项目名称:stoq,代码行数:7,代码来源:pindialog.py


示例18: _open_sintegra

    def _open_sintegra(self):
        branch = api.get_current_branch(self.app.store)
        if branch.manager is None:
            info(_("You must define a manager to this branch before you can create" " a sintegra archive"))
            return

        self.app.run_dialog(SintegraDialog, self.app.store)
开发者ID:relsi,项目名称:stoq,代码行数:7,代码来源:admin.py


示例19: checkout

    def checkout(self, cancel_clear=False):
        """Initiates the sale wizard to confirm sale.

        :param cancel_clear: If cancel_clear is true, the sale will be cancelled
          if the checkout is cancelled.
        """
        assert len(self.sale_items) >= 1

        if self._current_store:
            store = self._current_store
            savepoint = 'before_run_fiscalprinter_confirm'
            store.savepoint(savepoint)
        else:
            store = api.new_store()
            savepoint = None

        if self._trade:
            if self._get_subtotal() < self._trade.returned_total:
                info(_("Traded value is greater than the new sale's value. "
                       "Please add more items or return it in Sales app, "
                       "then make a new sale"))
                return

            sale = self._create_sale(store)
            self._trade.new_sale = sale
            self._trade.trade()
        else:
            sale = self._create_sale(store)

        if sysparam.get_bool('CONFIRM_SALES_ON_TILL'):
            sale.order()
            store.commit()
        else:
            assert self._coupon

            ordered = self._coupon.confirm(sale, store, savepoint,
                                           subtotal=self._get_subtotal())
            # Dont call store.confirm() here, since coupon.confirm()
            # above already did it
            if not ordered:
                # FIXME: Move to TEF plugin
                manager = get_plugin_manager()
                if manager.is_active('tef') or cancel_clear:
                    self._cancel_order(show_confirmation=False)
                elif not self._current_store:
                    # Just do that if a store was created above and
                    # if _cancel_order wasn't called (it closes the connection)
                    store.rollback(close=True)
                return

            log.info("Checking out")

        self._coupon = None
        POSConfirmSaleEvent.emit(sale, self.sale_items[:])

        # We must close the connection only after the event is emmited, since it
        # may use value from the sale that will become invalid after it is
        # closed
        store.close()
        self._clear_order()
开发者ID:reashninja,项目名称:stoq,代码行数:60,代码来源:pos.py


示例20: _setup_widgets

    def _setup_widgets(self):
        self.quoting_list.set_columns(self._get_columns())
        self._populate_quoting_list()

        if not len(self.quoting_list) > 0:
            info(_(u'No supplier have been found for any of the selected '
                   'items.\nThis quote will be cancelled.'))
            self.wizard.finish()
开发者ID:pkaislan,项目名称:stoq,代码行数:8,代码来源:purchasequotewizard.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python message.marker函数代码示例发布时间:2022-05-27
下一篇:
Python message.error函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap