Ejemplo n.º 1
0
    def __init__(self, attribute, accessor, *args, **kwargs):
        if not accessor:
            raise TypeError('AccessorColumn needs an accessor argument')

        self.accessor = accessor
        assert callable(self.accessor)
        Column.__init__(self, attribute=attribute, *args, **kwargs)
Ejemplo n.º 2
0
    def __init__(self, attribute, title=None, data_type=None, **kwargs):
        kwargs.setdefault('search_attribute', attribute)

        Column.__init__(self, attribute, title, data_type, **kwargs)

        search_func = kwargs.get('search_func')
        if search_func and not callable(search_func):
            raise TypeError("search_func must be callable")
Ejemplo n.º 3
0
    def __init__(self, attribute, title=None, data_type=None,
                 long_title=None, valid_values=None, search_attribute=None,
                 **kwargs):
        """
        """
        self.long_title = long_title
        # FIXME: This is not being used at the moment
        self.valid_values = valid_values
        self.search_attribute = search_attribute
        self.sensitive = True

        Column.__init__(self, attribute, title, data_type, **kwargs)

        search_func = kwargs.get('search_func')
        if search_func and not callable(search_func):
            raise TypeError("search_func must be callable")
Ejemplo n.º 4
0
    def attach(self, objectlist):
        column = Column.attach(self, objectlist)

        # Add another renderer for checking if the person will be merged
        self._bool_renderer = gtk.CellRendererToggle()
        self._bool_renderer.connect('toggled', self._on_merge_toggled)
        column.pack_start(self._bool_renderer, False)
        column.reorder(self._bool_renderer, 0)
        return column
Ejemplo n.º 5
0
	def draw_window(self):
		"""Display related things."""

		# Make a window and split it into sections
		self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		self.hpaned = gtk.HPaned()
		self.window.add(self.hpaned)
		self.right_vpaned = gtk.VPaned()
		self.hpaned.pack2(self.right_vpaned)
		self.left_vbox = gtk.VBox()
		self.hpaned.pack1(self.left_vbox)

		# Make a Kiwi ObjectList with columns "name" and "count" for
		# subscription names and the
		name_column = Column('name', 'Name')
		name_column.expand = True
		unread_column = Column('unread', 'Unread')
		count_column = Column('count', 'Total')
		self.node_list = ObjectList([name_column, unread_column, count_column])
		self.left_vbox.pack_start(self.node_list)

		self.add_button = gtk.Button(stock=gtk.STOCK_ADD)
		self.add_button.set_label("New Subscription")
		self.add_button.connect("released", self.add_released)
		self.left_vbox.pack_end(self.add_button, expand=False)

		title_column = Column('title')
		author_column = Column('author')
		date_column = Column('date')
		title_column.expand = True
		self.entry_list = ObjectList([title_column, author_column, date_column])
		self.right_vpaned.pack1(self.entry_list)

		#self.webscroll = gtk.ScrolledWindow()
		#self.webview = webkit.WebView()
		#self.webscroll.add(self.webview)
		#self.right_vpaned.pack2(self.webscroll)

		self.window.show_all()
Ejemplo n.º 6
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('model',
                      title=_("Model"),
                      data_type=str,
                      visible=False),
         SearchColumn('location',
                      title=_("Location"),
                      data_type=str,
                      width=100,
                      visible=False),
         SearchColumn('stock',
                      title=_('Quantity'),
                      data_type=decimal.Decimal,
                      width=100),
         SearchColumn('unit',
                      title=_("Unit"),
                      data_type=str,
                      width=40,
                      visible=False),
         Column('has_image', title=_('Picture'), data_type=bool, width=80),
     ]
