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

Python api.new_store函数代码示例

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

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



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

示例1: run_wizard

    def run_wizard(cls, parent):
        """Run the wizard to create a product

        This will run the wizard and after finishing, ask if the user
        wants to create another product alike. The product will be
        cloned and `stoqlib.gui.editors.producteditor.ProductEditor`
        will run as long as the user chooses to create one alike
        """
        with api.new_store() as store:
            rv = run_dialog(cls, parent, store)

        if rv:
            inner_rv = rv

            while yesno(_("Would you like to register another product alike?"),
                        gtk.RESPONSE_NO, _("Yes"), _("No")):
                with api.new_store() as store:
                    template = store.fetch(rv)
                    inner_rv = run_dialog(ProductEditor, parent, store,
                                          product_type=template.product_type,
                                          template=template)

                if not inner_rv:
                    break

        # We are insterested in the first rv that means that at least one
        # obj was created.
        return rv
开发者ID:Guillon88,项目名称:stoq,代码行数:28,代码来源:productwizard.py


示例2: _edit_item

 def _edit_item(self, item):
     store = api.new_store()
     parameter = store.fetch(item)
     retval = run_dialog(SystemParameterEditor, self, store, parameter)
     if store.confirm(retval):
         self.results.update(item)
     store.close()
开发者ID:pkaislan,项目名称:stoq,代码行数:7,代码来源:parametersearch.py


示例3: on_LoanClose__activate

 def on_LoanClose__activate(self, action):
     if self.check_open_inventory():
         return
     store = api.new_store()
     model = self.run_dialog(CloseLoanWizard, store)
     store.confirm(model)
     store.close()
开发者ID:dionimf,项目名称:stoq,代码行数:7,代码来源:sales.py


示例4: _create_client

 def _create_client(self):
     store = api.new_store()
     client = run_person_role_dialog(ClientEditor, self.wizard, store, None)
     store.confirm(client)
     client = self.store.fetch(client)
     store.close()
     if not client:
         return
     if len(self.client) == 0:
         self._fill_clients_combo()
         return
     clients = self.client.get_model_items().values()
     if client in clients:
         if client.is_active:
             self.client.select(client)
         else:
             # remove client from combo
             self.client.select_item_by_data(client)
             iter = self.client.get_active_iter()
             model = self.client.get_model()
             model.remove(iter)
             # just in case the inactive client was selected before.
             self.client.select_item_by_position(0)
     elif client.is_active:
         self.client.append_item(client.person.name, client)
         self.client.select(client)
     self._update_widgets()
开发者ID:romaia,项目名称:stoq,代码行数:27,代码来源:salewizard.py


示例5: _send_selected_items_to_supplier

    def _send_selected_items_to_supplier(self):
        orders = self.results.get_selected_rows()
        valid_order_views = [
            order for order in orders
            if order.status == PurchaseOrder.ORDER_PENDING]

        if not valid_order_views:
            warning(_("There are no pending orders selected."))
            return

        msg = stoqlib_ngettext(
            _("The selected order will be marked as sent."),
            _("The %d selected orders will be marked as sent.")
            % len(valid_order_views),
            len(valid_order_views))
        confirm_label = stoqlib_ngettext(_("Confirm order"),
                                         _("Confirm orders"),
                                         len(valid_order_views))
        if not yesno(msg, gtk.RESPONSE_YES, confirm_label, _("Don't confirm")):
            return

        with api.new_store() as store:
            for order_view in valid_order_views:
                order = store.fetch(order_view.purchase)
                order.confirm()
        self.refresh()
        self.select_result(orders)
开发者ID:amaurihamasu,项目名称:stoq,代码行数:27,代码来源:purchase.py


示例6: _run_quote_editor

 def _run_quote_editor(self):
     store = api.new_store()
     selected = store.fetch(self.search.results.get_selected().purchase)
     retval = run_dialog(QuoteFillingDialog, self.wizard, selected, store)
     store.confirm(retval)
     store.close()
     self._update_view()
开发者ID:pkaislan,项目名称:stoq,代码行数:7,代码来源:purchasequotewizard.py


示例7: _work

    def _work(self):
        selection = self.search.get_selected_item()
        with api.new_store() as store:
            work_order = store.fetch(selection.work_order)
            work_order.work()

        self._update_view(select_item=selection)
开发者ID:igorferreira,项目名称:stoq,代码行数:7,代码来源:services.py


示例8: 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')
        # A plugin (e.g. ECF) can avoid the cancelation of a sale
        # because it wants it to be cancelled using another way
        if can_cancel and SaleAvoidCancelEvent.emit(sale_view.sale):
            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:Guillon88,项目名称:stoq,代码行数:27,代码来源:sales.py


示例9: on_create_client__clicked

    def on_create_client__clicked(self, button):
        with api.new_store() as store:
            client = run_person_role_dialog(ClientEditor, self, store, None)

        if store.committed:
            self._fill_clients_combo()
            self.client.select(client.id)
开发者ID:barkinet,项目名称:stoq,代码行数:7,代码来源:saleeditor.py


示例10: _open_inventory

    def _open_inventory(self):
        with api.new_store() as store:
            rv = self.run_dialog(InventoryOpenEditor, store)

        if rv:
            self.refresh()
            self._update_widgets()
开发者ID:barkinet,项目名称:stoq,代码行数:7,代码来源:inventory.py


