コード例 #1
0
 def _get_received_columns(self):
     return [Column('description', title=_('Description'), data_type=str,
                    expand=True, searchable=True, sorted=True,
                    ellipsize=Pango.EllipsizeMode.END),
             QuantityColumn('quantity_received', title=_('Qty Received')),
             Column('cost', title=_('Cost'), data_type=currency,
                    format_func=get_formatted_cost),
             Column('total_received', title=_('Total'), data_type=currency),
             QuantityColumn('current_stock', title=_('Current Stock')),
             ]
コード例 #2
0
ファイル: test_search.py プロジェクト: 5l1v3r1/stoq-1
    def test_format_func(self):
        class Fake(object):
            quantity = 0

        column = QuantityColumn('quantity')
        obj = Fake()

        obj.quantity = None
        self.assertEqual(column._format_func(obj, True), '0')

        obj.quantity = 0
        self.assertEqual(column._format_func(obj, True), '0')

        obj.quantity = 1
        self.assertEqual(column._format_func(obj, True), '1')

        obj.product = self.create_product()
        obj.sellable = obj.product.sellable

        # Without a unit, it should still return just the number
        obj.quantity = 1
        self.assertEqual(column._format_func(obj, True), '1')

        obj.sellable.unit = self.create_sellable_unit(u'Pc')
        self.assertEqual(column._format_func(obj, True), '1 Pc')

        obj.product.manage_stock = False
        self.assertEqual(column._format_func(obj, True), '1 Pc')

        obj.quantity = 0
        self.assertEqual(column._format_func(obj, True), u"\u221E")
コード例 #3
0
ファイル: test_search.py プロジェクト: hackedbellini/stoq
    def test_format_func(self):
        class Fake(object):
            quantity = 0

        column = QuantityColumn('quantity')
        obj = Fake()

        obj.quantity = None
        self.assertEqual(column._format_func(obj, True), '0')

        obj.quantity = 0
        self.assertEqual(column._format_func(obj, True), '0')

        obj.quantity = 1
        self.assertEqual(column._format_func(obj, True), '1')

        obj.product = self.create_product()
        obj.sellable = obj.product.sellable

        # Without a unit, it should still return just the number
        obj.quantity = 1
        self.assertEqual(column._format_func(obj, True), '1')

        obj.sellable.unit = self.create_sellable_unit(u'Pc')
        self.assertEqual(column._format_func(obj, True), '1 Pc')

        obj.product.manage_stock = False
        self.assertEqual(column._format_func(obj, True), '1 Pc')

        obj.quantity = 0
        self.assertEqual(column._format_func(obj, True), u"\u221E")
コード例 #4
0
 def get_columns(self):
     return [
         IdentifierColumn('identifier', title=_(u"Returned #")),
         SearchColumn('status_str',
                      _('Status'),
                      data_type=str,
                      search_attribute='status',
                      valid_values=self._get_status_values()),
         SearchColumn('item_description', title=_(u"Item")),
         QuantityColumn('item_quantity', title=_(u"Qty")),
         SearchColumn('client_name',
                      _('Client'),
                      expand=True,
                      data_type=str),
         SearchColumn('return_date',
                      _('Return Date'),
                      data_type=datetime.date,
                      sorted=True),
         SearchColumn('reason',
                      _('Return Reason'),
                      data_type=str,
                      visible=False),
         SearchColumn('responsible_name', _('Responsible'), data_type=str),
         SearchColumn('branch_name',
                      _('Return branch'),
                      data_type=str,
                      visible=False),
         SearchColumn('invoice_number',
                      _('Invoice number'),
                      data_type=int,
                      visible=False),
     ]
コード例 #5
0
 def get_columns(self):
     columns = [
         SearchColumn('code',
                      title=_('Code'),
                      data_type=str,
                      sorted=True,
                      order=gtk.SORT_DESCENDING),
         SearchColumn('description',
                      title=_('Description'),
                      data_type=str,
                      expand=True),
         SearchColumn('client_name', title=_('Client'), data_type=str),
         SearchColumn('phone_number',
                      title=_('Phone'),
                      data_type=str,
                      visible=False,
                      format_func=format_phone_number),
         SearchColumn('email',
                      title=_('Email'),
                      data_type=str,
                      visible=False),
         SearchColumn('sellable_category',
                      title=_('Category'),
                      data_type=str,
                      visible=False),
         QuantityColumn('quantity', title=_('Qty')),
         SearchColumn('price', title=_('Avg price'), data_type=currency),
         SearchColumn(
             'total',
             title=_('Total'),
             data_type=currency,
         )
     ]
     return columns