Ejemplo n.º 7
0
    def __init__(self, with_code=True, create_mode=False):
        self.create_mode = create_mode
        self._accounts = {}

        columns = [
            StockTextColumn('description',
                            title=_("Account name"),
                            data_type=str,
                            pack_end=True,
                            expand=True,
                            sorted=True,
                            sort_func=sort_models)
        ]
        if with_code:
            columns.append(
                Column('code', title=_("Code"), data_type=str, width=120))
        if not create_mode:
            # FIXME: This needs to be much better colorized, and moved to the
            #        domain classes
            def colorize(account):
                if (account.kind == 'account'
                        and account.account_type == Account.TYPE_INCOME):
                    return False
                else:
                    return payment_value_colorize(account.total)

            columns.append(
                ColoredColumn('total',
                              title=_("Total"),
                              width=100,
                              data_type=currency,
                              color='red',
                              data_func=colorize,
                              use_data_model=True))
        ObjectTree.__init__(self, columns, mode=Gtk.SelectionMode.SINGLE)

        def render_icon(icon):
            theme = Gtk.IconTheme.get_default()
            return theme.load_icon(icon, 16, Gtk.IconLookupFlags.FORCE_SIZE)

        self._pixbuf_money = render_icon(STOQ_MONEY)
        self._pixbuf_payable = render_icon(STOQ_PAYABLE_APP)
        self._pixbuf_receivable = render_icon(STOQ_BILLS)
        self._pixbuf_till = render_icon(STOQ_TILL_APP)
        if self.create_mode:
            self.set_headers_visible(False)
Ejemplo n.º 8
0
 def get_columns(self):
     return [SearchColumn('name', _('Name'), str,
                          sorted=True, expand=True),
             SearchColumn('client_category', _('Category'), str,
                          width=150, visible=False),
             SearchColumn('phone_number', _('Phone Number'), str,
                          format_func=format_phone_number, width=150),
             SearchColumn('mobile_number', _('Mobile Number'), str,
                          format_func=format_phone_number, width=150,
                          visible=False),
             Column('cnpj_or_cpf', _('Document'), str, width=150),
             SearchColumn('cnpj', self.company_doc_l10n.label, str, width=150, visible=False),
             SearchColumn('cpf', self.person_doc_l10n.label, str, width=130, visible=False),
             SearchColumn('rg_number', _('RG'), str, width=120),
             SearchColumn('birth_date', _('Birth Date'), datetime.date,
                          visible=False, search_func=self.birthday_search,
                          search_label=_('Birthday'))]
Ejemplo n.º 9
0
 def _get_columns(self):
     return [IdentifierColumn('identifier', _('Receiving #'), width=140),
             IdentifierColumn('purchase_identifier', _('Purchase #'), width=110),
             SearchColumn('packing_number', title=_('Packing Number'),
                          data_type=str, visible=False),
             SearchColumn('receival_date', _('Receival date'), expand=True,
                          data_type=datetime.date, sorted=True, width=110),
             SearchColumn('supplier_name', _('Supplier'), data_type=str,
                          expand=True),
             SearchColumn('responsible_name', _('Responsible'),
                          data_type=str, visible=False, expand=True),
             SearchColumn('purchase_responsible_name', _('Purchaser'),
                          data_type=str, visible=False, expand=True),
             SearchColumn('invoice_number', _('Invoice #'), data_type=int,
                          width=80),
             Column('subtotal', title=_('Products total'),
                    data_type=currency, width=150)]
Ejemplo n.º 10
0
 def get_columns(self):
     return [
         IdentifierColumn('identifier', title=_('Returned #'), sorted=True),
         Column("invoice_number",
                title=_("Invoice #"),
                data_type=int,
                width=90),
         Column("return_date",
                title=_("Return Date"),
                data_type=datetime.date,
                justify=Gtk.Justification.RIGHT,
                width=80),
         Column("product_name",
                title=_("Product"),
                searchable=True,
                data_type=str),
         Column("salesperson_name",
                title=_("Salesperson"),
                searchable=True,
                visible=False,
                data_type=str),
         Column("responsible_name",
                title=_("Responsible"),
                searchable=True,
                data_type=str),
         Column("reason",
                title=_("Reason"),
                searchable=False,
                expand=True,
                data_type=str),
         Column("price", title=_("Price"), data_type=currency),
         Column("quantity", title=_("Qty"), data_type=str),
         Column("total",
                title=_("Total"),
                justify=Gtk.Justification.RIGHT,
                data_type=currency,
                width=100)
     ]
