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


Python workorder.WorkOrder类代码示例

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


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

示例1: print_quote_details

 def print_quote_details(self, model, payments_created=False):
     msg = _('Would you like to print the quote details now?')
     # We can only print the details if the quote was confirmed.
     if yesno(msg, gtk.RESPONSE_YES,
              _("Print quote details"), _("Don't print")):
         orders = WorkOrder.find_by_sale(self.model.store, self.model)
         print_report(OpticalWorkOrderReceiptReport, list(orders))
开发者ID:qman1989,项目名称:stoq,代码行数:7,代码来源:opticalwizard.py

示例2: _on_PrintReportEvent

    def _on_PrintReportEvent(self, report_class, *args, **kwargs):
        if issubclass(report_class, SaleOrderReport):
            sale = args[0]
            store = sale.store
            workorders = list(WorkOrder.find_by_sale(store, sale))
            if len(workorders):
                print_report(OpticalWorkOrderReceiptReport, workorders)
                return True

        return False
开发者ID:Guillon88,项目名称:stoq,代码行数:10,代码来源:opticalui.py

示例3: on_Confirm__activate

    def on_Confirm__activate(self, action):
        selected = self.results.get_selected()

        # If there are unfinished workorders associated with the sale, we
        # cannot print the coupon yet. Instead lets just create the payments.
        workorders = WorkOrder.find_by_sale(self.store, selected.sale)
        if not all(wo.can_close() for wo in workorders):
            self._create_sale_payments(selected)
        else:
            self._confirm_order(selected)
        self._update_total()
开发者ID:esosaja,项目名称:stoq,代码行数:11,代码来源:till.py

示例4: on_Confirm__activate

    def on_Confirm__activate(self, action):
        selected = self.results.get_selected()
        query = WorkOrder.status != WorkOrder.STATUS_WORK_FINISHED

        # If there are unfinished workorders associated with the sale, we
        # cannot print the coupon yet. Instead lets just create the payments.
        unfinished = WorkOrder.find_by_sale(self.store, selected.sale).find(query)
        if not unfinished.is_empty():
            self._create_sale_payments(selected)
        else:
            self._confirm_order(selected)
        self._update_total()
开发者ID:leandrorchaves,项目名称:stoq,代码行数:12,代码来源:till.py

示例5: _confirm_order

    def _confirm_order(self, order_view):
        if self.check_open_inventory():
            return

        store = api.new_store()
        sale = store.fetch(order_view.sale)
        expire_date = sale.expire_date

        if (sale.status == Sale.STATUS_QUOTE and
            expire_date and expire_date.date() < date.today() and
            not yesno(_("This quote has expired. Confirm it anyway?"),
                      gtk.RESPONSE_YES,
                      _("Confirm quote"), _("Don't confirm"))):
            store.close()
            return

        missing = get_missing_items(sale, store)

        if missing:
            retval = run_dialog(MissingItemsDialog, self, sale, missing)
            if retval:
                self.refresh()
            store.close()
            return

        coupon = self._open_coupon(sale)
        if not coupon:
            store.close()
            return
        subtotal = self._add_sale_items(sale, coupon)
        try:
            if coupon.confirm(sale, store, subtotal=subtotal):
                workorders = WorkOrder.find_by_sale(store, sale)
                for order in workorders:
                    # at this poing, orders could be either FINISHED or
                    # DELIVERED (closed). If it is finished, we should close it
                    # (mark delivered) ...
                    if order.can_close():
                        order.close()
                    else:
                        # ... but if it didn't need closing, it should already
                        # be delivered.
                        assert order.is_finished()
                store.commit()
                self.refresh()
            else:
                coupon.cancel()
        except SellError as err:
            warning(str(err))
        except ModelDataError as err:
            warning(str(err))

        store.close()
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:53,代码来源:till.py

示例6: _fill_wo_categories_combo

    def _fill_wo_categories_combo(self):
        wo_categories = list(self.store.find(WorkOrderCategory))
        self.wo_categories.color_attribute = 'color'

        self.wo_categories.prefill(
            api.for_combo(wo_categories, empty=_("No category")))
        self.wo_categories.set_sensitive(len(wo_categories))

        # We can use any work order, since all workorders in the same sale are
        # sharing the same category.
        workorder = WorkOrder.find_by_sale(self.store, self.model).any()
        if workorder and workorder.category:
            self.wo_categories.select(workorder.category)
开发者ID:pkaislan,项目名称:stoq,代码行数:13,代码来源:workorderquotewizard.py

示例7: test_find_by_sale

    def test_find_by_sale(self):
        workorder1 = self.create_workorder()
        workorder2 = self.create_workorder()
        workorder3 = self.create_workorder()

        sale = self.create_sale()
        workorder1.sale = sale
        workorder2.sale = sale

        workorders = list(WorkOrder.find_by_sale(self.store, sale))
        self.assertEquals(len(workorders), 2)
        self.assertIn(workorder1, workorders)
        self.assertIn(workorder2, workorders)
        self.assertNotIn(workorder3, workorders)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:14,代码来源:test_workorder.py