コード例 #6
0
ファイル: productsearch.py プロジェクト: esosaja/stoq
    def get_columns(self):
        cols = [SearchColumn('code', title=_('Code'), data_type=str,
                             sort_func=sort_sellable_code,
                             sorted=True),
                SearchColumn('barcode', title=_('Barcode'), data_type=str),
                SearchColumn('category_description', title=_(u'Category'),
                             data_type=str, width=120),
                SearchColumn('description', title=_(u'Description'),
                             expand=True, data_type=str),
                SearchColumn('manufacturer', title=_('Manufacturer'),
                             data_type=str, visible=False),
                SearchColumn('model', title=_('Model'), data_type=str,
                             visible=False),
                SearchColumn('ncm', title=_('NCM'), data_type=str,
                             visible=False),
                Column('unit', title=_('Unit'), data_type=str, visible=False),
                SearchColumn('location', title=_('Location'), data_type=str,
                             visible=False)]
        # The price/cost columns must be controlled by hide_cost_column and
        # hide_price_column. Since the product search will be available across
        # the applications, it's important to restrict such columns depending
        # of the context.
        if not self.hide_cost_column:
            cols.append(SearchColumn('cost', _('Cost'), data_type=currency,
                                     format_func=get_formatted_cost, width=90))
        if not self.hide_price_column:
            cols.append(SearchColumn('price', title=_('Price'),
                                     data_type=currency, width=90))

        cols.append(QuantityColumn('stock', title=_('Stock')))
        return cols
コード例 #7
0
 def _get_items_columns(self):
     return [
         Column('code', _("Code"), sorted=True, data_type=str, width=130),
         Column('description',
                _("Description"),
                data_type=str,
                expand=True,
                width=200),
         Column('category', _("Category"), data_type=str, visible=False),
         Column('manufacturer',
                _("Manufacturer"),
                data_type=str,
                visible=False),
         QuantityColumn('quantity', title=_("Qty"), visible=True),
         Column('base_price',
                _("Base price"),
                data_type=currency,
                visible=False),
         Column('price', _("Sale price"), data_type=currency),
         Column('item_discount',
                _("Discount"),
                data_type=currency,
                visible=False),
         Column('total', _("Total"), data_type=currency)
     ]
コード例 #8
0
 def get_columns(self):
     columns = [
         SearchColumn('salesperson_name',
                      title=_('Salesperson'),
                      data_type=str),
         SearchColumn('code',
                      title=_('Code'),
                      data_type=str,
                      sorted=True,
                      order=Gtk.SortType.DESCENDING),
         SearchColumn('description',
                      title=_('Description'),
                      data_type=str,
                      expand=True),
         Column('brand', title=_('Brand'), data_type=str),
         Column('batch_number',
                title=_('Batch'),
                data_type=str,
                visible=False),
         SearchColumn('category',
                      title=_('Category'),
                      data_type=str,
                      visible=False),
         QuantityColumn('quantity', title=_('Qty'), use_having=True),
         SearchColumn('total',
                      title=_('Total'),
                      data_type=currency,
                      use_having=True)
     ]
     return columns
コード例 #9
0
    def get_columns(self):
        columns = [SearchColumn('code', title=_(u'Code'), data_type=str),
                   SearchColumn('barcode', title=_('Barcode'), data_type=str,
                                sort_func=sort_sellable_code, width=80),
                   SearchColumn('category_description', title=_('Category'),
                                data_type=str, width=120),
                   SearchColumn('description', title=_('Description'),
                                data_type=str, expand=True, sorted=True),
                   SearchColumn('location', title=_('Location'),
                                data_type=str, visible=False),
                   SearchColumn('manufacturer', title=_('Manufacturer'),
                                data_type=str, visible=False),
                   SearchColumn('model', title=_('Model'),
                                data_type=str, visible=False)]

        if hasattr(self.search_spec, 'price'):
            columns.append(SearchColumn('price',
                                        title=_(u'Price'),
                                        data_type=currency, visible=True))

        if hasattr(self.search_spec, 'minimum_quantity'):
            columns.append(SearchColumn('minimum_quantity',
                                        title=_(u'Minimum Qty'),
                                        data_type=Decimal, visible=False))

        if hasattr(self.search_spec, 'stock'):
            columns.append(QuantityColumn('stock', title=_(u'In Stock')))

        return columns
コード例 #10
0
 def get_columns(self):
     return [
         Column('branch_name',
                title=_('Branch'),
                data_type=str,
                expand=True),
         QuantityColumn('stock', title=_('In Stock'))
     ]