Ejemplo n.º 11
0
    def get_columns(self, editable=True):
        adjustment = gtk.Adjustment(lower=0, upper=sys.maxint, step_incr=1)
        columns = [
            Column('will_return',
                   title=_('Return'),
                   data_type=bool,
                   editable=editable),
            Column('sellable.code',
                   title=_('Code'),
                   data_type=str,
                   visible=False),
            Column('sellable.barcode',
                   title=_('Barcode'),
                   data_type=str,
                   visible=False),
            Column('sellable.description',
                   title=_('Description'),
                   data_type=str,
                   expand=True),
            Column('price', title=_('Sale price'), data_type=currency),
        ]

        # max_quantity has no meaning on returns without a sale reference
        if self.model.sale:
            columns.append(
                Column('max_quantity',
                       title=_('Sold quantity'),
                       data_type=decimal.Decimal,
                       format_func=format_quantity))
        kwargs = {}
        if editable:
            kwargs['spin_adjustment'] = adjustment
        columns.extend([
            Column('quantity',
                   title=_('Quantity'),
                   data_type=decimal.Decimal,
                   format_func=format_quantity,
                   editable=editable,
                   **kwargs),
            Column('total', title=_('Total'), data_type=currency),
        ])

        return columns
Ejemplo n.º 12
0
 def _get_decrease_columns(self):
     return [IdentifierColumn("decrease_identifier", title=_('Decrease #'), sorted=True),
             Column('batch_number', title=_('Batch'), data_type=str,
                    visible=self._is_batch),
             Column('batch_date', title=_('Batch Date'),
                    data_type=datetime.date, visible=False),
             Column("date", title=_("Date"), data_type=datetime.date,
                    justify=Gtk.Justification.RIGHT),
             Column("removed_by_name", title=_("Removed By"), expand=True,
                    data_type=str),
             Column("quantity", title=_("Quantity"), data_type=int),
             Column("unit_description", title=_("Unit"), data_type=str)]
Ejemplo n.º 13
0
 def _get_columns(self):
     return [Column('description', title=_('Description'),
                    data_type=str, expand=True, searchable=True),
             Column('quantity', title=_('Ordered'), data_type=int,
                    width=90, format_func=format_quantity, expand=True),
             Column('quantity_received', title=_('Received'), data_type=int,
                    width=110, format_func=format_quantity),
             Column('sellable.unit_description', title=_('Unit'),
                    data_type=str, width=50),
             Column('cost', title=_('Cost'), data_type=currency, width=90),
             Column('total_received', title=_('Total'), data_type=currency,
                    width=100)]
Ejemplo n.º 14
0
    def setup_proxies(self):
        self.details_btn.set_sensitive(False)

        self.workorders.set_columns([
            IdentifierColumn('identifier', title=_('WO #'), sorted=True),
            IdentifierColumn('sale_identifier',
                             title=_("Sale #"),
                             visible=False),
            Column('status_str', _(u"Status"), data_type=str),
            Column('equipment',
                   _(u"Equipment (Description)"),
                   data_type=str,
                   expand=True,
                   pack_end=True),
            Column('category_color',
                   title=_(u'Equipment'),
                   column='equipment',
                   data_type=GdkPixbuf.Pixbuf,
                   format_func=render_pixbuf),
            Column('flag_icon',
                   title=_(u'Equipment'),
                   column='equipment',
                   data_type=GdkPixbuf.Pixbuf,
                   format_func_data=True,
                   format_func=self._format_state_icon),
            Column('client_name', _(u"Client"), data_type=str),
            Column('salesperson_name',
                   _(u"Salesperson"),
                   data_type=str,
                   visible=False),
            Column('open_date',
                   _(u"Open date"),
                   data_type=datetime.date,
                   visible=False),
            Column('approve_date',
                   _(u"Approval date"),
                   data_type=datetime.date)
        ])
        # Clear first to avoid duplication if the users goes back on the wizard
        self.workorders.clear()
        self.workorders.extend(self._find_orders())

        self.add_proxy(self.model, self.proxy_widgets)
Ejemplo n.º 15
0
 def _get_columns(self):
     adj = Gtk.Adjustment(lower=0, upper=MAX_INT, step_increment=1)
     return [Column("code", title=_(u"Code"), data_type=str, sorted=True,
                    width=100),
             Column("barcode", title=_(u"Barcode"), data_type=str,
                    width=100),
             Column("category_description", title=_(u"Category"),
                    data_type=str, width=100),
             Column("description", title=_(u"Description"),
                    data_type=str, expand=True),
             Column('manufacturer', title=_("Manufacturer"),
                    data_type=str, visible=False),
             Column('model', title=_("Model"),
                    data_type=str, visible=False),
             Column("initial_stock", title=_(u"Initial Stock"),
                    data_type=Decimal, format_func=self._format_qty,
                    editable=True, spin_adjustment=adj, width=110),
             Column("unit_cost", title=_(u"Unit Cost"), width=90,
                    data_type=currency, editable=True, spin_adjustment=adj)]
