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


Python Report.selling_price方法代码示例

本文整理汇总了Python中models.Report.selling_price方法的典型用法代码示例。如果您正苦于以下问题:Python Report.selling_price方法的具体用法?Python Report.selling_price怎么用?Python Report.selling_price使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Report的用法示例。


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

示例1: save_b

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import selling_price [as 别名]
 def save_b(self):
     ''' add operation '''
     # entete de la facture
     if not self.table_buy.isvalid:
         return False
     owner = Owner.get(Owner.islog == True)
     date = str(self.date.text())
     values_t = self.table_buy.get_table_items()
     buy = Buy()
     # buy.date = datetime_
     buy.provd_or_clt = \
         ProviderOrClient.get_or_create(
             "Fournisseur", 000000, ProviderOrClient.FSEUR)
     buy.owner = owner
     try:
         buy.save()
         err = False
     except:
         raise
         raise_error(
             "Erreur", u"Impossible d'enregistrer l'entête de la facture")
         return False
     for name, qty, cost_buying, selling_price in values_t:
         rep = Report()
         rep.buy = buy
         rep.type_ = Report.E
         rep.store = 1
         rep.date = date_to_datetime(date)
         rep.product = Product.get(name=name)
         rep.qty = int(qty)
         rep.cost_buying = int(cost_buying)
         rep.selling_price = int(selling_price)
         try:
             rep.save()
         except Exception as e:
             print(e)
             err = True
     if err:
         buy.delete_instance()
         raise_error("Erreur", u"Ce mouvement n'a pas pu etre "
                     u"enregistré dans les rapports")
         return False
     else:
         self.parent.Notify(u"L'entrée des articles avec succès", "success")
     self.change_main_context(BuyShowViewWidget, buy=buy)
开发者ID:Ciwara,项目名称:GCiss,代码行数:47,代码来源:buy.py

示例2: save_b

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import selling_price [as 别名]
    def save_b(self):
        ''' add operation '''
        # entete de la facture
        print("save")
        if not self.is_valide():
            return
        invoice_date = unicode(self.invoice_date.text())
        num_invoice = int(self.num_invoice.text())
        invoice_type = self.liste_type_invoice[
            self.box_type_inv.currentIndex()]
        lis_error = []
        invoice = Invoice()
        try:
            self.owner = Owner.get(Owner.islog == True)
        except:
            lis_error.append("Aucun utilisateur est connecté <br/>")
        paid_amount = int(self.table_invoice.paid_amount_field.text())
        try:
            clt = ProviderOrClient.get_or_create(
                self.name_client, int(self.phone.replace(" ", "")), ProviderOrClient.CLT)
        except ValueError:
            field_error(
                self.name_client_field, "Nom, numéro de téléphone du client")
        invoice.number = num_invoice
        invoice.owner = self.owner
        invoice.client = clt
        invoice.location = "Bamako"
        invoice.type_ = invoice_type
        invoice.subject = ""
        invoice.paid_amount = paid_amount
        invoice.tax = False
        try:
            invoice.save()
            if int(paid_amount) != 0 or invoice_type == Invoice.TYPE_BON:
                Refund(type_=Refund.DT, owner=self.owner, amount=paid_amount,
                       date=date_to_datetime(invoice_date), provider_client=clt,
                       invoice=Invoice.get(number=num_invoice)).save()
        except Exception as e:
            invoice.deletes_data()
            lis_error.append(
                "Erreur sur l'enregistrement d'entête de facture<br/>")
            return False
        # Save invoiceitems
        invoice = Invoice.get(Invoice.number == num_invoice)
        for name, qty, price in self.table_invoice.get_table_items():
            rep = Report()
            product = Product.get(Product.name == name)
            rep.store = 1
            rep.product = product
            rep.invoice = invoice
            rep.type_ = Report.S
            rep.cost_buying = int(product.last_report.cost_buying)
            rep.date = date_to_datetime(invoice_date)
            rep.qty = int(qty)
            rep.selling_price = int(price)
            try:
                rep.save()
            except Exception as e:
                lis_error.append(e)
        if lis_error != []:
            invoice.delete_instance()
            self.parent.Notify(lis_error, "error")
            return False
        else:
            self.parent.Notify("Facture Enregistrée avec succès", "success")

            self.change_main_context(ShowInvoiceViewWidget,
                                     invoice_num=invoice.number)
开发者ID:Ciwara,项目名称:GCiss,代码行数:70,代码来源:invoice.py


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