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


Python sale.Sale類代碼示例

本文整理匯總了Python中stoqlib.domain.sale.Sale的典型用法代碼示例。如果您正苦於以下問題:Python Sale類的具體用法?Python Sale怎麽用?Python Sale使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: create_sale

    def create_sale(self, id_=None, branch=None, client=None):
        from stoqlib.domain.sale import Sale
        from stoqlib.domain.till import Till

        till = Till.get_current(self.store)
        if till is None:
            till = self.create_till()
            till.open_till()
        salesperson = self.create_sales_person()
        group = self.create_payment_group()
        if client:
            group.payer = client.person

        sale = Sale(
            coupon_id=0,
            open_date=TransactionTimestamp(),
            salesperson=salesperson,
            branch=branch or get_current_branch(self.store),
            cfop=sysparam(self.store).DEFAULT_SALES_CFOP,
            group=group,
            client=client,
            store=self.store,
        )
        if id_:
            sale.id = id_
            sale.identifier = id_
        return sale
開發者ID:rosalin,項目名稱:stoq,代碼行數:27,代碼來源:exampledata.py

示例2: _setup_widgets

    def _setup_widgets(self):
        self.main_dialog.ok_button.set_label(gtk.STOCK_PRINT)

        if self.model.invoice_number is not None:
            self.invoice_number.set_sensitive(False)
        else:
            last_invoice_number = Sale.get_last_invoice_number(self.store) or 0
            self.invoice_number.update(last_invoice_number + 1)
開發者ID:leandrorchaves,項目名稱:stoq,代碼行數:8,代碼來源:invoicedialog.py

示例3: setup_widgets

    def setup_widgets(self):
        marker('Setting up widgets')
        # Only quotes have expire date.
        self.expire_date.hide()
        self.expire_label.hide()

        # Hide operation nature widgets
        self.operation_nature.hide()
        self.nature_lbl.hide()

        # Hide client category widgets
        self.client_category_lbl.hide()
        self.client_category.hide()

        # if the NF-e plugin is active, the client is mandantory in this
        # wizard (in this situation, we have only quote sales).
        if self.model.status == Sale.STATUS_QUOTE:
            manager = get_plugin_manager()
            mandatory_client = manager.is_active('nfe')
            self.client.set_property('mandatory', mandatory_client)

        marker('Filling sales persons')
        salespersons = self.store.find(SalesPerson)
        self.salesperson.prefill(api.for_person_combo(salespersons))
        marker('Finished filling sales persons')

        marker('Read parameter')
        if not sysparam(self.store).ACCEPT_CHANGE_SALESPERSON:
            self.salesperson.set_sensitive(False)
        else:
            self.salesperson.grab_focus()
        marker('Finished reading parameter')
        self._fill_clients_combo()
        self._fill_transporter_combo()
        self._fill_cost_center_combo()

        if sysparam(self.store).ASK_SALES_CFOP:
            self._fill_cfop_combo()
        else:
            self.cfop_lbl.hide()
            self.cfop.hide()
            self.create_cfop.hide()

        # the maximum number allowed for an invoice is 999999999.
        self.invoice_number.set_adjustment(
            gtk.Adjustment(lower=1, upper=999999999, step_incr=1))

        if not self.model.invoice_number:
            new_invoice_number = Sale.get_last_invoice_number(self.store) + 1
            self.invoice_model.invoice_number = new_invoice_number
        else:
            new_invoice_number = self.model.invoice_number
            self.invoice_model.invoice_number = new_invoice_number
            self.invoice_number.set_sensitive(False)

        self.invoice_model.original_invoice = new_invoice_number
        marker('Finished setting up widgets')
開發者ID:romaia,項目名稱:stoq,代碼行數:57,代碼來源:salewizard.py

示例4: _create_sale

    def _create_sale(self, store):
        user = api.get_current_user(store)
        branch = api.get_current_branch(store)
        salesperson = user.person.salesperson
        cfop_id = api.sysparam.get_object_id('DEFAULT_SALES_CFOP')
        nature = api.sysparam.get_string('DEFAULT_OPERATION_NATURE')
        group = PaymentGroup(store=store)
        sale = Sale(
            store=store,
            branch=branch,
            salesperson=salesperson,
            group=group,
            cfop_id=cfop_id,
            coupon_id=None,
            operation_nature=nature)

        if self._delivery:
            sale.client = store.fetch(self._delivery.client)
            sale.storeporter = store.fetch(self._delivery.transporter)
            delivery = Delivery(
                store=store,
                address=store.fetch(self._delivery.address),
                transporter=store.fetch(self._delivery.transporter),
            )
        else:
            delivery = None
            sale.client = self._suggested_client

        for fake_sale_item in self.sale_items:
            sale_item = sale.add_sellable(
                store.fetch(fake_sale_item.sellable),
                price=fake_sale_item.price,
                quantity=fake_sale_item.quantity,
                quantity_decreased=fake_sale_item.quantity_decreased,
                batch=store.fetch(fake_sale_item.batch))
            sale_item.notes = fake_sale_item.notes
            sale_item.estimated_fix_date = fake_sale_item.estimated_fix_date

            if delivery and fake_sale_item.deliver:
                delivery.add_item(sale_item)
            elif delivery and fake_sale_item == self._delivery_item:
                delivery.service_item = sale_item

        return sale
開發者ID:pkaislan,項目名稱:stoq,代碼行數:44,代碼來源:pos.py

示例5: process_one

    def process_one(self, data, fields, store):
        person = store.find(Person, name=data.branch_name).one()
        if person is None or person.branch is None:
            raise ValueError(u"%s is not a valid branch" % (
                data.branch_name, ))
        branch = person.branch

        person = store.find(Person, name=data.client_name).one()
        if person is None or person.client is None:
            raise ValueError(u"%s is not a valid client" % (
                data.client_name, ))
        client = person.client

        person = store.find(Person, name=data.salesperson_name).one()
        if person is None or person.salesperson is None:
            raise ValueError(u"%s is not a valid sales person" % (
                data.salesperson_name, ))
        salesperson = person.salesperson
        group = PaymentGroup(store=store)
        sale = Sale(client=client,
                    open_date=self.parse_date(data.open_date),
                    coupon_id=int(data.coupon_id),
                    invoice_number=int(data.coupon_id),
                    salesperson=salesperson,
                    branch=branch,
                    cfop=sysparam(store).DEFAULT_SALES_CFOP,
                    group=group,
                    store=store)

        total_price = 0
        for product in self.parse_multi(Product, data.product_list, store):
            sale.add_sellable(product.sellable)
            total_price += product.sellable.price

        sale.order()
        method = PaymentMethod.get_by_name(store, data.payment_method)
        method.create_inpayment(group, branch, total_price,
                                self.parse_date(data.due_date))
        sale.confirm()
        #XXX: The payments are paid automatically when a sale is confirmed.
        #     So, we will change all the payment paid_date to the same date
        #     as open_date, then we can test the reports properly.
        for payment in sale.payments:
            if payment.is_paid():
                p = store.fetch(payment)
                p.paid_date = self.parse_date(data.open_date)
開發者ID:romaia,項目名稱:stoq,代碼行數:46,代碼來源:saleimporter.py

示例6: get_subtitle

 def get_subtitle(self):
     return _(u'Number: %s - Sale %s on %s') % (
         self.order.identifier,
         Sale.get_status_name(self.order.status),
         self._get_status_date(self.order.status).strftime('%x'))
開發者ID:relsi,項目名稱:stoq,代碼行數:5,代碼來源:sale.py


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