Ejemplo n.º 16
0
 def _get_returned_columns(self):
     return [IdentifierColumn("returned_identifier", title=_('Returned #'), sorted=True),
             Column('batch_number', title=_('Batch'), data_type=str,
                    visible=self._is_batch),
             Column('batch_date', title=_('Batch Date'),
                    data_type=datetime.date, visible=False),
             Column("reason", title=_(u"Reason"),
                    data_type=str, expand=True),
             Column("quantity", title=_(u"Quantity"),
                    data_type=Decimal, format_func=format_quantity),
             Column("invoice_number", title=_(u"Invoice"),
                    data_type=int, visible=False),
             Column("price", title=_(u"Price"), data_type=currency,
                    format_func=get_formatted_cost),
             Column("return_date", title=_(u"Return Date"),
                    data_type=datetime.date, justify=Gtk.Justification.RIGHT)]
Ejemplo n.º 17
0
 def get_columns(self):
     return [
         IdentifierColumn('identifier'),
         SearchColumn('work_order.status_str',
                      title=_(u'Status'),
                      search_attribute='status',
                      data_type=str,
                      valid_values=self._get_status_values(),
                      visible=False),
         SearchColumn('category_name',
                      title=_(u'Category'),
                      data_type=str,
                      visible=False),
         SearchColumn('equipment',
                      title=_(u'Equipment'),
                      data_type=str,
                      expand=True,
                      pack_end=True),
         Column('category_color',
                title=_(u'Equipment'),
                column='equipment',
                data_type=gtk.gdk.Pixbuf,
                format_func=render_pixbuf),
         SearchColumn('client_name', title=_(u'Client'), data_type=str),
         SearchColumn('branch_name',
                      title=_(u'Branch'),
                      data_type=str,
                      visible=False),
         SearchColumn('current_branch_name',
                      title=_(u'Current branch'),
                      data_type=str,
                      visible=False),
         SearchColumn('open_date',
                      title=_(u'Open date'),
                      data_type=datetime.date),
         SearchColumn('approve_date',
                      title=_(u'Approval date'),
                      data_type=datetime.date,
                      visible=False),
         SearchColumn('finish_date',
                      title=_(u'Finish date'),
                      data_type=datetime.date,
                      visible=False),
         SearchColumn('total', title=_(u'Total'), data_type=currency),
     ]
Ejemplo n.º 18
0
 def get_columns(self):
     return [
         IdentifierColumn('order.identifier', title=_('Order #'), sorted=True),
         Column('sellable.code', title=_('Code'), width=70, data_type=str),
         Column('sellable.description', title=_('Description'),
                data_type=str, expand=True, searchable=True),
         Column('quantity_received', title=_('Consigned'), data_type=Decimal,
                format_func=format_quantity),
         Column('quantity_sold', title=_('Sold'), data_type=Decimal,
                width=90),
         Column('quantity_returned', title=_('Returned'), data_type=Decimal,
                width=90),
         Column('cost', title=_('Cost'), data_type=currency,
                format_func=get_formatted_cost),
         Column('total_sold', title=_('Total Sold'), data_type=currency),
     ]
Ejemplo n.º 19
0
 def get_columns(self):
     return [IdentifierColumn('identifier', title=_('Sale #'),
                              sorted=True),
             Column('status_name', title=_(u'Status'), data_type=str,
                    visible=True),
             SearchColumn('open_date', title=_('Date Started'), width=110,
                          data_type=date, justify=gtk.JUSTIFY_RIGHT),
             SearchColumn('client_name', title=_('Client'),
                          data_type=str, expand=True,
                          ellipsize=pango.ELLIPSIZE_END),
             SearchColumn('salesperson_name', title=_('Salesperson'),
                          data_type=str, width=180,
                          ellipsize=pango.ELLIPSIZE_END),
             SearchColumn('total_quantity', title=_('Quantity'),
                          data_type=decimal.Decimal, width=100,
                          format_func=format_quantity),
             SearchColumn('total', title=_('Total'), data_type=currency,
                          width=100)]