コード例 #11
0
ファイル: productsearch.py プロジェクト: esosaja/stoq
 def get_columns(self):
     return [Column('code', title=_('Code'), data_type=str,
                    sorted=True),
             Column('description', title=_('Description'),
                    data_type=str, expand=True),
             QuantityColumn('quantity', title=_('Sold')),
             Column('average_cost', title=_('Avg. Cost'),
                    data_type=currency), ]
コード例 #12
0
 def _get_returned_items_columns(self):
     return [Column("sellable.code", title=_("Product Code"), data_type=str,
                    width=130),
             Column("sellable.description", title=_("Description"),
                    data_type=str, expand=True),
             QuantityColumn("quantity", title=_("Qty returned")),
             Column("price", title=_("Price"), data_type=currency),
             Column("total", title=_("Total"), data_type=currency)]
コード例 #13
0
 def get_columns(self):
     return [
         SearchColumn('code',
                      title=_('Code'),
                      data_type=str,
                      sort_func=sort_sellable_code),
         SearchColumn('category_description',
                      title=_('Category'),
                      data_type=str,
                      width=100),
         SearchColumn('description',
                      title=_('Description'),
                      data_type=str,
                      expand=True,
                      sorted=True),
         SearchColumn('manufacturer',
                      title=_('Manufacturer'),
                      data_type=str,
                      visible=False),
         SearchColumn('model',
                      title=_('Model'),
                      data_type=str,
                      visible=False),
         SearchColumn('location',
                      title=_('Location'),
                      data_type=str,
                      visible=False),
         QuantityColumn('maximum_quantity',
                        title=_('Maximum'),
                        visible=False),
         QuantityColumn('minimum_quantity', title=_('Minimum')),
         QuantityColumn('stock', title=_('In Stock'), use_having=True),
         QuantityColumn('to_receive_quantity', title=_('To Receive')),
         ColoredColumn('difference',
                       title=_('Difference'),
                       color='red',
                       format_func=format_quantity,
                       data_type=Decimal,
                       data_func=lambda x: x <= Decimal(0))
     ]
コード例 #14
0
 def _get_ordered_columns(self):
     return [
         Column('description',
                title=_('Description'),
                data_type=str,
                expand=True,
                searchable=True,
                ellipsize=pango.ELLIPSIZE_END),
         QuantityColumn('quantity', title=_('Qty')),
         Column('cost',
                title=_('Cost'),
                data_type=currency,
                format_func=get_formatted_cost),
         Column('total', title=_('Total'), data_type=currency)
     ]
コード例 #15
0
 def get_columns(self):
     return [
         SearchColumn('code',
                      title=_('Code'),
                      sorted=True,
                      sort_func=sort_sellable_code,
                      data_type=str,
                      width=130),
         SearchColumn('barcode',
                      title=_("Barcode"),
                      data_type=str,
                      width=130),
         SearchColumn('category_description',
                      title=_("Category"),
                      data_type=str,
                      width=100,
                      visible=False),
         SearchColumn('description',
                      title=_("Description"),
                      data_type=str,
                      expand=True,
                      ellipsize=pango.ELLIPSIZE_END),
         SearchColumn('manufacturer',
                      title=_("Manufacturer"),
                      data_type=str,
                      visible=False),
         SearchColumn('brand',
                      title=_("Brand"),
                      data_type=str,
                      visible=False),
         SearchColumn('model',
                      title=_("Model"),
                      data_type=str,
                      visible=False),
         SearchColumn('location',
                      title=_("Location"),
                      data_type=str,
                      width=100,
                      visible=False),
         QuantityColumn('stock',
                        title=_('Quantity'),
                        width=100,
                        use_having=True),
         SearchColumn('has_image',
                      title=_('Picture'),
                      data_type=bool,
                      width=80),
     ]
コード例 #16
0
ファイル: productsearch.py プロジェクト: esosaja/stoq
 def get_columns(self):
     return [Column('code', title=_('Code'), data_type=str,
                    sort_func=sort_sellable_code,
                    sorted=True, width=130),
             Column('description', title=_('Description'), data_type=str,
                    expand=True),
             QuantityColumn('quantity_sold', title=_('Sold'), visible=not
                            self.show_production_columns),
             QuantityColumn('quantity_transfered', title=_('Transfered'),
                            visible=not self.show_production_columns),
             QuantityColumn('quantity_received', title=_('Received'),
                            visible=not self.show_production_columns),
             QuantityColumn('quantity_produced', title=_('Produced'),
                            visible=self.show_production_columns),
             QuantityColumn('quantity_consumed', title=_('Consumed'),
                            visible=self.show_production_columns),
             QuantityColumn('quantity_decreased',
                            title=_('Manualy Decreased'),
                            visible=self.show_production_columns),
             QuantityColumn('quantity_lost', title=_('Lost'),
                            visible=self.show_production_columns, )]