示例11: _on_WorkOrderStatusChangedEvent

    def _on_WorkOrderStatusChangedEvent(self, order, old_status):
        if old_status == WorkOrder.STATUS_OPENED:
            #Do nothing at this point.
            return

        optical_wo = OpticalWorkOrder.find_by_work_order(order.store, order)
        # If there is no optical WO, nothing to do here
        if optical_wo is None:
            return

        if optical_wo.can_create_purchase():
            with api.new_store() as store:
                rv = run_dialog(OpticalSupplierEditor, None, store, order)
            if not rv:
                # Return None to let the status be changed without creating a purchase order
                return

            order.supplier_order = rv.supplier_order
            optical_wo.create_purchase(order.store.fetch(rv.supplier),
                                       order.store.fetch(rv.item),
                                       rv.is_freebie)
            return

        for purchase in PurchaseOrder.find_by_work_order(order.store, order):
            if optical_wo.can_receive_purchase(purchase):
                optical_wo.receive_purchase(purchase, reserve=True)
开发者ID:hackedbellini,项目名称:stoq,代码行数:26,代码来源:opticalui.py


示例12: edit_order

    def edit_order(self, work_order):
        with api.new_store() as store:
            self.run_dialog(WorkOrderEditor, store,
                            model=store.fetch(work_order))

        if store.committed:
            self.emit('model-edited', work_order)
开发者ID:hackedbellini,项目名称:stoq,代码行数:7,代码来源:workorder.py


示例13: on_NewTrade__activate

    def on_NewTrade__activate(self, action):
        if self._trade:
            if yesno(
                    _("There is already a trade in progress... Do you "
                      "want to cancel it and start a new one?"),
                    gtk.RESPONSE_NO, _("Cancel trade"), _("Finish trade")):
                self._clear_trade(remove=True)
            else:
                return

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

        trade = self.run_dialog(SaleTradeWizard, store)
        if trade:
            self._trade = trade
            self._current_store = store
        elif self._current_store:
            store.rollback_to_savepoint('before_run_wizard_saletrade')
        else:
            store.rollback(close=True)

        self._show_trade_infobar(trade)
开发者ID:pkaislan,项目名称:stoq,代码行数:26,代码来源:pos.py


示例14: run_editor

    def run_editor(self, obj=None):
        store = api.new_store()
        product = self.run_dialog(self.editor_class, self, store,
                                  store.fetch(obj), visual_mode=self._read_only)

        # This means we are creating a new product. After that, add the
        # current supplier as the supplier for this product
        if (obj is None and product
            and not product.is_supplied_by(self._supplier)):
            ProductSupplierInfo(store=store,
                                supplier=store.fetch(self._supplier),
                                product=product,
                                base_cost=product.sellable.cost,
                                is_main_supplier=True)

        if store.confirm(product):
            # If the return value is an ORMObject, fetch it from
            # the right connection
            if isinstance(product, ORMObject):
                product = type(product).get(product.id, store=self.store)

            # If we created a new object, confirm the dialog automatically
            if obj is None:
                self.confirm(product)
                store.close()
                return
        store.close()

        return product
开发者ID:leandrorchaves,项目名称:stoq,代码行数:29,代码来源:abstractwizard.py


示例15: _delete_model

 def _delete_model(self, model):
     if self._reuse_store:
         self._delete_with_transaction(model, self._reuse_store)
     else:
         store = api.new_store()
         self._delete_with_transaction(model, store)
         store.commit(close=True)
开发者ID:rosalin,项目名称:stoq,代码行数:7,代码来源:lists.py


示例16: _open_production_order

 def _open_production_order(self, order=None):
     store = api.new_store()
     order = store.fetch(order)
     retval = self.run_dialog(ProductionWizard, store, order)
     store.confirm(retval)
     store.close()
     self.refresh()
开发者ID:LeonamSilva,项目名称:stoq,代码行数:7,代码来源:production.py


示例17: on_further_details_button__clicked

 def on_further_details_button__clicked(self, *args):
     store = api.new_store()
     model = store.fetch(self.model)
     run_person_role_dialog(ClientEditor, self, store,
                            model, visual_mode=True)
     store.confirm(False)
     store.close()
开发者ID:hackedbellini,项目名称:stoq,代码行数:7,代码来源:clientdetails.py


示例18: _receive

    def _receive(self):
        with api.new_store() as store:
            till = Till.get_current(store)
            assert till

            in_payment = self.results.get_selected()
            payment = store.fetch(in_payment.payment)
            assert self._can_receive(payment)

            retval = run_dialog(SalePaymentConfirmSlave, self, store,
                                payments=[payment], show_till_info=False)
            if not retval:
                return

            try:
                TillAddCashEvent.emit(till=till, value=payment.value)
            except (TillError, DeviceError, DriverError) as e:
                warning(str(e))
                return

            till_entry = till.add_credit_entry(payment.value,
                                               _(u'Received payment: %s') % payment.description)

            TillAddTillEntryEvent.emit(till_entry, store)

        if store.committed:
            self.search.refresh()
开发者ID:hackedbellini,项目名称:stoq,代码行数:27,代码来源:paymentreceivingsearch.py


示例19: _run_category_editor

 def _run_category_editor(self, category=None):
     with api.new_store() as store:
         rv = run_dialog(WorkOrderCategoryEditor, self, store, category,
                         visual_mode=self.visual_mode)
     if rv:
         self._fill_categories_combo()
         self.category.select(self.store.fetch(rv))
开发者ID:Guillon88,项目名称:stoq,代码行数:7,代码来源:workordereditor.py


示例20: _edit

    def _edit(self, payable_views):
        with api.new_store() as store:
            order = store.fetch(payable_views[0].purchase)
            run_dialog(PurchasePaymentsEditor, self, store, order)

        if store.committed:
            self.refresh()
开发者ID:barkinet,项目名称:stoq,代码行数:7,代码来源:payable.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python api.prepare_test函数代码示例发布时间:2022-05-27
下一篇:
Python api.get_default_store函数代码示例发布时间: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