Ejemplo n.º 20
0
 def get_columns(self):
     return [SearchColumn('person_name', _('Name'), str, expand=True, sorted=True),
             SearchColumn('fancy_name', _('Fancy name'), str, visible=False,
                          width=140),
             SearchColumn('branch_name', _('Branch Name'), str, width=100, visible=True),
             SearchColumn('acronym', _('Acronym'), str, visible=True,
                          width=100),
             SearchColumn('phone_number', _('Phone Number'), str, width=170,
                          visible=False),
             SearchColumn('manager_name', _('Manager'), str, visible=False,
                          width=250),
             Column('status_str', _('Status'), data_type=str, visible=False),
             SearchColumn('cnpj', _('CNPJ'), str, visible=True, width=140),
             SearchColumn('state_registry', _('State Registry'), str,
                          visible=False, width=120),
             SearchColumn('crt', _('Tax Policy'), int, visible=False),
             SearchColumn('city', _('City'), str, visible=False, width=140),
             SearchColumn('state', _('State'), str, visible=False, width=100)]
Ejemplo n.º 21
0
    def _setup_widgets(self):
        self.sale_items.set_columns([
            Column('code', title=_('Code'),
                   data_type=str, visible=False),
            Column('barcode', title=_('Barcode'),
                   data_type=str, visible=False),
            Column('description', title=_('Description'),
                   data_type=str, expand=True),
            Column('category_description', title=_('Category'),
                   data_type=str),
            Column('original_quantity', title=_('Quantity'),
                   data_type=decimal.Decimal),
            Column('quantity', title=_('Adjusted qty'),
                   data_type=decimal.Decimal),
            Column('price', title=_('price'), data_type=currency,
                   format_func=get_formatted_cost),
            Column('total', title=_('Total'), data_type=currency)])
        self.sale_items.extend(self._get_sale_items())

        self.sale_items.set_cell_data_func(self._on_sale_items__cell_data_func)
Ejemplo n.º 22
0
 def _get_payments_info_columns(self):
     return [Column('change_date', _(u"When"), data_type=datetime.date,
                    sorted=True),
             Column('description', _(u"Payment"), data_type=str, expand=True,
                    ellipsize=Pango.EllipsizeMode.END),
             Column('changed_field', _(u"Changed"), data_type=str,
                    justify=Gtk.Justification.RIGHT),
             Column('from_value', _(u"From"), data_type=str,
                    justify=Gtk.Justification.RIGHT),
             Column('to_value', _(u"To"), data_type=str,
                    justify=Gtk.Justification.RIGHT),
             Column('reason', _(u"Reason"), data_type=str,
                    ellipsize=Pango.EllipsizeMode.END)]
Ejemplo n.º 23
0
 def get_columns(self):
     return [
         Column('service.sellable.code', title=_('Code'), data_type=str),
         Column('service.sellable.category_description', title=_('Category'),
                data_type=str, expand=True),
         Column('service.sellable.description', title=_('Description'),
                data_type=str, expand=True, sorted=True),
         Column('quantity', title=_('Quantity'), data_type=Decimal,
                format_func=format_quantity),
         Column('service.sellable.unit_description', title=_('Unit'),
                data_type=str),
         Column('service.sellable.cost', title=_('Cost'),
                data_type=currency)]
Ejemplo n.º 24
0
 def _get_purchases_columns(self):
     return [
         IdentifierColumn('identifier', title=_('Code #'), sorted=True),
         Column('status_str', title=_('Status'), data_type=str),
         Column('responsible_name',
                title=_('Responsible'),
                expand=True,
                data_type=str),
         Column('branch_name', title=_('Branch'), data_type=str),
         Column('notes', title=_('Notes'), data_type=str),
         Column('supplier_name', title=_('Supplier'), data_type=str),
         Column('purchase_total', title=_('Value'), data_type=currency)
     ]
Ejemplo n.º 25
0
 def get_columns(self):
     return [Column("code", title=_("Code"), data_type=str,
                    width=120, sorted=True),
             Column("description", title=_("Description"), data_type=str,
                    expand=True, searchable=True),
             Column("quantity", title=_("Total quantity"),
                    data_type=str, width=120, justify=gtk.JUSTIFY_RIGHT),
             Column("sale_date", title=_("Sale date"),
                    data_type=datetime.date, width=150),
             Column("value", title=_("Value"), width=100,
                    data_type=currency, justify=gtk.JUSTIFY_RIGHT),
             Column("total_value", title=_("Total value"), width=100,
                    data_type=currency, justify=gtk.JUSTIFY_RIGHT, )]
