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)
class _CreditInfoListSlave(ModelListSlave): model_type = Payment editor_class = None columns = [ IdentifierColumn('identifier', sorted=True), Column('date', title=_(u'Date'), data_type=datetime.date, width=150), Column('description', title=_(u'Description'), data_type=str, width=150, expand=True), ColoredColumn('value', title=_(u'Value'), color='red', data_type=currency, width=100, data_func=lambda x: x < decimal.Decimal(0)) ] def __init__(self, *args, **kwargs): ModelListSlave.__init__(self, *args, **kwargs) self.set_list_type(ListType.ADDONLY) def populate(self): return self.parent.person.get_credit_transactions() def run_editor(self, store, model): store.savepoint('before_run_editor_credit') retval = self.run_dialog(CreditEditor, store=self.store, client=self.parent.person) if not retval: store.rollback_to_savepoint('before_run_editor_credit') return retval
def __init__(self, attribute, title, editor, **kwargs): Column.__init__(self, attribute=attribute, title=title, data_type=str, **kwargs) self.editor = editor
def _get_columns(self): return [Column('began', _('Began'), data_type=datetime.date, width=100), Column('ended', _('Ended'), data_type=datetime.date, width=100, sorted=True), Column('role.name', _('Role'), data_type=str, width=200), Column('salary', _('Salary'), data_type=currency)]
def _get_produced_items_columns(self): # Create a cache for test results, to avoid quering the database for # every update. self._test_result_cache = dict() columns = [Column('serial_number', title=_('Serial Number'), data_type=str, expand=True)] # Add one column for each test from each product. products = dict() for item in self.model.get_items(): if item.product in products: continue products[item.product] = 1 for test in item.product.quality_tests: columns.append( # This wont just the serial number, since we use format_func # to change the displayed value, but we still need one # property to create the column ColoredColumn('serial_number', data_type=str, title=test.description, format_func=self._format_func, format_func_data=test, color='red', data_func=self._colorize, use_data_model=True)) columns.extend([ Column('test_passed', title=_('Tests Passed'), data_type=bool, visible=False), Column('entered_stock', title=_('Entered Stock'), data_type=bool, visible=False)]) return columns
def _get_payments_columns(self): return [ IdentifierColumn('identifier'), Column('description', _("Description"), data_type=str, width=150, expand=True, ellipsize=pango.ELLIPSIZE_END), Column('due_date', _("Due date"), sorted=True, data_type=datetime.date, width=90, justify=gtk.JUSTIFY_RIGHT), Column('paid_date', _("Paid date"), data_type=datetime.date, width=90), Column('status_str', _("Status"), data_type=str, width=80), ColoredColumn('value', _("Value"), data_type=currency, width=90, justify=gtk.JUSTIFY_RIGHT, use_data_model=True, data_func=payment_value_colorize), ColoredColumn('paid_value', _("Paid value"), data_type=currency, width=92, justify=gtk.JUSTIFY_RIGHT, use_data_model=True, data_func=payment_value_colorize) ]
def _get_service_columns(self): return [Column('description', _("Description"), data_type=str, expand=True, ellipsize=pango.ELLIPSIZE_END), Column('quantity', _("Quantity"), data_type=Decimal, justify=gtk.JUSTIFY_RIGHT), Column('unit_description', _("Unit"), data_type=str, justify=gtk.JUSTIFY_RIGHT)]
def _get_received_columns(self): return [ Column('description', title=_('Description'), data_type=str, expand=True, searchable=True, ellipsize=pango.ELLIPSIZE_END), Column('quantity_received_as_string', title=_('Quantity Received'), data_type=str, width=150, editable=True, justify=gtk.JUSTIFY_RIGHT), Column('cost', title=_('Cost'), data_type=currency, format_func=get_formatted_cost, editable=True, width=90), Column('total_received', title=_('Total'), data_type=currency, width=100) ]
def get_columns(self): return [ Column('code', title=_('Reference'), data_type=str, width=130, justify=gtk.JUSTIFY_RIGHT), Column('description', title=_('Description'), data_type=str, expand=True, searchable=True, ellipsize=pango.ELLIPSIZE_END), Column('price', title=_('Price'), data_type=currency, width=110, justify=gtk.JUSTIFY_RIGHT), Column('quantity_unit', title=_('Quantity'), data_type=unicode, width=110, justify=gtk.JUSTIFY_RIGHT), Column('total', title=_('Total'), data_type=currency, justify=gtk.JUSTIFY_RIGHT, width=100) ]
def _get_delivery_items_columns(self): return [ Column('sellable.description', title=_('Products to deliver'), data_type=str, expand=True, sorted=True), Column('quantity', title=_('Quantity'), data_type=decimal.Decimal, format_func=format_quantity), ]
def _get_payments_columns(self): return [ IdentifierColumn('identifier'), Column('method.description', _("Type"), data_type=str, width=60), Column('description', _("Description"), data_type=str, width=150, expand=True), Column('due_date', _("Due date"), sorted=True, data_type=datetime.date, width=90, justify=gtk.JUSTIFY_RIGHT), Column('paid_date', _("Paid date"), data_type=datetime.date, width=90), Column('status_str', _("Status"), data_type=str, width=80), ColoredColumn('value', _("Value"), data_type=currency, width=90, color='red', justify=gtk.JUSTIFY_RIGHT, data_func=payment_value_colorize), ColoredColumn('paid_value', _("Paid value"), data_type=currency, width=92, color='red', justify=gtk.JUSTIFY_RIGHT, data_func=payment_value_colorize) ]
def _get_production_items_columns(self): return [ Column('description', title=_('Description'), data_type=str, expand=True, searchable=True, ellipsize=pango.ELLIPSIZE_END, sorted=True), Column('unit_description', _("Unit"), data_type=str, justify=gtk.JUSTIFY_RIGHT), Column('quantity', title=_('Quantity'), data_type=Decimal, justify=gtk.JUSTIFY_RIGHT), Column('produced', title=_('Produced'), data_type=Decimal, justify=gtk.JUSTIFY_RIGHT), Column('lost', title=_('Lost'), data_type=Decimal, justify=gtk.JUSTIFY_RIGHT) ]
def _get_columns(self): return [Column('description', title=_('Description'), data_type=str, expand=True, sorted=True, format_func=stoqlib_gettext), Column('visible', title=_('Visible'), data_type=bool, width=120, editable=True), Column('mandatory', title=_('Mandatory'), data_type=bool, width=120, editable=True)]
def _get_sale_items_columns(self): return [Column('code', title=_('Code'), data_type=str), Column('description', title=_('Description'), data_type=str, expand=True), Column('quantity', title=_('Quantity'), data_type=decimal.Decimal, format_func=format_quantity), Column('deliver', title=_('Deliver'), data_type=bool, editable=True)]
def _get_columns(self): return [IdentifierColumn('identifier', title=_("Quote #"), sorted=True), IdentifierColumn('group_identifier', title=_('Group #')), Column('supplier_name', title=_('Supplier'), data_type=str, width=300), Column('open_date', title=_('Open date'), data_type=datetime.date), Column('deadline', title=_('Deadline'), data_type=datetime.date)]
def get_columns(self): return [ Column('sellable.description', title=_('Description'), data_type=str, expand=True, searchable=True), Column('quantity', title=_('Quantity'), data_type=float, width=90, format_func=format_quantity), Column('sellable.unit_description', title=_('Unit'), data_type=str, width=70), ]
def get_columns(self): return [Column('name', title=_(u'Supplier'), data_type=str, expand=True, sorted=True), Column('supplier_code', title=_(u'Product Code'), data_type=str), Column('lead_time_str', title=_(u'Lead time'), data_type=str), Column('minimum_purchase', title=_(u'Minimum Purchase'), data_type=Decimal), Column('base_cost', title=_(u'Cost'), data_type=currency, format_func=get_formatted_cost)]
def _get_columns(self): return [ Column('is_active', title=_('Active'), width=20, data_type=bool), Column('icon', data_type=str, width=24, use_stock=True, icon_size=gtk.ICON_SIZE_BUTTON), Column('description', data_type=str, expand=True, use_markup=True) ]
def get_columns(self): return [ Column('sellable.description', title=_(u'Description'), data_type=str, expand=True, searchable=True), AccessorColumn('stock', title=_(u'Stock'), data_type=Decimal, accessor=self._get_stock_quantity, width=80), Column('quantity', title=_(u'Transfer'), data_type=Decimal, width=100), AccessorColumn('total', title=_(u'Total'), data_type=Decimal, accessor=self._get_total_quantity, width=80), ]
def get_columns(self): return [ Column('product.sellable.code', title=_('Code'), data_type=str), Column('product.sellable.category_description', title=_('Category'), data_type=str, expand=True), Column('product.sellable.description', title=_('Description'), data_type=str, expand=True, sorted=True), Column('quantity', title=_('Quantity'), data_type=Decimal, format_func=format_quantity), Column('product.sellable.unit_description', title=_('Unit'), data_type=str)]
def _get_columns(self): return [ Column('selected', title=" ", data_type=bool, editable=True), Column('supplier.person.name', title=_('Supplier'), data_type=str, sorted=True, expand=True), Column('products_per_supplier', title=_('Supplied/Total'), data_type=str) ]
def _get_stock_decrease_columns(self): return [ IdentifierColumn('identifier', sorted=True), Column('confirm_date', _('Date'), data_type=datetime.date, width=100), Column('branch_name', _('Branch'), data_type=unicode, expand=True), Column('removed_by_name', _('Removed By'), data_type=unicode, width=120) ]
def _get_items_columns(self): return [ Column('description', _("Description"), sorted=True, data_type=unicode, expand=True), Column('open_date', _("Open date"), data_type=datetime.date, width=90), Column('total_amount', _("Total"), data_type=currency, width=100) ]
def _get_columns(self): return [ IdentifierColumn('identifier'), Column('description', title=_('Description'), data_type=str, expand=True), Column('due_date', title=_('Due date'), data_type=datetime.date, width=90), Column('status_str', title=_('Status'), data_type=str, width=80), Column('value', title=_('Value'), data_type=currency, width=100) ]
def _get_columns(self): return [ Column('code', title=_(u'Code'), data_type=int, expander=True, sorted=True), Column('quantity', title=_(u'Quantity'), data_type=Decimal), Column('unit', title=_(u'Unit'), data_type=str), Column('description', title=_(u'Description'), data_type=str, expand=True), Column('category', title=_(u'Category'), data_type=str), # Translators: Ref. is for Reference (as in design reference) Column('design_reference', title=_(u'Ref.'), data_type=str), Column('production_cost', title=_(u'Production Cost'), format_func=get_formatted_cost, data_type=currency), Column('total_production_cost', title=_(u'Total'), format_func=get_formatted_cost, data_type=currency), ]
def get_columns(self, *args): return [ IdentifierColumn('identifier', sorted=True), Column('date', _('Date'), data_type=datetime.date), Column('time', _('Time'), data_type=datetime.time), Column('description', _('Description'), data_type=str, expand=True), ColoredColumn('value', _('Value'), data_type=currency, color='red', data_func=payment_value_colorize, width=140) ]
def _create_dialog(self): objs = [] for i in range(10): objs.append(Settable( id=i, desc="Object %d" % i, )) columns = [ Column('id', title='#', data_type=int), Column('desc', title='Description', data_type=str, expand=True), ] return SimpleListDialog(columns=columns, objects=objs)
def get_columns(self): return [ Column('sellable.code', title=_('Code'), width=100, data_type=str), Column('sellable.description', title=_('Description'), data_type=str, width=250, searchable=True, expand=True), Column('sellable.category_description', title=_('Category'), data_type=str, searchable=True, visible=False), Column('quantity', title=_('Quantity'), data_type=float, width=90, format_func=format_quantity), Column('expected_receival_date', title=_('Expected Receival'), data_type=datetime.date, visible=False), Column('sellable.unit_description', title=_('Unit'), data_type=str, width=70), Column('cost', title=_('Cost'), data_type=currency, format_func=get_formatted_cost, width=90), Column('total', title=_('Total'), data_type=currency, width=100), ]
def __init__(self, attribute, title=None, data_type=None, long_title=None, valid_values=None, search_attribute=None, **kwargs): """ """ self.long_title = long_title 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")
def _create_ui(self): hbox = gtk.HBox() self.main.remove(self.main.get_child()) self.main.add(hbox) hbox.show() self.forms = ObjectList( [Column('description', title=_('Description'), sorted=True, expand=True, format_func=stoqlib_gettext)], self.store.find(UIForm), gtk.SELECTION_BROWSE) self.forms.connect('selection-changed', self._on_forms__selection_changed) self.forms.set_headers_visible(False) self.forms.set_size_request(200, -1) hbox.pack_start(self.forms, False, False) self.forms.show() box = gtk.VBox() hbox.pack_start(box) box.show() self.fields = ObjectList(self._get_columns(), [], gtk.SELECTION_BROWSE) box.pack_start(self.fields) self.fields.show() box.show()