示例8: edit

    def edit(self, sale):
        with api.new_store() as store:
            sale = store.fetch(sale)

            # If we have work orders on the sale (the sale is a pre-sale), we need
            # to run WorkOrderQuoteWizard instead of SaleQuoteWizard
            has_workorders = not WorkOrder.find_by_sale(store, sale).is_empty()
            if has_workorders:
                wizard = WorkOrderQuoteWizard
            else:
                wizard = SaleQuoteWizard
            self.run_dialog(wizard, store, sale)

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

示例9: _fill_wo_categories_combo

    def _fill_wo_categories_combo(self):
        wo_categories = list(self.store.find(WorkOrderCategory))
        self.wo_categories.color_attribute = 'color'

        if len(wo_categories) > 0:
            items = [(category.get_description(), category)
                     for category in wo_categories]
            items = locale_sorted(items, key=operator.itemgetter(0))
            items.insert(0, ('No category', None))
            self.wo_categories.prefill(items)
            self.wo_categories.set_sensitive(True)

        # We can use any work order, since all workorders in the same sale are
        # sharing the same category.
        workorder = WorkOrder.find_by_sale(self.store, self.model).any()
        if workorder and workorder.category:
            self.wo_categories.select(workorder.category)
开发者ID:qman1989,项目名称:stoq,代码行数:17,代码来源:opticalwizard.py

示例10: _confirm_order

    def _confirm_order(self, order_view):
        if self.check_open_inventory():
            return

        store = api.new_store()
        sale = store.fetch(order_view.sale)
        expire_date = sale.expire_date

        if (sale.status == Sale.STATUS_QUOTE and
            expire_date and expire_date.date() < date.today() and
            not yesno(_("This quote has expired. Confirm it anyway?"),
                      gtk.RESPONSE_YES,
                      _("Confirm quote"), _("Don't confirm"))):
            store.close()
            return

        missing = get_missing_items(sale, store)

        if missing:
            retval = run_dialog(MissingItemsDialog, self, sale, missing)
            if retval:
                self.refresh()
            store.close()
            return

        coupon = self._open_coupon()
        if not coupon:
            store.close()
            return
        subtotal = self._add_sale_items(sale, coupon)
        try:
            if coupon.confirm(sale, store, subtotal=subtotal):
                workorders = WorkOrder.find_by_sale(store, sale)
                for order in workorders:
                    order.close()
                store.commit()
                self.refresh()
            else:
                coupon.cancel()
        except SellError as err:
            warning(str(err))
        except ModelDataError as err:
            warning(str(err))

        store.close()
开发者ID:esosaja,项目名称:stoq,代码行数:45,代码来源:till.py

示例11: _create_ui

    def _create_ui(self):
        new_button = gtk.Button(gtk.STOCK_NEW)
        new_button.set_use_stock(True)
        new_button.set_relief(gtk.RELIEF_NONE)
        new_button.show()
        new_button.connect('clicked', self._on_new_work_order__clicked)
        self.work_orders_nb.set_action_widget(new_button, gtk.PACK_END)
        self.new_tab_button = new_button

        saved_orders = list(WorkOrder.find_by_sale(self.store, self.model))
        # This sale does not have any work order yet. Create the first for it
        if not saved_orders:
            self._add_work_order(self._create_work_order())
            return

        # This sale already have some orders, restore them so the user can edit
        for order in saved_orders:
            self._add_work_order(order)
开发者ID:pkaislan,项目名称:stoq,代码行数:18,代码来源:workorderquotewizard.py

示例12: edit

    def edit(self, sale_view=None):
        if sale_view is None:
            sale_view = self.sales.get_selected()
        store = api.new_store()
        sale = store.fetch(sale_view.sale)

        # If we have work orders on the sale (the sale is a pre-sale), we need
        # to run WorkOrderQuoteWizard instead of SaleQuoteWizard
        has_workorders = not WorkOrder.find_by_sale(store, sale).is_empty()
        if has_workorders:
            wizard = WorkOrderQuoteWizard
        else:
            wizard = SaleQuoteWizard
        model = run_dialog(wizard, self.parent, store, sale)
        retval = store.confirm(model)
        store.close()

        if retval:
            self.emit('sale-edited', retval)
开发者ID:hackedbellini,项目名称:stoq,代码行数:19,代码来源:saleslave.py

示例13: select_wizard

 def select_wizard(store, model=None):
     if not model:
         return
     has_workorders = not WorkOrder.find_by_sale(store, model).is_empty()
     if has_workorders:
         return OpticalSaleQuoteWizard
开发者ID:reashninja,项目名称:stoq,代码行数:6,代码来源:opticalui.py


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