当前位置: 首页>>代码示例>>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;未经允许,请勿转载。