Ejemplo n.º 26
0
 def _get_returned_items_columns(self):
     return [
         Column('return_date',
                _("Date"),
                data_type=datetime.date,
                sorted=True),
         Column('invoice_number', _("Invoice #"), data_type=int),
         Column('code', _("Code"), data_type=str, visible=False),
         Column('description', _("Description"), data_type=str,
                expand=True),
         Column('quantity',
                _("Quantity"),
                data_type=decimal.Decimal,
                format_func=format_quantity),
         Column('price', _("Sale price"), data_type=currency),
         Column('total', _("Total"), data_type=currency),
     ]
Ejemplo n.º 27
0
 def get_columns(self):
     adjustment = gtk.Adjustment(lower=0, upper=sys.maxint, step_incr=1)
     return [
         Column('sellable.code', title=_('Code'),
                data_type=str, visible=False),
         Column('sellable.barcode', title=_('Barcode'),
                data_type=str, visible=False),
         Column('sellable.description', title=_('Description'),
                data_type=str, expand=True),
         Column('quantity', title=_('Loaned'),
                data_type=Decimal, format_func=format_quantity),
         Column('sale_quantity', title=_('Sold'),
                data_type=Decimal, format_func=format_quantity,
                editable=True, spin_adjustment=adjustment),
         Column('return_quantity', title=_('Returned'),
                data_type=Decimal, format_func=format_quantity,
                editable=True, spin_adjustment=adjustment),
         Column('remaining_quantity', title=_('Remaining'),
                data_type=Decimal, format_func=format_quantity),
         Column('price', title=_('Price'), data_type=currency),
     ]
Ejemplo n.º 28
0
 def _get_columns(self):
     return [
         IdentifierColumn('identifier', title=_('Loan #'), sorted=True),
         SearchColumn('responsible_name',
                      title=_(u'Responsible'),
                      data_type=str,
                      expand=True),
         SearchColumn('client_name',
                      title=_(u'Client'),
                      data_type=str,
                      expand=True),
         SearchColumn('open_date',
                      title=_(u'Opened'),
                      data_type=datetime.date),
         SearchColumn('expire_date',
                      title=_(u'Expire'),
                      data_type=datetime.date),
         Column('loaned', title=_(u'Loaned'), data_type=Decimal),
     ]
Ejemplo n.º 29
0
 def __init__(self, caller, obj_tree, fucdkingdatamanager):
     # I also write shitty code, get used to that, too.
     self._caller = caller
     self._tree = obj_tree
     self._fsm = FileSystemManager()
     self.dm = fucdkingdatamanager
     col = [
         Column('summary',
                data_type=str,
                searchable=True,
                ellipsize=pango.ELLIPSIZE_END,
                expand=True),
     ]
     self._tree.set_columns(col)
     self._fill_rows()
     self._tree.set_headers_visible(False)
     # automagically import new Slider items
     inbox_monitor = gio.File(defs.NOTE_SLIDER_FOLDER).monitor_directory()
     inbox_monitor.connect('changed', self.process_slider_inbox_changes)
Ejemplo n.º 30
0
 def _get_product_columns(self):
     return [Column("sellable.code", title=_("Code"), data_type=str,
                    justify=Gtk.Justification.RIGHT, width=130),
             Column("sellable.description", title=_("Description"),
                    data_type=str, expand=True),
             Column("quantity", title=_("Quantity"),
                    data_type=int, justify=Gtk.Justification.RIGHT),
             Column("sale_quantity", title=_("Sold"),
                    data_type=int, justify=Gtk.Justification.RIGHT),
             Column("return_quantity", title=_("Returned"),
                    data_type=int, justify=Gtk.Justification.RIGHT),
             Column("price", title=_("Price"),
                    data_type=int, justify=Gtk.Justification.RIGHT),
             ]
