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


Python formatters.format_quantity函数代码示例

本文整理汇总了Python中stoqlib.lib.formatters.format_quantity函数的典型用法代码示例。如果您正苦于以下问题:Python format_quantity函数的具体用法?Python format_quantity怎么用?Python format_quantity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _update_view

    def _update_view(self):
        diff = self._get_diff_quantity()

        self.quantity.update(format_quantity(self._get_total_sum()))
        self.diff_quantity.update(format_quantity(abs(diff)))
        self.diff_quantity_lbl.set_text(
            _("Missing quantity:") if diff >= 0 else
            _("Outstanding quantity:"))

        self._append_or_update_dumb_row()
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:10,代码来源:batchselectiondialog.py

示例2: _update_summary

    def _update_summary(self, results):
        total_quantity = reserved_quantity = total_price = 0
        for obj in results:
            total_quantity += obj.quantity
            reserved_quantity += obj.quantity_decreased
            total_price += obj.total

        self.quantity_label.set_label(_(u'Quantity: %s') %
                                      format_quantity(total_quantity))
        self.reserved_label.set_label(_(u'Delivered: %s') %
                                      format_quantity(reserved_quantity))
        self.total_label.set_label(_(u'Total: %s') %
                                   get_formatted_price(total_price))
开发者ID:hackedbellini,项目名称:stoq,代码行数:13,代码来源:salesearch.py

示例3: get_summary_row

    def get_summary_row(self):
        total_sales = len(self._sales)
        if self._total_amount > 0:
            total_percentage = self._total_value * 100 / self._total_payment
            average_sale = self._total_amount / total_sales
        else:
            total_percentage = 0
            average_sale = 0

        sales_label = stoqlib_ngettext('%d sale', '%d sales',
                                       total_sales) % total_sales
        # TODO: Create a better way to add more lines to the summary row
        total_sales_label = get_formatted_price(self._total_amount)
        if self._sales_person:
            total_sales_label += ' (' + _("%s/sale") % (
                get_formatted_price(average_sale, )) + ')'

        summary_row = [sales_label,
                       total_sales_label,
                       get_formatted_price(self._total_payment),
                       get_formatted_percentage(total_percentage),
                       get_formatted_price(self._total_value),
                       format_quantity(self._total_sold)]
        if not self._sales_person:
            summary_row.insert(1, '')
        return summary_row
开发者ID:relsi,项目名称:stoq,代码行数:26,代码来源:sale.py

示例4: test_get_quantity_received_as_string

 def test_get_quantity_received_as_string(self):
     item = self.create_purchase_order_item()
     item.quantity_received = 8
     item.sellable.unit = self.create_sellable_unit(description=u'XX')
     str = u"%s XX" % (format_quantity(item.quantity_received),)
     str_received = item.get_quantity_received_as_string()
     self.assertEquals(str, str_received)
开发者ID:pkaislan,项目名称:stoq,代码行数:7,代码来源:test_purchase.py

示例5: _format_quantity

 def _format_quantity(self, item, data):
     # FIXME: Why is this item sometimes None? It shouldn't ever be!
     if item is None:
         return ''
     if not item.changed:
         return ''
     return format_quantity(item.quantity)
开发者ID:pkaislan,项目名称:stoq,代码行数:7,代码来源:inventorywizard.py

示例6: _update_summary

    def _update_summary(self, klist):
        quantity = total = 0
        for obj in klist:
            quantity += obj.quantity
            total += obj.total_sold

        self.quantity_label.set_label(_(u'Total quantity: %s') % format_quantity(quantity))
        self.total_sold_label.set_label(_(u'Total sold: %s') % get_formatted_cost(total))
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:8,代码来源:productsearch.py

示例7: get_row

 def get_row(self, obj):
     data = [unicode(obj.identifier),
             get_formatted_price(obj.total_amount),
             get_formatted_price(obj.payment_amount),
             get_formatted_percentage(obj.commission_percentage),
             get_formatted_price(obj.commission_value),
             format_quantity(obj.quantity_sold)]
     if not self._sales_person:
         data.insert(1, obj.salesperson_name)
     return data
开发者ID:relsi,项目名称:stoq,代码行数:10,代码来源:sale.py

示例8: _format_func

    def _format_func(self, obj, data):
        quantity = getattr(obj, self.attribute) or 0
        quantity_str = format_quantity(quantity)

        sellable = getattr(obj, 'sellable', None)
        product = getattr(obj, 'product', None)

        # If the product does not manage stock and the quantity is 0, show an
        # infinite symbol istead
        if product and not product.manage_stock and not quantity:
            return u"\u221E"

        if sellable and sellable.unit:
            unit_desc = obj.sellable.unit.description
        elif hasattr(obj, 'unit'):
            unit_desc = obj.unit or ''
        else:
            unit_desc = ''

        data = '%s %s' % (quantity_str, unit_desc)
        return data.strip()
开发者ID:hackedbellini,项目名称:stoq,代码行数:21,代码来源:searchcolumns.py

示例9: _format_func

    def _format_func(self, obj, data):
        quantity = getattr(obj, self.attribute) or 0
        quantity_str = format_quantity(quantity)

        # The object must have a sellable and a product for this to work
        # properly. If not, just return the quantity. Dont use
        # sellable.product here to avoid to many queries
        sellable = getattr(obj, 'sellable', None)
        product = getattr(obj, 'product', None)
        if not sellable or not product:
            return quantity_str

        # If the product does not manage stock and the quantity is 0, show an
        # infinite symbol istead
        if not product.manage_stock and not quantity:
            return u"\u221E"

        if sellable.unit:
            unit_desc = obj.sellable.unit.description
        else:
            unit_desc = ''

        data = '%s %s' % (quantity_str, unit_desc)
        return data.strip()
开发者ID:Joaldino,项目名称:stoq,代码行数:24,代码来源:searchcolumns.py

示例10: quantity_received_as_string

 def quantity_received_as_string(self):
     return u"%s %s" % (format_quantity(self.quantity_received),
                        self.unit or u"")
开发者ID:Guillon88,项目名称:stoq,代码行数:3,代码来源:purchase.py

示例11: get_quantity_received_as_string

 def get_quantity_received_as_string(self):
     unit = self.sellable.unit
     return u"%s %s" % (format_quantity(self.quantity_received),
                        unit and unit.description or u"")
开发者ID:Guillon88,项目名称:stoq,代码行数:4,代码来源:purchase.py

示例12: _format_qty

 def _format_qty(self, quantity):
     if quantity is ValueUnset:
         return None
     if quantity >= 0:
         return format_quantity(quantity)
开发者ID:romaia,项目名称:stoq,代码行数:5,代码来源:productcountingdialog.py

示例13: format_data

def format_data(data):
    # must return zero or relatory show None instead of 0
    if data is None:
        return 0
    return format_quantity(data)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:5,代码来源:product.py

示例14: get_quantity_as_string

 def get_quantity_as_string(self):
     return u"%s %s" % (format_quantity(self.quantity),
                        self.unit or u"")
开发者ID:pkaislan,项目名称:stoq,代码行数:3,代码来源:purchase.py


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