當前位置: 首頁>>代碼示例>>Python>>正文


Python WorkOrder.find_by_sale方法代碼示例

本文整理匯總了Python中stoqlib.domain.workorder.WorkOrder.find_by_sale方法的典型用法代碼示例。如果您正苦於以下問題:Python WorkOrder.find_by_sale方法的具體用法?Python WorkOrder.find_by_sale怎麽用?Python WorkOrder.find_by_sale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在stoqlib.domain.workorder.WorkOrder的用法示例。


在下文中一共展示了WorkOrder.find_by_sale方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: print_quote_details

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
 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,代碼行數:9,代碼來源:opticalwizard.py

示例2: _on_PrintReportEvent

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:12,代碼來源:opticalui.py

示例3: on_Confirm__activate

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:13,代碼來源:till.py

示例4: on_Confirm__activate

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:14,代碼來源:till.py

示例5: _confirm_order

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:55,代碼來源:till.py

示例6: _fill_wo_categories_combo

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:15,代碼來源:workorderquotewizard.py

示例7: test_find_by_sale

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:16,代碼來源:test_workorder.py

示例8: edit

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:17,代碼來源:sale.py

示例9: _fill_wo_categories_combo

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:19,代碼來源:opticalwizard.py

示例10: _confirm_order

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:47,代碼來源:till.py

示例11: _create_ui

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:20,代碼來源:workorderquotewizard.py

示例12: edit

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
    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,代碼行數:21,代碼來源:saleslave.py

示例13: select_wizard

# 需要導入模塊: from stoqlib.domain.workorder import WorkOrder [as 別名]
# 或者: from stoqlib.domain.workorder.WorkOrder import find_by_sale [as 別名]
 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,代碼行數:8,代碼來源:opticalui.py


注:本文中的stoqlib.domain.workorder.WorkOrder.find_by_sale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。