Ejemplo n.º 31
0
 def get_columns(self):
     return [IdentifierColumn("identifier", title=_('WO #'), sorted=True),
             Column("equipment", title=_("Equipment"),
                    data_type=str, expand=True, pack_end=True),
             Column('category_color', title=_(u'Equipment'),
                    column='equipment', data_type=gtk.gdk.Pixbuf,
                    format_func=render_pixbuf),
             Column('flag_icon', title=_(u'Equipment'), column='equipment',
                    data_type=gtk.gdk.Pixbuf, format_func_data=True,
                    format_func=self._format_state_icon),
             Column("open_date", title=_("Open date"),
                    data_type=datetime.date, width=120),
             Column("approve_date", title=_("Approve date"),
                    data_type=datetime.date, width=120),
             Column("finish_date", title=_("Finish date"),
                    data_type=datetime.date, width=120),
             Column("total", title=_("Total"),
                    data_type=currency, width=100)]
Ejemplo n.º 32
0
 def get_columns(self, editable=True):
     return [
         Column('sellable.code', title=_(u'Code'),
                data_type=str, visible=False),
         Column('sellable.barcode', title=_(u'Barcode'),
                data_type=str, visible=False),
         Column('sellable.description', title=_(u'Description'),
                data_type=str, expand=True,
                format_func=self._format_description, format_func_data=True),
         Column('price', title=_(u'Price'),
                data_type=currency),
         Column('quantity', title=_(u'Quantity'),
                data_type=decimal.Decimal, format_func=format_quantity),
         Column('quantity_decreased', title=_(u'Consumed quantity'),
                data_type=decimal.Decimal, format_func=format_quantity),
         Column('total', title=_(u'Total'),
                data_type=currency),
     ]
Ejemplo n.º 33
0
class ProductManufacturerListSlave(ModelListSlave):
    editor_class = ProductManufacturerEditor
    model_type = ProductManufacturer
    columns = [
        Column('name',
               title=_('Manufacturer'),
               data_type=str,
               expand=True,
               sorted=True)
    ]

    def delete_model(self, model, store):
        if not model.can_remove():
            self.refresh()
            warning(
                _("%s cannot be deleted, because it is used in one or more "
                  "products.") % model.name)
            return
        model = store.fetch(model)
        model.remove()
Ejemplo n.º 34
0
    def get_columns(self):
        ext_args = {}
        is_receiving_return = bool(self.wizard.receiving_order)
        # The quantity column will only be editable if this decrease refers to
        # a receiving return
        if is_receiving_return:
            ext_args.update({
                'spin_adjustment':
                Gtk.Adjustment(lower=0, upper=MAX_INT, step_increment=1),
                'editable':
                True
            })
        columns = [
            Column('sellable.code', title=_('Code'), data_type=str),
            Column('sellable.description',
                   title=_('Description'),
                   data_type=str,
                   expand=True,
                   searchable=True,
                   format_func=self._format_description,
                   format_func_data=True),
            Column('sellable.category_description',
                   title=_('Category'),
                   data_type=str,
                   expand=True,
                   searchable=True),
            Column('quantity',
                   title=_('Quantity'),
                   data_type=Decimal,
                   format_func=format_quantity,
                   **ext_args),
            Column('sellable.unit_description',
                   title=_('Unit'),
                   data_type=str,
                   width=70),
        ]

        if self.wizard.create_payments:
            columns.extend([
                Column('cost', title=_('Cost'), data_type=currency),
                Column('total', title=_('Total'), data_type=currency),
            ])

        return columns
Ejemplo n.º 35
0
 def _get_columns(self):
     return [
         Column('identifier',
                _('Payment #'),
                data_type=int,
                width=60,
                visible=False,
                format_func=str,
                sorted=True),
         Column('description', _("Description"), data_type=str),
         Column('due_date', _("Due"), data_type=datetime.date),
         Column('paid_date', _("Paid date"), data_type=datetime.date),
         Column('base_value', _("Value"), data_type=currency),
         Column('paid_value', _("Paid value"), data_type=currency)
     ]
Ejemplo n.º 36
0
 def __init__(self, attribute, title, editor, **kwargs):
     Column.__init__(self, attribute=attribute, title=title,
                     data_type=str, **kwargs)
     self.editor = editor
Ejemplo n.º 37
0
 def __init__(self, *args, **kwargs):
     Column.__init__(self, *args, **kwargs)
Ejemplo n.º 38
0
 def attach(self, objectlist):
     column = Column.attach(self, objectlist)
     self._pixbuf_renderer = gtk.CellRendererPixbuf()
     column.pack_start(self._pixbuf_renderer, False)
     return column