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


Python Sale.order方法代碼示例

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


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

示例1: process_one

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


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